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

Add checkpointing support #9

Merged
merged 2 commits into from
Mar 4, 2024
Merged

Add checkpointing support #9

merged 2 commits into from
Mar 4, 2024

Conversation

bernardhan33
Copy link
Collaborator

Add checkpointing support for the Dataflux Dataset.

From investigation it seems that we can confidently use blob.open() to create a file handler.

  • blob.open("rb") will return a BlobReader.
  • blob.open("wb", ignore_flush=True) will return a BlobWriter.

Both types implement io.BufferedIOBase so can be passed into torch.save() and torch.load() like demonstrated in the README.

TODO: I haven't added unit tests to this yet -- I thought about writing mocks but decided to go with fakes. I wanted to share this PR first before making changes to fake_gcs so it would make more sense there. Will follow up on this next.

  • Tests pass -- tested by running the demo code directly and verified it works.
  • Appropriate changes to documentation are included in the PR -- updated the README.

@bernardhan33 bernardhan33 self-assigned this Mar 4, 2024
README.md Outdated Show resolved Hide resolved
dataflux_pytorch/dataflux_checkpoint.py Outdated Show resolved Hide resolved
dataflux_pytorch/dataflux_checkpoint.py Outdated Show resolved Hide resolved
dataflux_pytorch/dataflux_checkpoint.py Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
dataflux_pytorch/dataflux_checkpoint.py Outdated Show resolved Hide resolved
@bernardhan33 bernardhan33 merged commit 3e676d4 into main Mar 4, 2024
1 check passed
@bernardhan33 bernardhan33 deleted the bernardhan-checkpoint branch March 4, 2024 21:52
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.

2 participants