CPU: test_finite_step_after_overflow fp16 cases fail with 'Type fp16 is not supported on your device'

未关闭 适合新手
#9,019 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

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

调研方向

从 unit/v1/zero/test_zero2_offload_multi_backward.py 开始,阅读 TestZero2OffloadOverflowRecovery::test_finite_step_after_overflow,包括现有的 bf16 支持检查和 CPUAdam 跳过逻辑。添加 issue 中描述的对应 fp16 支持检查,然后在具备 CPUAdam 的 CPU runner 上运行两个 fp16 参数化测试;它们应当被跳过,而不是在初始化时失败。

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

描述

Description

TestZero2OffloadOverflowRecovery::test_finite_step_after_overflow (added in #8728) fails on CPU-only runners in the cpu-torch-latest-v1-multirank suite:

unit/v1/zero/test_zero2_offload_multi_backward.py::TestZero2OffloadOverflowRecovery::test_finite_step_after_overflow[False-fp16]
unit/v1/zero/test_zero2_offload_multi_backward.py::TestZero2OffloadOverflowRecovery::test_finite_step_after_overflow[True-fp16]

ValueError: Type fp16 is not supported on your device.
  File "deepspeed/runtime/engine.py", line 2017, in _do_sanity_check
    raise ValueError("Type fp16 is not supported on your device.")

Root cause

The test parametrizes precision = ["bf16", "fp16"] and skips unsupported bf16 devices, but has no mirror skip for fp16:

if precision == "bf16" and not get_accelerator().is_bf16_supported():
    pytest.skip("BF16 is not supported")

On CPU, is_fp16_supported() is false, so the fp16 cases reach deepspeed.initialize() and hit the engine sanity check.

This is not caught by the single-rank cpu-torch-latest workflow because CPUAdam is not pre-built there, so the earlier CPUAdam is required skip takes effect first. The multirank workflow pre-builds CPUAdam, letting the fp16 cases actually run.

Suggested fix

Add the mirror skip:

if precision == "fp16" and not get_accelerator().is_fp16_supported():
    pytest.skip("FP16 is not supported")

Environment

Observed on cpu-torch-latest-v1-multirank / unit tests (CPU runners, torch 2.14.0+cpu, Python 3.12), e.g. job https://github.com/deepspeedai/DeepSpeed/actions/runs/42034600447/job/127269577159 . Originally surfaced while validating PR #8944.

主要语言
Python
星标
43.3k
派生
5.1k
平均合并
5 天 10 小时
30 天内合并 PR
85

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

deepspeedai/DeepSpeed 的其他 Issue

查看 deepspeedai/DeepSpeed 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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