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

Enable correct resumption from the end of an epoch #700

Merged
merged 11 commits into from
Jun 18, 2024

Conversation

snarayan21
Copy link
Collaborator

@snarayan21 snarayan21 commented Jun 13, 2024

Description of changes:

This PR enables correct resumption from the end of an epoch. For example, suppose the dataset has 512 samples and I want to resume from sample 512. The intended behavior should be to detect that we are at the end of the epoch and start a new one. There were two small bugs preventing this from happening correctly:

  1. The partition algorithms (orig and relaxed) both threw an error when num_samples <= drop_first instead of num_samples < drop_first. This means that if we wanted to create a sample partition of 512 samples but drop the first 512 samples, we would throw an error. This is not the right behavior -- we should return an empty sample partition instead.
  2. Writing an empty sample partition array to shared memory was not possible since we did not consider that edge case. This has been addressed.

Manual run that had earlier failed, succeeding with these changes: resumption-issue-testing-RnnDR4

Unit tests have been added for these cases.

Issue #, if available:

Merge Checklist:

Put an x without space in the boxes that apply. If you are unsure about any checklist, please don't hesitate to ask. We are here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

  • I have read the contributor guidelines
  • This is a documentation change or typo fix. If so, skip the rest of this checklist.
  • I certify that the changes I am introducing will be backward compatible, and I have discussed concerns about this, if any, with the MosaicML team.
  • I have updated any necessary documentation, including README and API docs (if appropriate).

Tests

  • I ran pre-commit on my change. (check out the pre-commit section of prerequisites)
  • I have added tests that prove my fix is effective or that my feature works (if appropriate).
  • I ran the tests locally to make sure it pass. (check out testing)
  • I have added unit and/or integration tests as appropriate to ensure backward compatibility of the changes.

streaming/base/dataset.py Outdated Show resolved Hide resolved
streaming/base/partition/relaxed.py Outdated Show resolved Hide resolved
streaming/base/partition/relaxed.py Outdated Show resolved Hide resolved
snarayan21 and others added 3 commits June 17, 2024 17:22
Co-authored-by: Mihir Patel <mihir.v.patel7@gmail.com>
Co-authored-by: Mihir Patel <mihir.v.patel7@gmail.com>
@snarayan21 snarayan21 merged commit a5b9eea into main Jun 18, 2024
8 checks passed
@snarayan21 snarayan21 deleted the saaketh/resumption_bugs branch June 18, 2024 00:41
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.

None yet

2 participants