-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BE] replace the extra DeviceMesh _flatten with mesh access (#666)
Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom): * __->__ #666 **Summary** pytorch/pytorch#138945 fixes DeviceMesh access on flattened mesh which are constructed from more than 2 meshes. Refer to the fix PR for details if interested. In #592 we avoided this issue by calling `_flatten` instead of direct accessing the flattened mesh. We want to turn back to mesh access which is more straightforward since the fix has been merged in PyTorch.
- Loading branch information
Showing
2 changed files
with
54 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
from typing import Optional | ||
|
||
import torch | ||
from torchtitan.logging import logger | ||
|
||
|
||
def check_if_feature_in_pytorch( | ||
feature_name: str, | ||
pull_request: str, | ||
min_nightly_version: Optional[str] = None, | ||
) -> None: | ||
if "git" in torch.__version__: # pytorch is built from source | ||
# notify users to check if the pull request is included in their pytorch | ||
logger.warning( | ||
"detected that the pytorch is built from source. Please make sure the PR " | ||
f"({pull_request_link}) is included in pytorch for correct {feature_name}." | ||
) | ||
elif min_nightly_version is not None and torch.__version__ < min_nightly_version: | ||
logger.warning( | ||
f"detected that the pytorch version {torch.__version__} is older than " | ||
f"{min_nightly_version}. Please upgrade a newer version to include the " | ||
f"change in ({pull_request_link}) for correct {feature_name}." | ||
) |