Skip to content

[TimesFM 2.5] Fix quantile loss channel indexing - #50704

Open
Roshanraj2580 wants to merge 1 commit into
huggingface:mainfrom
Roshanraj2580:fix/timesfm2_5-quantile-loss-indices
Open

Roshanraj2580 wants to merge 1 commit into
huggingface:mainfrom
Roshanraj2580:fix/timesfm2_5-quantile-loss-indices

Conversation

@Roshanraj2580

@Roshanraj2580 Roshanraj2580 commented Nov 13, 2026 •

Copy link
Copy Markdown

🤗 Transformers CI

What does this PR do?

Fixes #50612

In TimesFm2_5ModelForPrediction.forward, quantile loss indexing filtered channels via [i for i in range(normalized_preds.shape[-1]) if i != decode_index].

Because channel 0 is the point-forecast head (output_projection_point) rather than a quantile head, this index expression erroneously included channel 0 in quantile_tensor and evaluated it against self.config.quantiles[0]. Consequently, channels 1..4 were shifted by one position, and channel decode_index (the median quantile) received no quantile loss supervision.

This PR:

  • Slices quantile channels with list(range(1, normalized_preds.shape[-1])) in both modeling_timesfm2_5.py and modular_timesfm2_5.py, aligning channels 1..9 1:1 with config.quantiles.
  • Adds regression test test_loss_quantile_channel_alignment in tests/models/timesfm2_5/test_modeling_timesfm2_5.py.

Who can review?

@Cyrilvallez @Raushan-T

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution 🤗!

CI Security Gate — waiting for maintainer approval

CI is approved automatically only for authors who already have a contribution merged in this repository. A maintainer will review this PR and approve CI to run on it.

@github-actions

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: timesfm2_5

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TimesFM 2.5: training loss feeds the point-forecast channel to the quantile loss

1 participant