pytorch / tutorials

PyTorch tutorials.
https://pytorch.org/tutorials/
BSD 3-Clause "New" or "Revised" License
8.13k stars 4.04k forks source link

Patched docs for torch_compile_tutorial #2936

Closed ignaciobartol closed 1 month ago

ignaciobartol commented 3 months ago

Fixes #2858

Description

Based on the discussion on #2858 I added a few examples on how to use torch.compile in nested modules and functions. Also, I added a few lines for "Best practices" to debug if there is a compilation problem and also how to disable a function from being compiled (along with its children functions) using torch.compiler.disable.

Let me know if anything can be improved in the tutorial and I will work on it. As a side note, from this issue in pytorch, I am not sure if torch.compiler.disable is working properly, but I used as specified as in the docs here

Checklist

cc @williamwen42 @msaroufim @sekyondaMeta @svekars @kit1980 @brycebortree

pytorch-bot[bot] commented 3 months ago

:link: Helpful Links

:test_tube: See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/2936

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

:white_check_mark: No Failures

As of commit f36b152c962af364c08b341463a893651d4c738c with merge base e07d43bb7b9b3e84c5682eb5b0cb8c07e2d35051 (image): :green_heart: Looks good so far! There are no failures yet. :green_heart:

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

ignaciobartol commented 3 months ago

I think this doc update would be better placed in the troubleshooting tutorial (@mlazos is working on this and will have an update soon).

Thanks @williamwen42 for the review and the great feedback! I will work on them. Once I have an update on which doc to contribute I will create a new commit.

ignaciobartol commented 3 months ago

@pytorchbot rebase

pytorch-bot[bot] commented 3 months ago

You don't have permissions to rebase this PR since you are a first time contributor. If you think this is a mistake, please contact PyTorch Dev Infra.

mlazos commented 3 months ago

Thanks @ignaciobartol, this looks like a good tutorial! I think we should add a section called "Best Practices for Onboarding a New Model" to https://pytorch.org/docs/stable/torch.compiler_troubleshooting.html and add your best practices section to that. You can also link to it from your tutorial as well. The rest of the troubleshooting doc is a bit outdated and I'll be revamping that next week.

ignaciobartol commented 3 months ago

Content looks good, but can you fix any formatting issues that you see in the doc preview?

Also waiting for response from @mlazos to see where this change should go

Thanks! I am not sure what I am seeing in my build of the docs differs from what is on the preview (See screenshot below). Any ideas of why this may be happening?

torch_compile_build
svekars commented 3 months ago

From publishing perspective the PR looks good to me. @mlazos - did you mean that this should be moved to torch.compiler troubleshooting instead of being here?

ignaciobartol commented 3 months ago

From publishing perspective the PR looks good to me. @mlazos - did you mean that this should be moved to torch.compiler troubleshooting instead of being here?

Thanks @svekars for fixing the formatting errors. Once we have more information about this I can ago ahead and apply those changes

mlazos commented 1 month ago

From publishing perspective the PR looks good to me. @mlazos - did you mean that this should be moved to torch.compiler troubleshooting instead of being here?

Correct, it was just a suggestion, I'm okay either way.