Feature: fp16 builds for timesfm (3x to 12x faster than fp32) need an overflow guard for large normalized inputs

Đang mở
#2,050 0 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 1 ngày

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

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
46/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi

Hướng nghiên cứu

Start with the TimesFM family build and network builder paths, then read families/timesfm/README.md and the FP8 study referenced in the issue. Trace where normalized inputs enter the input residual block and how precision is selected; the issue does not name specific source files or tests. Done means fp16 builds pass an overflow guard, all 200 sampled M4 daily series produce finite forecasts, and an fp16 end-to-end case covers the behavior while fp32 remains the default.

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

Mô tả

enhancement

Request type: Improvement to existing behavior

Problem and use case

families/timesfm builds fp32 only (the family build rejects fp16, although the network builder has an fp16 path). fp32 with TF32 off is slow: on google/timesfm-2.0-500m-pytorch an fp16 engine is 3.2x to 3.5x faster at batch 1 and 11.5x to 12.4x faster at batch 32 (B200 / B300, TensorRT 11.4), with M4 hourly MASE 0.5859 against 0.5866 for fp32.

fp16 cannot simply be turned on: on 1 of 200 sampled M4 daily series the fp16 engine (the builder's fp16 path) returns non-finite forecasts. That series' input to the input residual block reaches 1.53e9 and its residual stream 8.96e8, past the fp16 maximum (65504) from layer 0 on. The fp32 engine and Hugging Face fp32 are finite on all 200 series. For comparison, the median per-series maximum on M4 daily is 32.4 (input) and 138 (residual); on M4 hourly the maximum over all series is 66.2 and 173. TimesFM normalizes each series by the mean and standard deviation of its first unpadded patch, so a nearly flat start can give very large normalized values (likely cause, not verified per series). fp32_layers cannot fix it, because the residual stream of every layer is out of range.

Proposed outcome

Accept precision=fp16 for timesfm with an overflow guard, for example scaling or clamping the normalized input before the input residual block (or keeping the input block and residual stream in fp32), so that all M4 series stay finite, with its own fp16 E2E case. fp32 stays the default.

Model and target details

google/timesfm-2.0-500m-pytorch @ dc2443792ce5516872b89b37cf1bc058c3bf0c10 (the family manifest model); TensorRT 11.4; B200 / B300.

fp32 (default) fp16 (builder path)
Time, batch 1, B200 / B300 6.94 / 6.64 ms 1.96 / 2.11 ms
Time, batch 32, B200 / B300 51.45 / 45.91 ms 4.17 / 3.98 ms
Plan size (B200) 1906 MiB 956 MiB
M4 hourly MASE (HF fp32 0.5866) 0.5866 0.5859
M4 daily series with non-finite forecast (of 200) 0 1

Alternatives considered

fp32_layers (does not help: every layer is out of range on that series). FP8 (measured in #2005, not shipped; it runs on fp16 activations and has the same non-finite series).

Additional context

Found during the FP8 study recorded in families/timesfm/README.md (#2005, "fp16 overflow found on the way").

Ngôn ngữ chính
Python
Star
288
Fork
73
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
273

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 NVIDIA/TensorRT-Model-Connect

Tất cả issue của NVIDIA/TensorRT-Model-Connect

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.