-
-
Notifications
You must be signed in to change notification settings - Fork 657
solves AttributeError: 'State' object has no attribute 'rng_states' #2412
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
solves AttributeError: 'State' object has no attribute 'rng_states' #2412
Conversation
|
@bibhabasumohapatra please add a test for state_dict method |
| def state_dict(self) -> OrderedDict: | ||
| setattr(self.state, "rng_states", _get_rng_states()) | ||
| state_dict = super(DeterministicEngine, self).state_dict() | ||
| state_dict["rng_states"] = _get_rng_states() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep this, instead of setattr(self.state, "rng_states", _get_rng_states())
EDIT:
Main point here is that engine.state.rng_states does not (and is not intended to) reflect rng states at each moment as rng states are dynamically changing. Thus we kept engine.state.rng_states is None once provided rng state was applied in _setup_engine method. If we leave engine.state.rng_states with a certain value then it wont reflect the latest state and thus provides some wrong info. => I propose to keep engine.state.rng_states as None and do not compare with sd["rng_states"].
vfdev-5
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank for the PR @bibhabasumohapatra !
Fixes #2197
Description:
returns:
AttributeError: 'State' object has no attribute 'rng_states'
Check list: