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

Shift to Single Checkpoint Files #9333

Merged
merged 4 commits into from
Oct 4, 2024
Merged

Shift to Single Checkpoint Files #9333

merged 4 commits into from
Oct 4, 2024

Conversation

rasswanth-s
Copy link
Collaborator

Description

The PR shifts checkpoints to single files, for easy portability.
It also adds the ability to load checkpoints from custom paths

Affected Dependencies

List any dependencies that are required for this change.

How has this been tested?

  • Describe the tests that you ran to verify your changes.
  • Provide instructions so we can reproduce.
  • List any relevant details for your test configuration.

Checklist

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Base automatically changed from shubham/notebooks-with-state to dev October 1, 2024 13:17
checkpoint_path = chkpt_dir / f"{name}.zip"

# get a temporary directory to save the checkpoint
temp_dir = Path(tempfile.mkdtemp())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why change to tempfile?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The migrations, save api, requires a path to save checkpoint.yaml and checkpoint.blob, we save it in a temp directory and create a zipfile from the temp directory.

The alternative would be to save the checkpoint files (checkpoint.yaml, checkpoint.blob) in the same directory of checkpoints directory, and if multiple notebooks are running at same time, it might cause race conditions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yashgorana , here instead of persisting a checkpoint directory, we're trying to create a tmp folder to save the data over there and then zip it and make it available as a .zip file under ~/.syft/data/checkpoints/, so e.g. ~/.syft/data/checkpoints/1-checkpoint.zip.

@rasswanth-s rasswanth-s changed the title [WIP] Shift to Single Checkpoint Files Shift to Single Checkpoint Files Oct 3, 2024
@yashgorana yashgorana merged commit c55b8de into dev Oct 4, 2024
39 checks passed
@yashgorana yashgorana deleted the rasswanth/fix-file-format branch October 4, 2024 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants