Skip to content

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

@bradsmithmba

Description

@bradsmithmba

Summary

TransferTrainer.setup_optimizers() constructs a torch.optim.lr_scheduler.ReduceLROnPlateau with an argument that newer torch versions no longer accept, raising a TypeError at scheduler construction. Three tests in tests/models/test_transfer_trainer.py fail as a result.

Failing tests

tests/models/test_transfer_trainer.py::TestTransferTrainer::test_setup_optimizers_with_transferred_layers
tests/models/test_transfer_trainer.py::TestTransferTrainer::test_transfer_learning_train_integration
tests/models/test_transfer_trainer.py::TestIntegrationWithSpatialNet::test_transfer_trainer_with_spatial_net

Cause

ReduceLROnPlateau in recent torch removed the verbose parameter (deprecated in 2.2, removed thereafter). Code written against an older torch passes it positionally or by keyword, which now raises TypeError.

Fix direction

Remove the unsupported argument from the ReduceLROnPlateau(...) call in src/models/transfer_trainer.py::setup_optimizers(). If verbose logging of LR changes is still wanted, log it explicitly rather than relying on the removed scheduler flag. Pin or document the supported torch version range in requirements.txt to prevent silent drift.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions