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

Initial support for Pipeline Parallelism #279

Merged
merged 87 commits into from
Jan 23, 2024
Merged

Initial support for Pipeline Parallelism #279

merged 87 commits into from
Jan 23, 2024

Conversation

michaelbenayoun
Copy link
Member

@michaelbenayoun michaelbenayoun commented Oct 30, 2023

This PR adds support for Pipeline Parallelism on a single node for the Llama architecture.
Multi-node training and other possible relevant architectures will be added in later PRs.

Training

PP works

  • Model can be parallelized
  • Lazy loading works perfectly with PP
  • The optimizer is created properly
  • The optimizer step works properly
  • The logging of the loss works
  • Model can train
  • Evaluation works

Variants

Only tested via tests here (it will be tested more in the PR for multi-node training).

  • TP + PP works
  • DP + PP works (without ZeRO-1)
  • DP + PP works (with ZeRO-1)

Checkpointing

  • Can save sharded checkpoints
  • Can resume from sharded checkpoint
  • Update the consolidation function / command ?

Tests

  • Tests in tests/distributed/test_model_parallelization.py
  • Tests in tests/test_examples.py
  • New extensive test suite tests/distributed/test_common.py

Other

  • The cache system can download and upload compilation files from a training with PP
  • Update the examples

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

Copy link
Collaborator

@dacorvo dacorvo left a comment

Choose a reason for hiding this comment

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

Just a few nits. LGTM, thanks !

tests/conftest.py Outdated Show resolved Hide resolved
optimum/neuron/accelerate/accelerator.py Outdated Show resolved Hide resolved
optimum/neuron/distributed/utils.py Outdated Show resolved Hide resolved
optimum/neuron/utils/cache_utils.py Show resolved Hide resolved
Copy link
Collaborator

@JingyaHuang JingyaHuang left a comment

Choose a reason for hiding this comment

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

🔥 Awesome work for enabling PP, and improving training tests!! Just left some small nits.

@@ -177,6 +195,15 @@ def main():
else:
model_args, data_args, training_args = parser.parse_args_into_dataclasses()

if model_args.use_auth_token is not None:
warnings.warn(
"The `use_auth_token` argument is deprecated and will be removed in v4.34. Please use `token` instead.",
Copy link
Collaborator

Choose a reason for hiding this comment

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

which package? transformers?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. But I'm not in favor of adding that. These files are updated automatically by cloning the examples from Transformers. This is a bad side effect but I think that's ok.

optimum/neuron/accelerate/accelerator.py Outdated Show resolved Hide resolved
optimum/neuron/accelerate/accelerator.py Outdated Show resolved Hide resolved
optimum/neuron/accelerate/accelerator.py Show resolved Hide resolved
optimum/neuron/distributed/decoder_models.py Outdated Show resolved Hide resolved
optimum/neuron/distributed/decoder_models.py Outdated Show resolved Hide resolved
optimum/neuron/distributed/decoder_models.py Outdated Show resolved Hide resolved
optimum/neuron/training_args.py Outdated Show resolved Hide resolved
tests/distributed/test_model_parallelization.py Outdated Show resolved Hide resolved
@michaelbenayoun
Copy link
Member Author

I addressed the comments. @dacorvo @JingyaHuang wdyt?

Copy link
Collaborator

@dacorvo dacorvo 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 !

Copy link
Collaborator

@JingyaHuang JingyaHuang left a comment

Choose a reason for hiding this comment

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

LGTM! Let's get it merged!

@michaelbenayoun michaelbenayoun merged commit ca6c4ff into main Jan 23, 2024
8 checks passed
@michaelbenayoun michaelbenayoun deleted the initial_pp branch January 23, 2024 16:05
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.

4 participants