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

オープン 初心者向け
#9,019 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
84/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python, pytorch

調査の方向性

unit/v1/zero/test_zero2_offload_multi_backward.pyから始めて、既存のbf16サポート確認とCPUAdamのスキップを含め、TestZero2OffloadOverflowRecovery::test_finite_step_after_overflowを読んでください。issueで説明されている対応するfp16サポート確認を追加し、次にCPUAdamを利用できるCPU runnerで2つの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時間
マージ済み PR(30日)
85

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

deepspeedai/DeepSpeed のほかの issue

deepspeedai/DeepSpeed の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。