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

Avoid unnecessarily accessing data loader with pipeline parallelism #6164

Merged
merged 1 commit into from
Mar 22, 2023

Conversation

timmoon10
Copy link
Collaborator

What does this PR do ?

I've been experiencing a hang in the first validation step when running GPT with interleaved pipeline parallelism. This first shows up in #6049, so it seems that accessing the data loader in middle pipeline stages is the root cause.

Collection: NLP

Changelog

  • Avoid unnecessarily accessing data loader with pipeline parallelism

Usage

No change in usage

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

@timmoon10 timmoon10 added bug Something isn't working NLP labels Mar 9, 2023
for k in batch.keys():
batch[k] = batch[k].cuda(non_blocking=True) if k in ['attention_mask'] else None
# Intermediate pipeline stage doesn't need any inputs
batch = {k: None for k in ['tokens', 'position_ids', 'attention_mask', 'labels']}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm uncertain how to handle this case. If we want to keep the same behavior, we need to access the data loader in the case self.get_attention_mask_from_fusion==False so that we can access attention_mask. But that will cause a hang. Do we just require self.get_attention_mask_from_fusion==True to support interleaved pipeline parallelism?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm fine with this. Can you also default get_attention_mask_from_fusion to True in the megatron gpt config and the model?

Copy link
Member

@okuchaiev okuchaiev left a comment

Choose a reason for hiding this comment

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

can you please send it to r1.17.0

@timmoon10 timmoon10 changed the base branch from main to r1.17.0 March 21, 2023 23:01
@timmoon10 timmoon10 force-pushed the interleaved-pipeline-bugfix branch 2 times, most recently from 9a012b5 to ab9aaca Compare March 21, 2023 23:07
Copy link
Collaborator

@ericharper ericharper left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@ericharper ericharper merged commit 79b0e83 into NVIDIA:r1.17.0 Mar 22, 2023
ericharper pushed a commit that referenced this pull request Mar 22, 2023
hsiehjackson pushed a commit to hsiehjackson/NeMo that referenced this pull request Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working NLP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants