Skip to content

Feature: TimesFM Longer Projection Head#3121

Merged
dennisbader merged 6 commits into
unit8co:masterfrom
daidahao:feat/timesfm-longer-head
May 21, 2026
Merged

Feature: TimesFM Longer Projection Head#3121
dennisbader merged 6 commits into
unit8co:masterfrom
daidahao:feat/timesfm-longer-head

Conversation

@daidahao
Copy link
Copy Markdown
Contributor

@daidahao daidahao commented May 21, 2026

Checklist before merging this PR:

  • Mentioned all issues that this PR fixes or addresses.
  • Summarized the updates of this PR under Summary.
  • Added an entry under Unreleased in the Changelog.

Fixes #.

Summary

Code is mostly hand-written, but I asked Codex to write the following summary and changes:

This PR adds optional support for TimesFM 2.5’s longer output projection head in Darts.

With use_longer_projection_head=True, users can run non-autoregressive forecasts up to:

  • output_chunk_length + output_chunk_shift <= 1024

Default behavior is unchanged (False, max 128).

Changes

  • Added use_longer_projection_head: bool = False to TimesFM2p5Model.
  • Added output_quantile_len = 1024 to TimesFM 2.5 model definition.
  • Updated module forward path to select projection head based on use_longer_projection_head:
    • default point head (128)
    • longer quantile head (1024)
  • Updated prediction-length validation and error messaging.
  • Passed use_longer_projection_head into loaded PL module via additional_params.
  • Expanded docstring/warnings around forecast divergence behavior.
  • Added/updated tests in test_timesfm2p5.py:
    • longer-head prediction path
    • creation/validation coverage for both use_longer_projection_head=True/False
  • Added changelog entry under UnreleasedImproved.

Backward Compatibility

  • Backward compatible by default.
  • Existing code paths remain unchanged unless use_longer_projection_head=True is set explicitly.

Testing

  • Added slow tests for longer projection head and creation constraints.
  • Test file: darts/tests/models/forecasting/test_timesfm2p5.py

Other Information

daidahao added 3 commits May 21, 2026 15:23
Co-authored-by: Zhihao Dai <zhihao.dai@eng.ox.ac.uk>
Co-authored-by: Zhihao Dai <zhihao.dai@eng.ox.ac.uk>
Co-authored-by: Zhihao Dai <zhihao.dai@eng.ox.ac.uk>
@daidahao daidahao requested a review from dennisbader as a code owner May 21, 2026 14:32
@daidahao daidahao changed the title Feat/timesfm longer head Feature: TimesFM Longer Projection Head May 21, 2026
daidahao added 2 commits May 21, 2026 15:39
Co-authored-by: Zhihao Dai <zhihao.dai@eng.ox.ac.uk>
Copy link
Copy Markdown
Collaborator

@dennisbader dennisbader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks a lot for the quick fix @daidahao 🚀
Just added one minor comments regarding one of the tests. After that everything is good to go 💯

Comment thread darts/tests/models/forecasting/test_timesfm2p5.py
Co-authored-by: Zhihao Dai <zhihao.dai@eng.ox.ac.uk>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.36%. Comparing base (7d86fc4) to head (948d1fb).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3121      +/-   ##
==========================================
- Coverage   96.42%   96.36%   -0.07%     
==========================================
  Files         161      161              
  Lines       17273    17281       +8     
==========================================
- Hits        16656    16653       -3     
- Misses        617      628      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@dennisbader dennisbader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a lot @daidahao 🚀

@dennisbader dennisbader merged commit 0f42eb3 into unit8co:master May 21, 2026
9 checks passed
@daidahao daidahao deleted the feat/timesfm-longer-head branch May 21, 2026 17:27
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.

2 participants