Repository navigation
Load MXFP4 and FP8 checkpoints dequantized by default - #8070
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7409a9f897
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| config = AutoConfig.from_pretrained( | ||
| model_id, revision=kwargs.get("revision"), trust_remote_code=kwargs.get("trust_remote_code", False) | ||
| ) |
There was a problem hiding this comment.
Forward repository lookup options to the config load
When callers use repository-resolution options such as subfolder, local_files_only, or an explicit token, this new preliminary lookup ignores them and may fail or load the wrong root config before architecture.from_pretrained() receives the valid arguments. This also regresses calls with an explicit architecture, which previously did not perform a separate config lookup; pass the applicable Hub/config-loading kwargs through to AutoConfig.from_pretrained.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The default path (no architecture) already ignored these before this PR. Only revision matters now that the config decides dequantization; see the Bugbot thread.
|
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. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9361804. Configure here.
albertvillanova
left a comment
There was a problem hiding this comment.
Thanks! The config now follows revision; refs/pr/5 of the tiny gpt-oss loads as MXFP4.
- The conflict comes from #8085 deleting
examples/sft_gpt_oss/sft_gpt_oss.py: dropping that change resolves it. - Nit:
revision=kwargs.get("revision")also works, sinceNonefalls back tomain(4.56.2 too).
# Conflicts: # examples/sft_gpt_oss/sft_gpt_oss.py
…s when it is None

With
kernelsinstalled, any trainer givenopenai/gpt-oss-20bby name refuses to train: transformers rejects full fine-tuning of a quantized model, and PEFT finds nothing to adapt in the packed MXFP4 experts. Neither MXFP4 nor FP8 weights train in place, socreate_model_from_pathnow loads these checkpoints dequantized. Aquantization_configinmodel_init_kwargsstill wins.dequantize: weights with a partial 128-block fail to load (DeepSeek-V3/R1) or dequantize silently wrong transformers#49873, fix in fix(fp8): support partial blocks and non-divisible scale grids in Fp8Dequantize transformers#49882). MXFP4 experts come back bfloat16 whatever the dtype before 5.23 (Dequantize MXFP4 experts to the requested dtype transformers#50256), and on 5.x a dequantized model saves a broken checkpoint until Save dequantized models without the quantizer's weight conversions transformers#50271 lands.Note
Medium Risk
Changes default model loading for all trainers using
create_model_from_path, increasing memory for pre-quantized IDs but fixing training failures; callers can still override withquantization_config.Overview
Hub checkpoints shipped as MXFP4 or FP8 (e.g. gpt-oss, Mistral Medium) cannot be fine-tuned in their quantized form.
create_model_from_pathnow reads the config first, detectsquant_method, and unless the caller passesquantization_config, injectsMxfp4Config(dequantize=True)orFineGrainedFP8Config(dequantize=True)so trainers get trainable full-precision weights for full fine-tuning and PEFT. FP8 dequantization raises a clear error on transformers < 5.0.0.The early config load also aligns
revisionwith weight loading and removes a duplicateAutoConfig.from_pretrainedwhen inferring architecture. PEFT docs describe this behavior, memory tradeoffs, and settingdtypeviaSFTConfig(model_init_kwargs=...).Test fixes: CI revision overrides apply when
revisionis missing or explicitlyNone(not when a non-None revision is set). A newtest_dequantizes_fp8_checkpointasserts FP8 tiny models load withfloat32weights on transformers ≥ 5.0.0.Reviewed by Cursor Bugbot for commit 9188b21. Bugbot is set up for automated code reviews on this repo. Configure here.