8000 fix non-strict placeholder naming with kwargs by avikchaudhuri · Pull Request #144278 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

fix non-strict placeholder naming with kwargs #144278

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

Closed

Conversation

avikchaudhuri
Copy link
Contributor
@avikchaudhuri avikchaudhuri commented Jan 6, 2025

Stack from ghstack (oldest at bottom):

Fixes #143732

Differential Revision: D67872055

Copy link
pytorch-bot bot commented Jan 6, 2025

🔗 Helpful Links

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

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

❌ 2 New Failures, 1 Unrelated Failure

As of commit ac4e4e1 with merge base f6488d8 (image):

NEW FAILURES - The following jobs have failed:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

avikchaudhuri added a commit that referenced this pull request Jan 6, 2025
Fixes #143732

Differential Revision: [D67872055](https://our.internmc.facebook.com/intern/diff/D67872055/)

ghstack-source-id: 260395123
Pull Request resolved: #144278
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D67872055

@@ -821,6 +821,14 @@ def _extract_pytree_key(x):

# map user input names with mod.forward() signature
combined_args = _bind_signature_to_inputs(mod, fake_args, fake_kwargs)
# reorder following args, kwargs
combined_args = {
name: combined_args[name]
Copy link
Contributor

Choose a reason for hiding this comment

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

just curious why the order in the dictionary matters? If the order matters, maybe we should make it an ordered dict to be explicit?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Use itertools.chain. No need for this weird list unpacking

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Turns out that the graph signature has user inputs in the order they were received, but combined args orders them in the order of the original forward signature. The actual ordering doesn't matter so much as that they should be consistent, because we zip them soon afterwards.

Copy link
Contributor Author
@avikchaudhuri avikchaudhuri Jan 6, 2025

Choose a reason for hiding this comment

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

@yushangdi I ended up changing the implementation a bit because it was not accounting for variadic kwargs. Latest update matches what happens in strict.

Given a module signature: def forward(a, b, c, **kwargs): ...
and example inputs as args: a_val, kwargs: {c=c_val, b=b_val, d=d_val}

we should now get placeholder names a, c, b, d. So overall preserving call site order instead of def site order.

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D67872055

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D67872055

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D67872055

avikchaudhuri added a commit that referenced this pull request Jan 6, 2025
Pull Request resolved: #144278

Fixes #143732
ghstack-source-id: 260419919
@exported-using-ghexport

Differential Revision: [D67872055](https://our.internmc.facebook.com/intern/diff/D67872055/)
Copy link
Contributor
@yushangdi yushangdi left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jan 7, 2025
Copy link
Contributor
@pianpwk pianpwk left a comment

Choose a reason for hiding this comment

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

looks great!

@facebook-github-bot
Copy link
Contributor

@pytorchbot merge

(Initiating merge automatically since Phabricator Diff has merged)

@pytorchmergebot
Copy link
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Collaborator

@avikchaudhuri
Copy link
Contributor Author

@pytorchbot merge -f "bogus CI failures"

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use -f as last resort and instead consider -i/--ignore-current to continue the merge ignoring current failures. This will allow currently pending tests to finish and report signal before the merge.

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@github-actions github-actions bot deleted the gh/avikchaudhuri/44/head branch February 9, 2025 02:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0