transformers/tests/trainer
Sean (Seok-Won) Yi 691d1b52c3
Fix/best model checkpoint fix (#35885)
* Set best_model_checkpoint only when ckpt exists.

Rather than set it explicitly without checking if the checkpoint directory even exists as before, now we moved the setting logic inside of _save_checkpoint and are only setting it if it exists.

* Added best_global_step to TrainerState.

* Added tests for best_model_checkpoint.

* Fixed hard-coded values in test to prevent fail.

* Added helper func and removed hard-coded best_step.

* Added side effect patch generator for _eval.

* Added evaluate side effect func.

* Removed erroneous patching.

* Fixed minor bug.

* Applied Ruff.

* Fixed Ruff problem in make style.

* Used Trainer.set_initial_training_values.
2025-03-14 14:24:53 +01:00
..
__init__.py [Test refactor 1/5] Per-folder tests reorganization (#15725) 2022-02-23 15:46:28 -05:00
test_data_collator.py Fixed datatype related issues in DataCollatorForLanguageModeling (#36457) 2025-03-07 14:09:27 +00:00
test_trainer_callback.py fix: prevent second save in the end of training if last step was saved already (#36219) 2025-02-20 17:38:52 +01:00
test_trainer_distributed_loss.py Fix multi gpu loss sync condition, add doc and test (#35743) 2025-02-12 15:41:31 +01:00
test_trainer_distributed.py HPU support (#36424) 2025-03-12 09:08:12 +01:00
test_trainer_fsdp.py HPU support (#36424) 2025-03-12 09:08:12 +01:00
test_trainer_seq2seq.py Trainer - deprecate tokenizer for processing_class (#32385) 2024-10-02 14:08:46 +01:00
test_trainer_tpu.py [Test refactor 1/5] Per-folder tests reorganization (#15725) 2022-02-23 15:46:28 -05:00
test_trainer_utils.py layernorm_decay_fix (#35927) 2025-02-04 11:01:49 +01:00
test_trainer.py Fix/best model checkpoint fix (#35885) 2025-03-14 14:24:53 +01:00