-
Notifications
You must be signed in to change notification settings - Fork 24.9k
[dynamo][pytree][1/N] make CXX pytree traceable: tree_iter
/ tree_leaves
#137397
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/137397
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (4 Unrelated Failures)As of commit af679d5 with merge base 9012e7a ( FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
UNSTABLE - The following jobs failed but were likely due to flakiness present on trunk and has been marked as unstable:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
…leaves` ghstack-source-id: 5008858 Pull Request resolved: pytorch#137397
…leaves` ghstack-source-id: 5008858 Pull Request resolved: pytorch#137397
…leaves` ghstack-source-id: 5008858 Pull Request resolved: pytorch#137397
…leaves` ghstack-source-id: 5008858 Pull Request resolved: pytorch#137397
…leaves` ghstack-source-id: aa736c9 Pull Request resolved: pytorch#137397
…leaves` ghstack-source-id: aa736c9 Pull Request resolved: pytorch#137397
…leaves` ghstack-source-id: aa736c9 Pull Request resolved: pytorch#137397
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.
Could we use the python version of pytree that already exists rather than having a new implementation in polyfils?
…leaves` ghstack-source-id: aa736c9 Pull Request resolved: pytorch#137397
@jansel We can do this for functions that do not return the generator = tree_iter(tree)
leaves = tree_leaves(tree)
newtree = tree_map(func, tree)
tree_map_(func, tree) I'd implement new polyfills to ensure behavior consistency between polyfill and C++ for the following functions that return/access the leaves, treespec = tree_flatten(tree)
treespec = tree_structure(tree)
tree = tree_unflatten(leaves, treespec) In most cases, the new polyfill is identical to the already existing Python pytree. For historical reasons, the Python pytree has existed for years and I think splitting the implement makes polyfill maintenance easier. cc @zou3519 for thoughts. |
@pytorchmergebot revert -c ghfirst -m "Failing internal test" |
@pytorchbot successfully started a revert job. Check the current status here. |
@XuehaiPan your PR has been successfully reverted. |
…/ `tree_leaves` (#137397)" This reverts commit 07850bb. Reverted #137397 on behalf of https://github.com/atalman due to Failing internal test ([comment](#137397 (comment)))
HI @XuehaiPan looks like its failing on: https://github.com/pytorch/pytorch/blob/main/test/dynamo/test_trace_rules.py#L328 |
…leaves` ghstack-source-id: a4960fe Pull Request resolved: pytorch#137397
Updated. |
…leaves` ghstack-source-id: 4c6f47b Pull Request resolved: pytorch#137397
…leaves` ghstack-source-id: 8c07273 Pull Request resolved: pytorch#137397
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…leaves` (pytorch#137397) Pull Request resolved: pytorch#137397 Approved by: https://github.com/jansel ghstack dependencies: pytorch#141360
…/ `tree_leaves` (pytorch#137397)" This reverts commit 07850bb. Reverted pytorch#137397 on behalf of https://github.com/atalman due to Failing internal test ([comment](pytorch#137397 (comment)))
…leaves` (pytorch#137397) Pull Request resolved: pytorch#137397 Approved by: https://github.com/jansel
I am seeing error in latest trunk, likely due to this PR. Is it possible to take a 2nd look if this breaks the trunk? error about
how to repro:
full error
|
Stack from ghstack (oldest at bottom):
torch.utils.pytree
by default #138056torch.func
#137884torch.utils.pytree
#137400tree_map
/tree_map_
#137399dict
keys in insertion order in CXX pytree #130140tree_flatten
/tree_unflatten
/tree_structure
#137398tree_iter
/tree_leaves
#137397cc @zou3519 @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @chauhang @amjames @rec