Skip to content

Fix eval compile timing in torch.compile tutorial #2596

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

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

williamwen42
Copy link
Member

Fixes pytorch/pytorch#110666.

Moved placement of torch.no_grad. Added asserts for speedup values so that future regressions are detected sooner.

@williamwen42 williamwen42 requested a review from svekars October 6, 2023 21:00
@pytorch-bot
Copy link

pytorch-bot bot commented Oct 6, 2023

🔗 Helpful Links

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

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

✅ No Failures

As of commit 1e23d37 with merge base d986068 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@malfet malfet self-requested a review October 6, 2023 22:14
@malfet
Copy link
Contributor

malfet commented Oct 8, 2023

Looks like the fix moves torch.nograd outside of torch.compile, which is OK if it's documented somewhere, that this is nto a supported way of using torch.compile (which feels wrong to me, it should just optimize given function, i.e. respect torch.nograd decorator)

@williamwen42
Copy link
Member Author

Let's push the patch for the tutorial for now, we will fix the no_grad issue in the background.

@williamwen42 williamwen42 merged commit c28def9 into main Oct 10, 2023
@svekars svekars deleted the torch-compile-2.1-speedup-fix branch October 26, 2023 15:50
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.

Eval torch compile slower than eager for Torch 2.1.0
3 participants