Skip to content

fix model parallel encoder to be properly sharded params #1794

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sudhakarsingh27
Copy link
Collaborator

Description

Model parallel encoder example didn't shard params properly especially after #1772 changes which switches from direct mesh mapping of params (flax.linen.partitioning.param_with_axes) to logical mesh mapping of params (flax.linen.partitioning.with_logical_partitioning).

Also, even originally, the example didn't check after partitioning logic, whether the params are actually sharded on the devices. MaxText has way to test this so taking motivation from this API to verify sharding for the params in this example.

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refactoring

Changes

Please list the changes introduced in this PR:

  1. Modify the example to properly shard the params
  2. Add verification to check if params are sharded as intended

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@jberchtold-nvidia
Copy link
Collaborator

/te-ci L0

Copy link
Collaborator

@jberchtold-nvidia jberchtold-nvidia left a comment

Choose a reason for hiding this comment

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

LGTM

@sudhakarsingh27
Copy link
Collaborator Author

/te-ci L0

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.

2 participants