[Bug] MXFP4 Bug
Maintainer thường phản hồi trong vòng 2 ngày
@43758726 đang làm issue này rồi.
Từ ngày 21/3/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Checklist
- 1. I have searched related issues but cannot get the expected help.
- 2. The bug has not been fixed in the latest version.
- 3. Please note that if the bug-related issue you submitted lacks corresponding environment info and a minimal reproducible demo, it will be challenging for us to reproduce and resolve the issue, reducing the likelihood of receiving feedback.
Describe the bug
MXFP4 model loading fails: export_weight assertion doesn't include e2m1 weight type
Environment
- lmdeploy 0.12.2+cu128 (Windows, Python 3.12)
- Model quantized with llmcompressor 0.10.0.1 using
QuantizationModifier(scheme="MXFP4A16")
Description
TurboMind cannot load MXFP4 models produced by llmcompressor. The converter sets weight_type='e2m1' globally for MXFP4 models, but export_weight() doesn't include 'e2m1' in its allowed types, causing an assertion failure when processing non-quantized layers (e.g. RMSNorm weights).
Steps to reproduce
- Quantize any model with llmcompressor MXFP4A16:
from llmcompressor import oneshot
from llmcompressor.modifiers.quantization import QuantizationModifier
recipe = [QuantizationModifier(targets=["Linear"], scheme="MXFP4A16", ignore=["lm_head"])]
oneshot(model=model, dataset=ds, recipe=recipe, ...)
model.save_pretrained(output_dir)
-
Patch
config.jsonso lmdeploy routes to its mxfp4 path (llmcompressor savesquant_method: "compressed-tensors", but lmdeploy requiresquant_method: "mxfp4"). -
Load with TurboMind:
from lmdeploy import pipeline, TurbomindEngineConfig
pipe = pipeline(output_dir, backend_config=TurbomindEngineConfig(model_format="mxfp4"))
Error
File "lmdeploy/turbomind/deploy/target_model/base.py", line 146, in export_weight
assert weight_type in ['float16', 'bfloat16', 'int4', 'fp8']
AssertionError
Stack trace shows it fails on layers.{i}.attention_norm.weight — a norm layer that should remain in float, not e2m1.
Root cause
In converter.py lines 86–88, model_format == 'mxfp4' sets weight_type = 'e2m1' globally for all layers. This flows into export_weight() (base.py:146) which only allows ['float16', 'bfloat16', 'int4', 'fp8']. The 'e2m1' type is missing from this list.
Additionally, there's no logic to differentiate between quantized Linear weights (which should be e2m1) and non-quantized norm/embedding weights (which should remain float). Compare with the GptOssForCausalLM special case at converter.py:91–93 which resets weight_type = dtype — suggesting this differentiation is needed but not generalized.
Secondary issue
There is also a routing problem: llmcompressor saves MXFP4 models with quant_method: "compressed-tensors" and format: "mxfp4-pack-quantized" in the quantization config. lmdeploy's compressed-tensors path (converter.py:149) only accepts format == 'pack-quantized', rejecting mxfp4-pack-quantized. This means the model can't load through either path without manually patching config.json.
Reproduction
I ran a benchmarking script after successfully converting a model using llmcompressor.
Environment
Windows 10, RTX 4090, Python 3.12, torch 2.9.0, lmdeploy 0.12.2, compressed-tensors 0.14.0.1, llmcompressor 0.10.0.1, cuda 12.8.1, transformers 4.57.6, triton-windows 3.5.0.post21
Error traceback
- Ngôn ngữ chính
- Python
- Star
- 8.2k
- Fork
- 797
- Merge trung bình
- 3 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 52
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của InternLM/lmdeploy
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug] apply_rotary_pos_emb: leaves output tails unwritten with partial rotationCó thể đã có người làm @shotsan đã nhận 15 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug] PyTorch engine ignores use_rslora, so rsLoRA adapters run sqrt(r) times too weakCó thể đã có người làm @Andreas-Hum đã nhận 26 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[Feature] Expose `max_model_len` (session_len) in `/v1/models` model cardCó thể đã có người làm @FOWEPJF255 đã nhận 37 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của InternLM/lmdeploy
Issue tương tự
-
accepted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
future-agi/future-agi#5908 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Placeholder export disables HTML image input for picture descriptionCó thể đã có người làm @cloudiful đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
docling-project/docling-serve#817 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
Techiebutler/freeframe#687 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Parse truncated verbose GC logs up to the first XML errorCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug verbose GC
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
IBM/javacore-analyser#677 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Prefix list view Location filter only shows Locations whose Location Type allows VLANs, not Prefixes.Có thể đã có người làm @swanandtambe đã nhận hôm nay. Đang mởtriage type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
Maintainer thường phản hồi trong vòng 1 ngày