Repository navigation
[quantization] quantize / dequantize through load operations - #50386
Open
ArthurZucker wants to merge 60 commits into
Open
ArthurZucker wants to merge 60 commits into
ArthurZucker wants to merge 60 commits into
Conversation
…on: pin its output
…ad op, uncompressed checkpoints no longer force it
… the checkpoint format; drop no-op after-load hook
…hts load decompressed, compressed-tensors only sets up activation / kv cache quantization
…on: pin its output
…ad op, uncompressed checkpoints no longer force it
… the checkpoint format; drop no-op after-load hook
…hts load decompressed, compressed-tensors only sets up activation / kv cache quantization
Replaces WeightTransform.quantization_operation: the op is appended last to each param's converter.
…n, model.dequantize() too
…converters of modules keeping their packed tensors
…emm keeps input_scale_ub through loading
…buffer kept; serialize visits every module; gptq/awq/auto_round/quark dequantize moved to a follow-up
…vfp4 loads pre-quantized checkpoints with dequantize=True
…ers removed, shorter suffix handling
…t, and saves it back
…tized_module` (#50343) * [quantization] swap modules in one pass through a per-quantizer quantized_module * [quantization] build_fp8_linear / build_fp8_experts
…nd saves it back; dequantize=True is plain dense
…-load' into HEAD # Conflicts: # src/transformers/quantizers/quantizer_compressed_tensors.py # tests/quantization/compressed_tensors_integration/test_compressed_models.py
…ch transform's ops; fp8 declares fused experts
…erns; is_serializable is a method
…h; bnb docs: dequantize keeps the quantized values
…kip kernel checks when dequantizing; eetq says why it can't
…-load' into quantize-load-operation
# Conflicts: # src/transformers/quantizers/quantizer_eetq.py
… experts) through the plan (#50376) * [quantization plan] load ModelOpt per-layer configs through the plan * [quantization plan] dequantized patterns stay as None so a broader pattern can't claim them * [nvfp4] load ModelOpt NVFP4 checkpoints, with their static input_scale * [loading] quantized companions can be buffers; Concatenate stacks tensors that lack the dim (per-expert scales) * [fp8] load ModelOpt FP8 checkpoints, weight-only FP8 for FP8_PB_WO * [quantization plan] FP8_PB_WO expects the weight-only FP8 config * [nvfp4] NVFP4Experts: keep ModelOpt NVFP4 experts packed instead of loading them dense * [mxfp4] generic MXFP4 experts; DeepSeek-V4 fp4 experts load via a plan * [quantization plan] a single user config brings only its loading attributes to a saved plan * [nvfp4] NVFP4Experts: load through the model's merge converters, grouped NVFP4 forward * [quantization plan] the plan alone says what is quantized; keep renamings appended after general converters * [quantization plan] default skips except modules the plan names; NVFP4 experts eager outside sm90/sm100 * [quantization plan] each model converter is updated by the quantizer owning its target only * [quantization plan] the general weight converter first, so an own-name one can't take shared experts * [mxfp4] Mxfp4Deserialize passes through tensors not in GPT-OSS's blocks layout * [fp8] dequantize=True dequantizes FP8 embeddings too, like every other quantized module * [quantization plan] the plan scopes a quantizer's renamings to its own params: plain suffix renames, no module lists * [fp8] inline the experts weight format; ModelOpt names are plain renames in both modes, no dequantize-side renaming * [quantization plan] one matching rule for every pattern; [fp8] Fp8Deserialize reshapes and casts at load instead of after it * [quantization plan] match each module once with the dtype plan's globs; no after-load hooks for fp8/mxfp4 (DeepGEMM's device guard is in its dispatch) * [tests] trim the quantization plan, NVFP4 and FP8 ModelOpt tests * [quantization plan] a converted plan is written to the config in the model's names only, so the config can be reused * [quantization plan] converter owners from the module map; NVFP4 buffers take ModelOpt's names, no renames * [quantization] a dequantized model saves unquantized: FP8 and NVFP4 dequantize reverse to identity * [quantization plan] core loading routes each key to its layer's quantizer conversions; no owners, chaining or applies_to * [quantization plan] each converter updated by its owner only, quantizer renames scoped to its layers and appended to the model's; core loading unchanged * [quantization plan] scoped renamings also cover a layer's submodules (per-expert tensors) * [quantization plan] renamings first, then the converters of the key's layer quantizer: no owners, no merged general converters * [quantization] converters only copy per serialized name; update_weight_transform sets every op per param * [docs] core model loading design principles: the load path, quantization plans and tensor parallelism * [quantization plan] per-quantizer conversions on its layers, plan takes the union; core back to main * [docs] core model loading: one example walked through * [quantization plan] chain the quantizers' conversions, no dedupe * [quantization plan] fold rename_patterns into match_modules * [quantization] every quantized load goes through the plan: it builds the conversions and ops, quantizers only describe formats * Delete docs/source/en/core_model_loading_design_principles.md * [quantization plan] single quantizer keeps its isinstance; general converters only when the mode has an op * [docs] drop the deleted page from the toctree * [quantization plan] simpler per-param lookup; renamings on the layers holding a param of the format
…rd as methods, FP8/MXFP4 module builders inlined
… set per param by the plan; no quantization code left in core
…(reverts the #50240 merge here)
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: bitnet_integration, bnb, fbgemm_fp8, finegrained_fp8, higgs, hqq, metal, mxfp4, nvfp4, sinq |
|
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. Pages changed in this PR: |
ArthurZucker
force-pushed
the
mixed-nvfp4-fp8-plan
branch
from
November 23, 2026 08:38
2baa90f to
9350c06
Compare
This branch has not been deployed
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.
Stacked on #50245.
quantizeanddequantizebecome load operations set per param by the plan, replacingquantization_operationand the post-loaddequantize()(from #50240).