Skip to content

Conversation

vfdev-5
Copy link
Collaborator

@vfdev-5 vfdev-5 commented Nov 16, 2022

Fixes #2773

Description:

  • Fixed torch LRScheduler issue and fixed CI

Check list:

  • New tests are added (if a new feature is added)
  • New doc strings: description and/or example code are in RST format
  • Documentation is updated (if required)

@github-actions github-actions bot added docs module: contrib Contrib module module: handlers Core Handlers module labels Nov 16, 2022
@vfdev-5
Copy link
Collaborator Author

vfdev-5 commented Nov 16, 2022

There is again mypy inconsistency between stable and nightly pytorch:

# STABLE PyTorch:

mypy --config-file mypy.ini
ignite/handlers/param_scheduler.py:18: error: Module "torch.optim.lr_scheduler" has no attribute "LRScheduler"; maybe "_LRScheduler"?  [attr-defined]
        from torch.optim.lr_scheduler import LRScheduler as PyTorchLRScheduler
        ^
ignite/handlers/param_scheduler.py:882: error: Unused "type: ignore" comment
            self.lr_scheduler._get_lr_called_within_step = True  # type: ignore[attr-defined]
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ignite/handlers/param_scheduler.py:884: error: Unused "type: ignore" comment
            self.lr_scheduler._get_lr_called_within_step = False  # type: ignore[attr-defined]
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ignite/contrib/engines/common.py:13: error: Module "torch.optim.lr_scheduler" has no attribute "LRScheduler"; maybe "_LRScheduler"?  [attr-defined]
        from torch.optim.lr_scheduler import LRScheduler as PyTorchLRScheduler
        ^
Found 4 errors in 2 files (checked 102 source files)

Will disable mypy check on stable version.

@vfdev-5 vfdev-5 merged commit 72ab1d0 into master Nov 16, 2022
@vfdev-5
Copy link
Collaborator Author

vfdev-5 commented Nov 16, 2022

@sadra-barikbin I merged the PR to fix the CI. If you have any comment here, let's address them in a follow-up PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs module: contrib Contrib module module: handlers Core Handlers module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use LRScheduler instead of _LRScheduler
1 participant