Skip to content

Conversation

@artemru
Copy link
Contributor

@artemru artemru commented May 12, 2025

What does this PR do? Please describe:
A summary of the change or the issue that is fixed.

Fixes #{issue number}

Does your PR introduce any breaking changes? If yes, please list them:
List of all backwards-incompatible changes.

Check list:

  • Was the content of this PR discussed and approved via a GitHub issue? (no need for typos or documentation improvements)
  • Did you read the contributor guideline?
  • Did you make sure that your PR does only one thing instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests?
  • Did you verify new and existing tests pass locally with your changes?
  • Did you update the CHANGELOG? (no need for typos, documentation, or minor internal changes)

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 12, 2025
Copy link
Contributor

@mattsetz mattsetz left a comment

Choose a reason for hiding this comment

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

looking good! i left some questions about the distributed processing, but mostly for clearing up my own understanding.

next_name = self._next_dataset_name()
try:
batch = next(self._pipeline_iters[next_name])
except StopIteration:
Copy link
Contributor

Choose a reason for hiding this comment

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

when would we expect this to occur? when the pipeline has epoched through all data?

Comment on lines +297 to +300
# If we read less than `num_accumulate` batches, it means we reached end
# of data.
if self._options.drop_remainder and len(batches) != num_accumulate:
batches.clear()
Copy link
Contributor

Choose a reason for hiding this comment

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

hm. a bit confused here. some clarifying questions:

  1. when would this condition be True? isn't that case handled by the above exception handling?

  2. dumb Q: what does batches.clear() do? (just empty the batch List?)

  3. at a conceptual level, seems like this logic is used to determine if we should halt training once we reach end of data (or when any of the pipelines reaches end of data), if self._options.drop_remainder is set to True (and if False, we just continue epoching the data). is this understanding correct?

num_batches = _min_num_batches(local_num_batches, self._gang)

if num_batches != local_num_batches:
batches = batches[:num_batches]
Copy link
Contributor

Choose a reason for hiding this comment

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

does this imply that batches is a global list of batches across all ranks? i thought this was a local list...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the general fs2 logic to work with pipelines epoch's end : for some rank the data will be returned but others should skip their turn.
Probably for that scheduled mixture we dont need that since we're dealing with infinite loop here.


def _next_dataset_name(self) -> str:
weights = np.array(
[scheduler(self._step) for scheduler in self._weights_schedulers.values()],
Copy link
Contributor

Choose a reason for hiding this comment

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

i like the setup of making this callable. instead of having schedulers for each data pipeline, we could have one master scheduler function that rights the list of weights. but either works, i suppose this option you've implemented here gives us more flexibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants