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

add device_mesh support for FSDP #3033

Closed
wants to merge 2 commits into from

Conversation

winglian
Copy link
Contributor

What does this PR do?

Adds support for multidimensional parallelism with FSDP.

@muellerzr

Fixes # (issue)

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@@ -28,6 +28,7 @@
from typing import Any, Callable, Dict, Iterable, List, Literal, Optional, Tuple, Union, get_args

import torch
from torch.distributed._tensor import DeviceMesh
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
from torch.distributed._tensor import DeviceMesh
from torch.distributed import DeviceMesh

should also work. We should also check when DeviceMesh was added in torch. I tried to figure this out from the code but it's not quite clear to me, apparently it moved around a bit. Since it's a top level import, it has to be importable for all supported torch versions. Otherwise, we need some kind of guard.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd rather we do from torch.distributed.device_mesh import DeviceMesh.

2.3.0+ has this import, 2.2.0 has it under _device_mesh. Anything lower and we should raise a NotImplementedError.

Copy link

github-actions bot commented Oct 7, 2024

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

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