Raise explicit error when FP8 is requested via from_config#42865
Open
dikshyantacharya wants to merge 2 commits intohuggingface:mainfrom
Open
Raise explicit error when FP8 is requested via from_config#42865dikshyantacharya wants to merge 2 commits intohuggingface:mainfrom
dikshyantacharya wants to merge 2 commits intohuggingface:mainfrom
Conversation
0b2d42a to
d86e813
Compare
MekkCyber
reviewed
Dec 15, 2025
Comment on lines
+1310
to
+1315
| if quant_config is not None: | ||
| if quant_config.get("quant_method") == "fp8": | ||
| raise NotImplementedError( | ||
| "FP8 via `from_config()` is not yet supported. " | ||
| "FP8 models must be created via `from_pretrained()` with an FP8-capable backend." | ||
| ) |
Contributor
There was a problem hiding this comment.
let's make it general and not only for fp8
Comment on lines
+1
to
+11
| import pytest | ||
|
|
||
| from transformers import AutoConfig, AutoModel | ||
|
|
||
|
|
||
| def test_fp8_from_config_raises(): | ||
| config = AutoConfig.from_pretrained("gpt2") | ||
| config.quantization_config = {"quant_method": "fp8"} | ||
|
|
||
| with pytest.raises(NotImplementedError, match="FP8 via"): | ||
| AutoModel.from_config(config) |
Contributor
There was a problem hiding this comment.
could you add the test to the quantization tests instead ?
fd7022b to
8d39746
Compare
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: config |
68a6441 to
fcd2e2d
Compare
Contributor
|
View the CircleCI Test Summary for this PR: https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=42865&sha=417544 |
This was referenced Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
from_config()currently ignores FP8 intent specified viaquantization_config, silently falling back to FP32.This PR makes the behavior explicit by raising a clear error instead.
What this PR does
NotImplementedErrorwhen FP8 is requested viafrom_config()Why
Scope
This PR does not enable FP8 kernels or backend support.
It focuses solely on correctness and explicit behavior.