What does 'output_dir' mean in transformers.TrainingArguments?

Question:

On the huggingface site documentation, it says ‘The output directory where the model predictions and checkpoints will be written’. I don’t quite understand what it means. Do I have to create any file for that?

Asked By: abhishekkuber

||

Answers:

The trainer of the Huggingface models can save many things. Most importantly:

  • Vocabulary of the tokenizer that is used (as a JSON file)

  • Model configuration: a JSON file saying how to instantiate the model object, i.e., architecture and hyperparameters

  • Model checkpoints: trainable parameters of the model saved during training

  • Further it can save the values of metrics used during training and the state of the training (so the training can be restored from the same place)

All these are stored in files in the output_dir directory. You do not have to create the directory in advance, but the path to the directory at least should exist.

Answered By: Jindřich