-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Add __main__ guards to ao tests #154612
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
Add __main__ guards to ao tests #154612
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/154612
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 ce7bb80 with merge base 450180f ( UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
70862cd
to
80b10f2
Compare
cc @AnthonyBarbier thanks for the PR, torch.ao.sparsity is currently being deprecated, I think you should start with another folder first. |
This is the first PR of a series in an attempt to re-submit https://github.com/pytorch/pytorch/pull/134592/files as smaller PRs.
e8d0cbe
to
ce7bb80
Compare
@jcaip Please review this PR, there is no change in features / coverage, it just fixes the guards so that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @AnthonyBarbier Changes look fine, but why do we need this? I don't quite follow #134592. Can you explain a bit more what the issue is here?
Are these tests erroring when being run individually - i.e. python test/ao/sparsity/test_activation_sparsifier.py
? And you're looking to fix that behavior?
The issue is that The idea is to have all the tests which rely on this module to handle their main() to explicitly call I believe when my colleague created the original PR he bumped into some issues where the tests fall in one of 3 categories:
The series of PRs is meant to make it clear which way the test is expected to be executed. (And to add the missing run_tests() for the tests which are expected to be run directly) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, thanks for explaining. lgtm
@pytorchmergebot merge |
Merge startedYour 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 |
This is the first PR of a series in an attempt to get the content of pytorch#134592 merged as smaller PRs (Given that the original one was closed due to a lack of reviewers). This specific PR contains: - Add and use a common raise_on_run_directly method for when a user runs a test file directly which should not be run this way. Print the file which the user should have run. - Update ao tests. There will be follow up PRs to update the other test suites but I don't have permissions to create branches directly on pytorch/pytorch so I can't create a stack and therefore will have to create them one at the time. Cc @jerryzh168 Pull Request resolved: pytorch#154612 Approved by: https://github.com/jcaip
This is the first PR of a series in an attempt to get the content of #134592 merged as smaller PRs (Given that the original one was closed due to a lack of reviewers).
This specific PR contains:
There will be follow up PRs to update the other test suites but I don't have permissions to create branches directly on pytorch/pytorch so I can't create a stack and therefore will have to create them one at the time.
Cc @jerryzh168