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

Refactor PP conversion + add support for TP only conversion #6419

Merged
merged 1 commit into from
Apr 14, 2023

Conversation

titu1994
Copy link
Collaborator

What does this PR do ?

Updates the TP PP conversion script to support TP only conversion (back ported from NeMo 1.16)
Refactor PP conversion mechanism.

Collection: [NLP]

Changelog

  • Refactor components to functions, split apart TP and PP conversion components
  • Refactor PP conversion to model specific classes for PP conversion support
  • Backport TP only conversion support (irrespective of whether PP conversion is supported or not)

Usage

python megatron_change_num_partitions.py \
    --model_file="ckpt/megatron_gpt_model.nemo" \
    --target_file="ckpt/megatron_gpt_model_tp2_pp1.nemo" \
    --tensor_model_parallel_size=1 \
    --target_tensor_model_parallel_size=2 \
    --pipeline_model_parallel_size=1 \
    --target_pipeline_model_parallel_size=1 \
    --tp_conversion_only

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

@github-actions github-actions bot added the NLP label Apr 13, 2023
return offset_diff


class T5Handler:
Copy link
Collaborator

Choose a reason for hiding this comment

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

with this handler way of doing things, how do we handle other models? like say BERT? do we add a handler for each model?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep, we'll need a handler for each model. Every minor change in the model's arch can shift around too many layers or require duplication which complicates Pipeline parallelism merging.

Copy link
Collaborator

@aklife97 aklife97 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

@titu1994 titu1994 merged commit 8055411 into NVIDIA:main Apr 14, 2023
@titu1994 titu1994 deleted the refactor_converter branch April 14, 2023 01:29
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants