Skip to content

[Distributed] Add a shard helper for creating DTensors #1271

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

Merged
merged 6 commits into from
Oct 7, 2024
Merged

Conversation

kwen2501
Copy link
Contributor

@kwen2501 kwen2501 commented Oct 4, 2024

Adding the same shard function as used in torchao's TP example:
pytorch/ao#937

Tried upstream the helper to pytorch, but the PR is going nowhere.
So hosting here for now.

Copy link

pytorch-bot bot commented Oct 4, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchchat/1271

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit d75531b with merge base 766bee9 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 4, 2024
@kwen2501 kwen2501 requested a review from lessw2020 October 4, 2024 23:17

logger.info(f"Device mesh shape: {dtensor.device_mesh.shape}")
logger.info(f"Device mesh devices: {dtensor.device_mesh.device_type}")
def shard(
Copy link
Contributor

Choose a reason for hiding this comment

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

minor nit - having a function called shard when we have the imported Shard is asking for confusion (same name, one letter cap difference).
better name here might be shard_full_tensor?

Copy link
Contributor

@lessw2020 lessw2020 left a comment

Choose a reason for hiding this comment

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

lgtm!
minor nit on potential naming improvement for shard.

@kwen2501 kwen2501 changed the base branch from load_var to main October 7, 2024 23:26
@kwen2501 kwen2501 merged commit 9fb7999 into main Oct 7, 2024
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants