Skip to content

Conversation

@YangKai0616
Copy link
Contributor

What does this PR do?

When testing tests/quantization/finegrained_fp8/test_fp8.py on XPU, it reported the following error:

FAILED tests/quantization/finegrained_fp8/test_fp8.py::FP8QuantizerTest::test_dequantization_no_accelerator - AssertionError: False is not true
FAILED tests/quantization/finegrained_fp8/test_fp8.py::FP8QuantizerTest::test_dequantize_when_no_accelerator - ValueError: Expected a xpu device, but got: cpu
FAILED tests/quantization/finegrained_fp8/test_fp8.py::FP8QuantizerTest::test_quantizer_validation_no_accelerator - AssertionError: RuntimeError not raised

The root cause is that the _patch_no_accelerator method does not fully take effect on XPU.

@YangKai0616 YangKai0616 changed the title [XPU] Fix fp8 UT patch [XPU] Fix fp8 UT patch func Dec 3, 2025
@YangKai0616
Copy link
Contributor Author

Hi @MekkCyber , please help review, thanks!

Copy link
Contributor

@MekkCyber MekkCyber 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 fix @YangKai0616

Comment on lines +49 to +51
stack.enter_context(
patch("transformers.quantizers.quantizer_finegrained_fp8.is_torch_xpu_available", return_value=False)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

weird that we need to add it, but I guess it's fine

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

[For maintainers] Suggested jobs to run (before merge)

run-slow: finegrained_fp8

@MekkCyber MekkCyber merged commit 75c135d into huggingface:main Dec 3, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants