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

Change comparison in partitions to include equals #587

Merged
merged 4 commits into from
Feb 12, 2024

Conversation

JAEarly
Copy link
Contributor

@JAEarly JAEarly commented Feb 1, 2024

Description of changes:

A warning is raised during partitioning when the number of canonical nodes is equal to the number of samples. It is my understanding that this should be valid (one sample per node), and that issues only occur when the number of samples is less than the number of canonical nodes. Apologies if my understanding is incorrect here.

The simple fix is to the change the comparison to be >= rather than >

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.

@JAEarly
Copy link
Contributor Author

JAEarly commented Feb 1, 2024

I didn't realise this would break the tests (I made the change in the browser). If this change makes sense I'll happily go and alter the tests as appropriate.

@JAEarly
Copy link
Contributor Author

JAEarly commented Feb 7, 2024

I've now updated the code such that the tests pass but the warning is not raised for the edge case: num_canonical_nodes == num_samples and num_canonical_nodes > num_physical_nodes.

Copy link
Collaborator

@snarayan21 snarayan21 left a comment

Choose a reason for hiding this comment

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

Hey! Apologies for getting to this late, but just a small change and should be good to go. Great catch!

streaming/base/partition/orig.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@snarayan21 snarayan21 left a comment

Choose a reason for hiding this comment

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

lgtm!

@snarayan21 snarayan21 merged commit 6327af1 into mosaicml:main Feb 12, 2024
6 checks passed
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