Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug] Float8CurrentScaling / Float8BlockScaling: fp8_quant_* QParams ignore use_power_2_scales / use_f32_scales passed to the constructor

已关闭
#3,593 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

@Varun-51 已经在做这个了。

开始于 2026年10月1日。

  • #3603 来自 @efegokdemir —— 已关闭,未合并
  • #3604 来自 @Varun-51 —— 已关闭,未合并
  • #3605 来自 @Varun-51 —— 未关闭

评估

难度
3/5
预计耗时
1-2 天
新手友好度
75/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python

调研方向

Read the Float8CurrentScaling and Float8BlockScaling definitions in transformer_engine/common/recipe/init.py, then compare their QParams construction with NVFP4BlockScaling.post_init. Reproduce on CPU using the provided constructor examples with environment defaults set to 0. Done when explicit constructor values are reflected in the corresponding fp8_quant_* QParams, while omitted arguments still use environment-variable defaults.

由索引模型根据 Issue 内容生成。

描述

bug

If use_power_2_scales (Float8CurrentScaling) or use_f32_scales (Float8BlockScaling) is passed to the constructor with a value different from its environment-variable default, the recipe reports the new value but its fp8_quant_* QParams retain the old value:

Float8CurrentScaling(use_power_2_scales=True)
use_power_2_scales = True
fp8_quant_fwd_inp.power_2_scale = False # expected True

Float8BlockScaling(use_f32_scales=True)
use_f32_scales = True
fp8_quant_fwd_inp.power_2_scale = True # expected False

Nothing raises an error, so the recipe configuration and the associated QParams can silently disagree.

Root cause (as far as I can tell)

In transformer_engine/common/recipe/init.py, fp8_quant_fwd_inp, fp8_quant_fwd_weight, and fp8_quant_bwd_grad are constructed in the class body using the class-level use_power_2_scales / use_f32_scales values.

They have no type annotation, so they are not dataclass fields. The QParams are therefore constructed once when the class is defined/imported. Passing an explicit value to the constructor changes the instance attribute, but does not rebuild the existing QParams.

NVFP4BlockScaling in the same file constructs its fp4_quant_* QParams in post_init, so those QParams are built per instance.

To Reproduce

NVTE_FP8_CURRENT_SCALING_POWER_2_SCALES=0

NVTE_FP8_BLOCK_SCALING_FP32_SCALES=0

python repro.py

from transformer_engine.common.recipe import (
Float8CurrentScaling,
Float8BlockScaling,
)

r = Float8CurrentScaling(use_power_2_scales=True)
print(r.use_power_2_scales, r.fp8_quant_fwd_inp.power_2_scale)

True False

r = Float8BlockScaling(use_f32_scales=True)
print(r.use_f32_scales, r.fp8_quant_fwd_inp.power_2_scale)

True True

This reproduces on CPU; no GPU or CUDA execution is required.

Expected behavior

The fp8_quant_* QParams should be constructed per instance from the effective recipe configuration, similar to NVFP4BlockScaling.

For example:

r = Float8CurrentScaling(use_power_2_scales=True)
assert r.use_power_2_scales is True
assert r.fp8_quant_fwd_inp.power_2_scale is True

r = Float8BlockScaling(use_f32_scales=True)
assert r.use_f32_scales is True
assert r.fp8_quant_fwd_inp.power_2_scale is False

The environment variables should still provide the default values when the corresponding constructor arguments are not passed.

Happy to work on this once assigned. Thanks

主要语言
Python
星标
3.6k
派生
862
平均合并
4 天 21 小时
30 天内合并 PR
62

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

NVIDIA/TransformerEngine 的其他 Issue

查看 NVIDIA/TransformerEngine 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。