Initialize ACEnv.supermoves to fix the checkpoint-save crash - #7
Open
hmirin wants to merge 1 commit into
Open
Conversation
training.py reads envs.envs[0].supermoves when saving a checkpoint (every 100 updates), but ACEnv.__init__ stopped setting the attribute when the supermoves implementation was removed in 89b44fa, so any run reaching update 100 crashed with an AttributeError at the first checkpoint save. Restore the pre-refactor initialization. See shehper#6 for the full analysis and reproduction.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6.
ACEnv.__init__stopped initializingself.supermoveswhen the supermoves implementation was removed from the environment in 89b44fa, while the checkpoint-saving code intraining.pystill readsenvs.envs[0].supermoves— so any run reaching update 100 crashes with anAttributeErrorat the first checkpoint save. See #6 for the full analysis and a minimal reproduction.This restores the pre-refactor
self.supermoves = Noneinitialization. Since the attribute is not read anywhere instep/reset, it only affects checkpoint metadata, not training dynamics.Verified on this branch, per
Contributions.md:pytest: 112 passedblack --checkon the changed file: unchangedpython ac_solver/agents/ppo.py --num-envs 4 --num-steps 25 --total-timesteps 10000) now completes with exit code 0 and writesckpt.pt; a longer run (--num-envs 64, otherwise default settings) passed update 100, saved its checkpoint, and kept training normally past update 112Happy to also add a fast checkpoint-path smoke test to
tests/if you'd like it in this PR.