Do we need to explicity save the model if the save steps is not a multiple of the num steps with HF?

Do we need to explicity save the model if the save steps is not a multiple of the num steps with HF trainera?

trainer.train()
    trainer.save_model(output_dir=output_dir)  # TODO is this relaly needed?

cross: Discord
ref: Do we need to explicity save the model if the save steps is not a multiple of the num steps with HF?

Do we need to explicitly save a Hugging Face (HF) model trained with HF trainer after the trainer.train() even if we are checkpointing?

related question: huggingface transformers - Do we need to explicitly save a Hugging Face (HF) model trained with HF trainer after the trainer.train() even if we are checkpointing? - Stack Overflow

going to use:

    # - Make sure to save best checkpoint TODO: do we really need this? https://stackoverflow.com/questions/77261009/do-we-need-to-explicitly-save-a-hugging-face-hf-model-trained-with-hf-trainer
    final_ckpt_dir = output_dir / f'ckpt-{max_steps}'
    final_ckpt_dir.mkdir(parents=True, exist_ok=True)
    trainer.save_model(output_dir=final_ckpt_dir)  # TODO is this relaly needed? https://discuss.huggingface.co/t/do-we-need-to-explicity-save-the-model-if-the-save-steps-is-not-a-multiple-of-the-num-steps-with-hf/56745
    print('Done!\a')