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

Make sampler length independent from consumed samples. #8576

Closed
wants to merge 2 commits into from

Conversation

jstjohn
Copy link
Collaborator

@jstjohn jstjohn commented Mar 4, 2024

When resuming a training job, the pytorch lightning trainer seems to use the data loader to determine the number of total steps left in the epoch. When you kill/resume a training job partway through, the data sampler length will be reduced by consumed_samples in the current implementation, while the current step of the trainer will be restored. This results in a double impact to the number of remaining samples, and we can get into a situation where the trainer crashes out when the current_step is greater than the length of the dataloader. Leaving the length unchanged seems to fix this issue, and since it is an iterator, the stop_iteration (based on consumed_samples) does what it is supposed to do.

What does this PR do ?

Leave len(sampler) as is, not making it a function of consumed_samples. Default behavior of pytorch lightning trainer resumption seems to behave better with this configuration.

Collection: all

Changelog

  • Add specific line by line info of high level changes in this PR.

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this 

Jenkins CI

To run Jenkins, a NeMo User with write access must comment jenkins on the PR.

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
    • Reviewer: Does the PR have correct import guards for all optional libraries?

PR Type:

  • New Feature
  • Bugfix
  • Documentation

If you haven't finished some of the above items you can still open "Draft" PR.

Who can review?

Anyone in the community is free to review the PR once the checks have passed.
Contributor guidelines contains specific people who can review PRs to various areas.

Additional Information

  • Related to # (issue)

…when resuming

Signed-off-by: John St John <jstjohn@nvidia.com>
@github-actions github-actions bot added the NLP label Mar 4, 2024
Copy link
Contributor

This PR is stale because it has been open for 14 days with no activity. Remove stale label or comment or update or this will be closed in 7 days.

@github-actions github-actions bot added the stale label Mar 19, 2024
Copy link
Contributor

This PR was closed because it has been inactive for 7 days since being marked as stale.

@github-actions github-actions bot closed this Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant