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

Đang mở Phù hợp với người mới
#9,019 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
84/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python, pytorch
Lĩnh vực
machine-learning, testing

Hướng nghiên cứu

Bắt đầu tại unit/v1/zero/test_zero2_offload_multi_backward.py và đọc TestZero2OffloadOverflowRecovery::test_finite_step_after_overflow, bao gồm kiểm tra hỗ trợ bf16 hiện có và việc bỏ qua CPUAdam. Thêm kiểm tra hỗ trợ fp16 tương ứng được mô tả trong issue, sau đó chạy hai cấu hình tham số hóa fp16 trên CPU runner có CPUAdam; chúng phải được bỏ qua thay vì thất bại trong quá trình khởi tạo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Python
Star
43.3k
Fork
5.1k
Merge trung bình
5 ngày 10 giờ
Pull request đã merge (30 ngày)
85

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của deepspeedai/DeepSpeed

Tất cả issue của deepspeedai/DeepSpeed

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.