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

Is it possible to get save_state to save step as well? #2702

Closed
tshmak opened this issue Apr 24, 2024 · 5 comments · Fixed by #2765
Closed

Is it possible to get save_state to save step as well? #2702

tshmak opened this issue Apr 24, 2024 · 5 comments · Fixed by #2765
Labels
feature request Request for a new feature to be added to Accelerate

Comments

@tshmak
Copy link

tshmak commented Apr 24, 2024

Is it possible to get save_state to save accelerator.step as well? Or is there another way to save and load the current iteration/step?

@muellerzr muellerzr added the feature request Request for a new feature to be added to Accelerate label Apr 24, 2024
@muellerzr
Copy link
Collaborator

Sure, that seems reasonable certainly :) Would you like to make a PR doing so? If not let me know and I can look into that this week!

@tshmak
Copy link
Author

tshmak commented Apr 25, 2024

I'm not confident in doing it myself. Thanks for looking into it!

@bipinKrishnan
Copy link
Contributor

Hey @muellerzr , are you planning to work on this? If not, may be I could take a look into this if you could provide some context into the feature :)

@muellerzr
Copy link
Collaborator

Hey @bipinKrishnan! Sure. The saving logic resides in src/accelerate/checkpointing.py. We would essentially need to add the step in IMO part of the states file for now. (As it definitely is part of RNG related resuming).

On restoring it should just set Accelerator.step.

This will likely need some modifications to get step working (such as having load_accelerator_state return the items we want to override in the Accelerator itself as a dict perhaps) and then loading that part in after the call to load_accelerator_state during Accelerator.load_state

@bipinKrishnan
Copy link
Contributor

Hi @muellerzr , just a quick reminder on the PR created to close this issue. Let me know if any further changes are needed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request for a new feature to be added to Accelerate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants