-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Update test_quantize_pt2e.py with HPU support #137863
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/137863
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 5e7e7ed with merge base 23fb8ba ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@jerryzh168, @albanD : Could you review this PR? |
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.
is this the only test you need to add hpu?
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.
currently we are adapting only those tests which are run on CUDA devices. Not adapting the CPU only tests.
|
@pytorchbot rebase |
|
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
Signed-off-by: amathewc <[email protected]>
|
Successfully rebased |
bebeeef to
5e7e7ed
Compare
|
@pytorchbot 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 |
**MOTIVATION** We recently integrated support for Intel Gaudi devices (identified as 'hpu') into the common_device_type framework via the pull request at pytorch#126970. This integration allows tests to be automatically instantiated for Gaudi devices upon loading the relevant library. Building on this development, the current pull request extends the utility of these hooks by adapting selected CUDA tests to operate on Gaudi devices. Additionally, we have confirmed that these modifications do not interfere with the existing tests on CUDA devices. **CHANGES** - Add support for HPU devices within the test_move_exported_model_bn using TEST_HPU flag - Use instantiate_device_type_tests with targeted attributes to generate device-specific test instances. - Apply skipIfHPU decorator to bypass tests that are not yet compatible with HPU devices. Pull Request resolved: pytorch#137863 Approved by: https://github.com/jerryzh168
| devices = ["cpu", "cuda"] | ||
| if TEST_HPU: | ||
| devices.append("hpu") | ||
| instantiate_device_type_tests(TestQuantizePT2E, globals(), only_for=devices) |
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 @amathewc this seems to break the import of TestQuantizePT2E, did you run test for the change?
WARNING:root:cannot import name 'TestQuantizePT2E' from 'quantization.pt2e.test_quantize_pt2e' (/data/users/jerryzh/pytorch/test/quantization/pt2e/test_quantize_pt2e.py)
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.
@jerryzh168 : Since we are using instantiate_device_type_tests , the test will get instantiated for each device in the system.
Launching the tests with # pytest -vs test_quantize_pt2e.py (without specifying a class name ) will launch the tests on all devices.
If you want the tests to be run
- specifically on CPUs : pytest -vs test_quantize_pt2e.py::TestQuantizePT2ECPU
- specifically on CUDA devices: pytest -vs test_quantize_pt2e.py::TestQuantizePT2ECUDA
- specifically on HPUs: pytest -vs test_quantize_pt2e.py::TestQuantizePT2EHPU
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.
I see, thanks, but we are using python test/test_quantization.py -k test_name e.g. python test/test_quantization.py -k test_simple_quantizer to run all the other tests, so this should work, can you check how to make this work?

MOTIVATION
We recently integrated support for Intel Gaudi devices (identified as 'hpu') into the common_device_type framework via the pull request at #126970. This integration allows tests to be automatically instantiated for Gaudi devices upon loading the relevant library. Building on this development, the current pull request extends the utility of these hooks by adapting selected CUDA tests to operate on Gaudi devices. Additionally, we have confirmed that these modifications do not interfere with the existing tests on CUDA devices.
CHANGES