Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed torch LRScheduler issue and fixed CI #2780

Merged
merged 4 commits into from
Nov 16, 2022
Merged

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