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

[Bug] OneCycleLR object has no attribute 'end',(use before super().__init__()) #1401

Closed
2 tasks done
whlook opened this issue Oct 25, 2023 · 2 comments
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@whlook
Copy link
Contributor

whlook commented Oct 25, 2023

Prerequisite

Environment

obvious code bug
bug code:

self.total_steps = self.end - self.begin

Reproduces the problem - code sample

learning policy

param_scheduler = [
dict(
type="OneCycleLR",
eta_max=2e-4,
pct_start=0.3,
div_factor=50,
final_div_factor=1e3,
)
]

Reproduces the problem - command or script

None

Reproduces the problem - error message

AttributeError: 'OneCycleLR' object has no attribute 'end'

Additional information

Param end supports default value, but in OneCycleLR's init, it use self.end before doing super().init() // self.end was defined in Base class.

suggestion:

  1. do super.init at the beginning. Or
  2. Use end - start but not self.end - self.start
@whlook whlook added the bug Something isn't working label Oct 25, 2023
@zhouzaida
Copy link
Member

Hi @whlook, thanks for your report and your modification suggestions. I prefer the second suggestion.
Are you interested in making a PR to fix this issue?

@whlook
Copy link
Contributor Author

whlook commented Oct 27, 2023

Hi @whlook, thanks for your report and your modification suggestions. I prefer the second suggestion. Are you interested in making a PR to fix this issue?

I will make a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants