[Coverage] Direct unit-test suites for five untested core modules (conversion, core_utils, tensor_quantizer, model_calib, export/postprocess) — plus bugs found along the way
维护者通常 2 天内回复
@kevalmorabia97 已经在做这个了。
开始于 2026年7月21日。
评估
这个 Issue 还没有评估数据。
描述
Summary
While auditing test coverage, we found that several load-bearing modules have no direct unit-test file — they are exercised only incidentally through higher-level flows. We wrote hermetic, CPU-only unit suites (per CONTRIBUTING's tests/unit rules: fast, no network, no GPU) for five of them, adversarially reviewed and mutation-checked each suite, and will attach one PR per module so each is reviewable in isolation:
| Module | Suite | Tests |
|---|---|---|
torch/quantization/conversion.py |
test_conversion.py | 63 |
torch/quantization/utils/core_utils.py |
test_core_utils.py | 128 |
torch/quantization/nn/modules/tensor_quantizer.py |
test_tensor_quantizer.py | 90 (incl. hand-computed INT8/FP8/block fake-quant values) |
torch/quantization/model_calib.py |
test_model_calib.py | 42 |
torch/export/postprocess.py |
test_postprocess.py | 74 (TP/PP split layouts, padding math) |
397 tests, ~4.2k lines, total runtime ~5s. Each suite was verified to kill seeded mutations of its target (wrong scale direction, flipped split axes, broken running-max, etc.), so this is regression-detection capacity, not line-count.
Bugs found while writing these (documented in-test with NOTE: documents current behavior comments; happy to file/fix separately as preferred)
_normalize_fused_experts_quantizer_namecollides withSequentialQuantizerchild names (introduced in #1340: the singularweight_quantizer.<N>pattern matches sequential children). Two consequences, both reproduced: (a) applying the same list-of-configs twice viaset_quantizer_attributes_fullnestsSequentialQuantizers inside sub-slots (non-idempotent, corrupt state); (b)set_quantizer_attributes_partialwith a list and a*weight_quantizerwildcard now raisesValueErrormid-iteration for targets that are already sequential — a regression against its own docstring. Suggested fix: skip normalization when the matched quantizer's parent is aSequentialQuantizer.awq()silently no-ops on an unknown algorithm string (public__all__API; only themtq.quantizeconfig layer validates the literal). One-lineraise ValueErrorin an else would match the module's fail-fast style.TensorQuantizer.extra_reprdead code: the disabled branch builds a detailed string, then returns the literal"disabled", discarding it.update_lm_head_quantizationwarns "Enable lm_head quantization" even when quantizers are already disabled, and its sole call site (model_config_export.py:323) appears to passinference_pipeline_parallelinto theinference_tensor_parallelparameter.- Minor exception-safety inconsistencies:
replace_function/calibrate_with_adapters/enable_fake_quantyield without try/finally (unlikeexport_torch_modeet al.), so an exception mid-context leaks the patched state.
The behavior-documenting tests are written to fail-and-force-update when these are fixed.
PRs
Will be linked below, one per module, each self-contained.
- 主要语言
- Python
- 星标
- 5.5k
- 派生
- 785
- 平均合并
- 3 天 22 小时
- 30 天内合并 PR
- 277
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NVIDIA/Model-Optimizer 的其他 Issue
-
[Bug] modelopt-mcp: all launcher subprocesses hang when the server runs as a stdio MCP server — missing stdin=DEVNULL可能已有人在做 @ChenhanYu 于 31 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
NVIDIA/Model-Optimizer#2551 · 1 条评论 · 已指派 1 人 ·
维护者通常 2 天内回复
-
Puzzletron Progress 6/8 (calculating one block scores) takes 10 to 20 times more than in tutorial可能重新可做 @tejasng053 于 38 天前认领,目前没有进行中的 PR。 未关闭bug
难度 2/5 1-3 小时 新手友好度 68/100
NVIDIA/Model-Optimizer#1667 ·
维护者通常 2 天内回复
-
INT4 packing extension never loads from a read-only install可能已有人在做 @ajrasane 于 4 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
NVIDIA/Model-Optimizer#3025 · 已指派 1 人 ·
维护者通常 2 天内回复
-
[Puzzletron] Runtime stats benchmark model computes head size as hidden_size // num_attention_heads instead of reading head_dim可能已有人在做 @grzegorz-k-karch 于 8 天前认领。 未关闭bug
NVIDIA/Model-Optimizer#3016 · 已指派 1 人 ·
维护者通常 2 天内回复
-
feature request
难度 5/5 一周以上 新手友好度 25/100
NVIDIA/Model-Optimizer#2865 ·
维护者通常 2 天内回复
查看 NVIDIA/Model-Optimizer 的全部 Issue
相似的 Issue
-
cost:cheap practicality:seen-in-the-wild severity:medium
难度 2/5 1-3 小时 新手友好度 72/100
fairagro/m4.2_advanced_middleware_api#620 ·
维护者通常 1 天内回复
-
area:security effort:S priority:P2 provider:local-libvirt status:ready type:docs
难度 2/5 1-3 小时 新手友好度 75/100
randomparity/kdive#3495 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
microsoft/markitdown#2820 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复