Saving model per some step when using Trainer
When using theTrainerandTrainingArgumentsfrom transformers, I notice that by default, the Trainer save a model every 500 steps. How can I change this value so that it save the model more/less frequent?here is a snipet that i usetraining_args = TrainingArguments(
        output_dir=output_directory,          # output directory
        num_train_epochs=10,              # total number of training epochs
        per_device_train_batch_size=16,  # batch size per device during training
        per_device_eval_batch_size=64,   # batch size for evaluation
        warmup_steps=500,                # number of warmup steps for learning rate scheduler
        weight_decay=0.01,               # strength of weight decay
        logging_dir=log_directory,            # directory for storing logs
    )

    trainer = Trainer(
        model=model,                         # the instantiated 🤗 Transformers model to be trained
        args=training_args,                  # training arguments, defined above
        train_dataset=train_dataset,         # training dataset
        eval_dataset=val_dataset             # evaluation dataset
    )

    trainer.train()
2021-11-10T11:12:14Z
This is explained in thedocumentation.You can change the argument “save_steps”, which defaults to 500.
2021-11-10T12:31:36Z
You can also use a differentsave_strategyto never save, or save every epoch.
2023-12-11T08:59:34Z
How can I save each checkpoint at a different out_dir, currently, my recent model is stored in same output dir as previous directory, I want to save every new model after steps to a different directory, can I specify out_dir something like : '/model-{step-no. (or epoch no.)} ?