执行摘要
修复 dtype 获取方法名称错误
PR 标题和 commit message 明确说明:torch.get_current_dtype() 不存在,正确 API 应为 torch.get_default_dtype()。修复后在 config 未指定 dtype 时能够正确获取 PyTorch 默认 dtype。
该 PR 属于简单 bugfix,修复直接,风险低,可以快速合并。无需深度审查。
该 PR 无 review 评论或讨论。
PR 标题和 commit message 明确说明:torch.get_current_dtype() 不存在,正确 API 应为 torch.get_default_dtype()。修复后在 config 未指定 dtype 时能够正确获取 PyTorch 默认 dtype。
该 PR 属于简单 bugfix,修复直接,风险低,可以快速合并。无需深度审查。
该 PR 无 review 评论或讨论。
slime_plugins/models/qwen3_5.py 和 slime_plugins/models/qwen3_next.py 的 FusedRMSNormGated 初始化处,当 config.dtype 为 None 时,使用 torch.get_current_dtype() 作为后备 dtype。torch.get_current_dtype() 修改为 torch.get_default_dtype(),后者是 PyTorch 标准的获取默认 dtype 的方法。FusedRMSNormGated 的 dtype 参数,修改后不会影响其他模块行为。| 文件 | 模块 | 状态 | 重要度 |
|---|---|---|---|
slime_plugins/models/qwen3_5.py |
模型定义 | modified | 5.27 |
slime_plugins/models/qwen3_next.py |
模型定义 | modified | 5.27 |
slime_plugins/models/qwen3_5.py
data-contract
修复 Qwen3.5 模型初始化时 dtype 后备逻辑中的 API 名称错误。
# slime_plugins/models/qwen3_5.py
self.norm = FusedRMSNormGated(
self.head_v_dim,
eps=self.layer_norm_epsilon,
activation=self.activation,
device=torch.cuda.current_device(),
# 修复:使用 torch.get_default_dtype() 替代不存在的 torch.get_current_dtype()
dtype=config.dtype if config.dtype is not None else torch.get_default_dtype(),
)
slime_plugins/models/qwen3_next.py
data-contract
修复 Qwen3Next 模型初始化时 dtype 后备逻辑中的 API 名称错误。
# slime_plugins/models/qwen3_next.py
self.norm = FusedRMSNormGated(
self.head_v_dim,
eps=self.layer_norm_epsilon,
activation=self.activation,
device=torch.cuda.current_device(),
# 修复:使用 torch.get_default_dtype() 替代不存在的 torch.get_current_dtype()
dtype=config.dtype if config.dtype is not None else torch.get_default_dtype(),
)
当前评论区没有形成足够清晰的争议点或结论,后续有更多讨论时会体现在这里。
风险极低。变更仅涉及两个文件中同一行代码的 API 名称替换,且目标 API 是 PyTorch 稳定且广泛使用的 torch.get_default_dtype()。不涉及控制流、数据结构或性能变化。
影响范围小,仅影响 Qwen3.5 和 Qwen3Next 模型在 config 未显式设置 dtype 时的 Fallback 行为。修复后,这些模型在未指定 dtype 时将正确使用 PyTorch 的默认 dtype(通常为 torch.float32),而非因调用不存在的方法而抛出 AttributeError。
当前没有检测到明确关联的 Issue 链接,后续同步到相关引用后会出现在这里。
参与讨论