KEMBAR78
fixed pyi file for ReduceLROnPlateau by randolf-scholz · Pull Request #113659 · pytorch/pytorch · GitHub
Skip to content

Conversation

@randolf-scholz
Copy link
Contributor

@randolf-scholz randolf-scholz commented Nov 14, 2023

Fixes #63143

Issue reappeared due to subclassing not present in stub file.

cc @ezyang @malfet @xuzhao9 @gramster

@pytorch-bot
Copy link

pytorch-bot bot commented Nov 14, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/113659

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 4cfb2d4 with merge base 9b0f2f8 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@randolf-scholz
Copy link
Contributor Author

@pytorchbot label "module: typing"

@pytorch-bot pytorch-bot bot added the module: typing Related to mypy type annotations label Nov 14, 2023
@malfet malfet added the topic: bug fixes topic category label Nov 14, 2023
@kit1980
Copy link
Contributor

kit1980 commented Nov 14, 2023

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Nov 14, 2023
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: 1 mandatory check(s) failed. The first few are:

Dig deeper by viewing the failures on hud

Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

@kit1980
Copy link
Contributor

kit1980 commented Nov 14, 2023

Looks like this fix triggers

Error: Signature of "step" incompatible with supertype "LRScheduler"

@randolf-scholz
Copy link
Contributor Author

It seems that a bunch of the LRScheduler subclasses simply violate LSP.

  • Base class: def step(self, epoch=None)
  • SequentialLR: def step(self) (missing epoch argument!)
  • ChainedScheduler: def step(self) (missing epoch argument!)
  • ReduceLROnPlateau: def step(self, metrics, epoch=None) extra mandatory metrics argument.

For SequentialLR and ChainedScheduler, it would make sense to simply pass the epoch argument through. (better open a separate issue?)

For ReduceLROnPlateau, I'd suggest adding a type: ignore[override], I don't really see a better solution right now.

@randolf-scholz
Copy link
Contributor Author

randolf-scholz commented Nov 14, 2023

Alternatively, one could set a default value like metrics=float('nan').

@janeyx99 janeyx99 changed the title fixed pyi file fixed pyi file for ReduceLROnPlateau Nov 14, 2023
@ezyang
Copy link
Contributor

ezyang commented Nov 14, 2023

type: ignore as necessary, IMO

@janeyx99
Copy link
Contributor

Agreed with Ed for ReduceLROnPlateau, and yes for propagating epoch for the others.

@albanD albanD removed their request for review November 14, 2023 21:36
@randolf-scholz
Copy link
Contributor Author

I added the type-ignore here and a put some educated guesses on how to pass epoch into a second pull request: #113675

@janeyx99
Copy link
Contributor

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged module: typing Related to mypy type annotations open source release notes: optim topic: bug fixes topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ReduceLROnPlateau is not a subclass of _LRScheduler

8 participants