Skip to content
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

A recipe for showcasing torch.export flow for 4 models, with unique challenges and solutions #3180

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

agunapal
Copy link
Contributor

@agunapal agunapal commented Dec 10, 2024

Fixes #3174

Description

The gaming community cares about certain classes of models like pose estimation, instance segmentation, video classification. When we try to export OSS implementations of these models, we run into unique challenges with torch.export

Currently, we have tutorials showing usage of export and talking about the core export-related concepts to keep in mind with simple examples. We also have ExportDB which has information on unsupported constructs with simple examples. However, practically, when running export on many models, its not very clear how does once go about addressing the issues.

This tutorial aims to do the reverse. Pick 4 models which are popular, try to export them, show the errors we run into and how do we solve them. The problems being solved are generic enough to be applicable to a range of models.

Checklist

  • The issue that is being fixed is referred in the description (see above "Fixes #ISSUE_NUMBER")
  • Only one issue is addressed in this pull request
  • Labels from the issue that this PR is fixing are added to this pull request
  • No unnecessary issues are included into this pull request.

cc @avikchaudhuri @gmagogsfm @zhxchen17 @tugsbayasgalan @angelayi @suo @ydwu4

Copy link

pytorch-bot bot commented Dec 10, 2024

🔗 Helpful Links

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

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

✅ No Failures

As of commit 71c468f with merge base f7d06b6 (image):
💚 Looks good so far! There are no failures yet. 💚

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

recipes_source/torch_export_challenges_solutions.rst Outdated Show resolved Hide resolved
recipes_source/torch_export_challenges_solutions.rst Outdated Show resolved Hide resolved
recipes_source/torch_export_challenges_solutions.rst Outdated Show resolved Hide resolved
recipes_source/torch_export_challenges_solutions.rst Outdated Show resolved Hide resolved
recipes_source/torch_export_challenges_solutions.rst Outdated Show resolved Hide resolved
recipes_source/torch_export_challenges_solutions.rst Outdated Show resolved Hide resolved
recipes_source/torch_export_challenges_solutions.rst Outdated Show resolved Hide resolved
recipes_source/torch_export_challenges_solutions.rst Outdated Show resolved Hide resolved
recipes_source/torch_export_challenges_solutions.rst Outdated Show resolved Hide resolved
recipes_source/torch_export_challenges_solutions.rst Outdated Show resolved Hide resolved
agunapal and others added 4 commits December 10, 2024 15:26
Co-authored-by: Svetlana Karslioglu <svekars@meta.com>
Co-authored-by: Svetlana Karslioglu <svekars@meta.com>
Copy link

@ydwu4 ydwu4 left a comment

Choose a reason for hiding this comment

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

Thanks for the efforts, it looks awesome. Left some comments.


TORCH_LOGS="graph_breaks" python <file_name>.py

You will need to modify your program to get rid of graph breaks. Once resolved, you are ready to export the model.
Copy link

Choose a reason for hiding this comment

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

There is an alternative of fixing all the graph breaks, which is export with strict=False and strict=False will become the default setting soon cc @avikchaudhuri. So it may worth mentioning this up front (I see the non-strict example below but just feel it worth emphasizing)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

discussed offline that will be addressing this in a different tutorial in H1

recipes_source/torch_export_challenges_solutions.rst Outdated Show resolved Hide resolved
@agunapal agunapal requested a review from angelayi January 16, 2025 01:08
@svekars svekars requested a review from ydwu4 January 16, 2025 17:18
Copy link
Contributor

@svekars svekars left a comment

Choose a reason for hiding this comment

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

Formatting cleanup

recipes_source/torch_export_challenges_solutions.rst Outdated Show resolved Hide resolved
recipes_source/torch_export_challenges_solutions.rst Outdated Show resolved Hide resolved
recipes_source/torch_export_challenges_solutions.rst Outdated Show resolved Hide resolved
recipes_source/torch_export_challenges_solutions.rst Outdated Show resolved Hide resolved
recipes_source/torch_export_challenges_solutions.rst Outdated Show resolved Hide resolved
recipes_source/torch_export_challenges_solutions.rst Outdated Show resolved Hide resolved
recipes_source/torch_export_challenges_solutions.rst Outdated Show resolved Hide resolved
recipes_source/torch_export_challenges_solutions.rst Outdated Show resolved Hide resolved
recipes_source/torch_export_challenges_solutions.rst Outdated Show resolved Hide resolved
recipes_source/torch_export_challenges_solutions.rst Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants