Skip to content

fix(training): drop removed ReduceLROnPlateau verbose arg (#22)#34

Open
bradsmithmba wants to merge 1 commit into
cloudtrainerwork:masterfrom
bradsmithmba:fix/torch-reducelronplateau
Open

fix(training): drop removed ReduceLROnPlateau verbose arg (#22)#34
bradsmithmba wants to merge 1 commit into
cloudtrainerwork:masterfrom
bradsmithmba:fix/torch-reducelronplateau

Conversation

@bradsmithmba

Copy link
Copy Markdown

Summary

ReduceLROnPlateau was constructed with verbose=True in two places:

  • src/models/transfer_trainer.pyTransferTrainer.setup_optimizers()
  • src/training/trainer.pyTrainer.__init__

PyTorch deprecated the scheduler verbose parameter in 2.2 and removed it afterward. On current torch the constructor raises TypeError: ReduceLROnPlateau.__init__() got an unexpected keyword argument 'verbose', so any path that builds the scheduler fails. This broke 3 tests in tests/models/test_transfer_trainer.py at optimizer setup.

Closes #22.

Fix

Remove verbose=True from both call sites. Both sites were found (the issue mentioned transfer_trainer; trainer.py has the identical defect and is fixed here too).

Verification

On torch 2.12.0:

ReduceLROnPlateau(opt, mode='min', factor=0.5, patience=5)              -> constructs + steps OK
ReduceLROnPlateau(opt, mode='min', factor=0.5, patience=10, min_lr=1e-6) -> constructs + steps OK
ReduceLROnPlateau(opt, ..., verbose=True)                              -> TypeError (old behavior)

CI note

tests/models/test_transfer_trainer.py transitively imports the src.features chain, which is broken until #1 (PR #19) merges, so the file can't be collected on master yet. The corrected scheduler construction was verified directly against torch 2.12. The 3 tests run once #1 lands.

🤖 Generated with Claude Code

ReduceLROnPlateau was constructed with verbose=True in both
TransferTrainer.setup_optimizers() and Trainer.__init__. PyTorch deprecated
the scheduler verbose parameter in 2.2 and removed it thereafter, so on
current torch (2.12 here) the constructor raises TypeError and any code
path that builds the scheduler dies. This broke 3 tests in
tests/models/test_transfer_trainer.py at optimizer setup.

Remove the unsupported verbose argument from both call sites. No behavior
change beyond losing the scheduler's built-in LR-change logging, which the
removed flag no longer provides anyway.

Closes cloudtrainerwork#22

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

transfer_trainer: ReduceLROnPlateau call breaks on current torch (API drift)

1 participant