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

オープン
#2,050 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
46/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python, pytorch, tensorflow

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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").

主要言語
Python
スター
288
フォーク
73
平均マージ
1日 3時間
マージ済み PR(30日)
273

環境構築

はじめの一歩

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

NVIDIA/TensorRT-Model-Connect のほかの issue

NVIDIA/TensorRT-Model-Connect の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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