Skip to content

Conversation

gmagogsfm
Copy link
Contributor

@gmagogsfm gmagogsfm commented Mar 7, 2025

Summary:

  • Flip the default value of strict argument in torch.export.export from True to False
  • Update test infra to cope with the change, some of them made the assumption of strict mode as default
  • Disabled some tests that fail in non-strict mode

Test Plan: Sandcastle

Differential Revision: D70228628

cc @ezyang @gchanan

Copy link

pytorch-bot bot commented Mar 7, 2025

🔗 Helpful Links

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

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

✅ You can merge normally! (1 Unrelated Failure)

As of commit 20b836f with merge base 924a247 (image):

FLAKY - The following job failed but was likely due to flakiness present on trunk:

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@@ -12,22 +12,22 @@
test_classes = {}


def mocked_non_strict_export(*args, **kwargs):
def mocked_strict_export(*args, **kwargs):
# If user already specified strict, don't make it non-strict
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# If user already specified strict, don't make it non-strict
# If user already specified strict, don't make it strict

@@ -263,6 +263,12 @@ def expectedFailureNonStrict(fn):
return fn


# Controls tests generated in test/export/test_export_nonstrict.py
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Controls tests generated in test/export/test_export_nonstrict.py
# Controls tests generated in test/export/test_export_strict.py

@@ -9933,6 +9934,7 @@ def forward(self, x):
).run(ep.graph_module.code)

def test_replace_unbacked_with_very_large_upperbound(self):
strict = True
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this set to True?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the un-modded (as in not a variant like retracability) test is not in non-strict mode, however some of the test cases like this one fails in non-strict. So I temporarily forced strict mode for them.

@@ -6720,7 +6722,6 @@ def forward(self):
ep = export(m, ())
self.assertEqual(ep.graph_signature.lifted_tensor_constants, ["x"])

@testing.expectedFailureRetraceability # T186979579
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this error disappear now? Does this mean we should also have a variant that is Retraceability w/ Strict export?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, because of a bug in my code, I forgot to update the strict flag in retracing export call. Changed.

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

Summary:
Pull Request resolved: pytorch#148790

- Flip the default value of strict argument in torch.export.export from True to False
- Update test infra to cope with the change, some of them made the assumption of strict mode as default
- Disabled some tests that fail in non-strict mode

**If this diff breaks your test, please add `strict=True` to your torch.export.export callsite to mitigate**. DO NOT revert this diff.

Test Plan: Sandcastle

Reviewed By: angelayi

Differential Revision: D70228628
@facebook-github-bot
Copy link
Contributor

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

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk Trigger trunk jobs on your pull request fb-exported Merged module: bc-breaking Related to a BC-breaking change release notes: export topic: bc breaking topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants