transformers/tests/trainer
Manny Cortes 082834dd79
fix: prevent model access error during Optuna hyperparameter tuning (#36395)
* fix: prevent model access error during Optuna hyperparameter tuning

The `transformers.integrations.integration_utils.run_hp_search_optuna` function releases model memory and sets trainer.model to None after each trial. This causes an AttributeError when  subsequent Trainer.train calls attempt to access the model before reinitialization. This is only an issue when `fp16_full_eval` or `bf16_full_eval` flags are enabled.

* Update src/transformers/trainer.py

Co-authored-by: Marc Sun <57196510+SunMarc@users.noreply.github.com>

---------

Co-authored-by: Marc Sun <57196510+SunMarc@users.noreply.github.com>
2025-02-26 17:06:48 +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 Enhance DataCollatorForLanguageModeling with Configurable Token Replacement Probabilities (#35251) 2025-01-14 17:01:10 +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 CI: update to ROCm 6.0.2 and test MI300 (#30266) 2024-05-13 18:14:36 +02:00
test_trainer_fsdp.py Remove FSDP wrapping from sub-models. (#34452) 2024-11-15 23:00:03 +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: prevent model access error during Optuna hyperparameter tuning (#36395) 2025-02-26 17:06:48 +01:00