-
Notifications
You must be signed in to change notification settings - Fork 25.4k
Fix bug visualizing 1D Tensor using rich #152871
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/152871
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New FailureAs of commit 1630ad1 with merge base a769114 ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
@pytorchbot label "release notes: distributed (dtensor)" |
dtensor_height = shape[0] if len(shape) > 0 else 1 | ||
dtensor_width = shape[1] if len(shape) > 0 else shape[0] | ||
dtensor_height = shape[0] | ||
dtensor_width = shape[1] if len(shape) == 2 else 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I am fixing a bug that I created in the previous PR. When the tensor is 1D, consider it a column vector.
) | ||
for device_index, (shape, offset) in device_shard_shape_and_offsets.items() | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I am fixing another bug. When the tensor is 1D, the shape and offset of each shard is a 1-tuple. As we want to draw them in the 2D screen space, we need to extend each 1-tuple into a 2-tuple. In particular, expand the width of shard to 1, and extend the offset on the x-axis of the screen to be 0.
""" | ||
To run the example, use the following command: | ||
torchrun --standalone --nnodes=1 --nproc-per-node=4 visualize_sharding_example.py | ||
TERM=xterm-256color torchrun --nproc-per-node=4 visualize_sharding_example.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The environment variable XTERM controls the terminal's coloring capability. Change the default value to xterm-256color
to release the power of your terminal app.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the fix!
@pytorchbot merge -f "inductor lint error not related to the PR" |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
follow up : #152027 |
Fixes #152848
I didn't fix the bug earlier because the example script didn't exhaustively present all combinations of 1D/2D tensor, 1D/2D mesh, and all possible sharding specs. Therefore, in this PR, I enriched the example script to cover all possible combinations.
cc @H-Huang @awgu @wanchaol @fegin @fduwjj @wz337 @wconstab @d4l3k