[Trainer] Move optimizer cls init to trainer_optimizer.py
by SunMarc
·
Feb 06, 2026 at 19:25 UTC
·
scan-f6e841fc9e8c8dc8
Get this automatically on every PR
Install the Axiomo GitHub App to get Signals as check runs and PR comments on every pull request.
Risk level: Critical (90%)
Refactor optimizer class initialization by moving it to trainer_optimizer.py.
src/transformers/trainer_optimizer.py created with +608 lines.
Changes in src/transformers/trainer.py include updates to get_optimizer_cls_and_kwargs.
tests/trainer/test_trainer.py simplified with -299 lines.
Trusted contributor with 205 merged PRs. has 259 followers. unfamiliar with src/transformers/trainer_optimizer.py.
First-time contributor to this repository.
Focus on 1 critical file(s)
src/transformers/trainer_optimizer.py
+608
608 lines changed; New file; Source code
src/transformers/trainer.py
+512
512 lines changed; Source code
tests/trainer/test_trainer.py
+355
355 lines changed; Source code
163
minutes to review
extensive
effort level
none
staleness risk
Schedule dedicated review time; consider pair review
Critical risk level requires changes before approval
Consider breaking into smaller PRs
Why is lint_passing missing? Consider adding this check.
Why is security_scan_clean missing? Consider adding this check.
src/transformers/trainer_optimizer.py
Critical file: 608 lines changed; New file; Source code