Skip to content

[Feature] Allow custom RINorm kwargs & fix foundation compatibility#3029

Merged
dennisbader merged 11 commits intounit8co:masterfrom
daidahao:fix/rinorm-foundation
Feb 27, 2026
Merged

[Feature] Allow custom RINorm kwargs & fix foundation compatibility#3029
dennisbader merged 11 commits intounit8co:masterfrom
daidahao:fix/rinorm-foundation

Conversation

@daidahao
Copy link
Contributor

@daidahao daidahao commented Feb 23, 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 #3028, fixes #2748.

Summary

  • All torch models now accept use_reversible_instance_norm as a flexible parameter that can be set to True, False, or a dictionary of RINorm hyperparameters. This allows users to customize RINorm for their models.
  • Disallowed use_reversible_instance_norm=True or {"affine": True} for foundation models to prevent checkpoint loading errors due to incompatible weights.

Other Information

#2758 is not being fixed in this PR.

Co-authored-by: Zhihao Dai <zhihao.dai@eng.ox.ac.uk>
@codecov
Copy link

codecov bot commented Feb 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.66%. Comparing base (3ae6ca3) to head (0c41992).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3029      +/-   ##
==========================================
- Coverage   95.73%   95.66%   -0.07%     
==========================================
  Files         158      158              
  Lines       17122    17131       +9     
==========================================
- Hits        16391    16389       -2     
- Misses        731      742      +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.

Co-authored-by: Zhihao Dai <zhihao.dai@eng.ox.ac.uk>
Copy link
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.

Thanks for the PR @daidahao 🚀

Could we rather under the hood allow PLForecastingModule to already accept a bool or any kwargs (e.g. {"affine": True}) to instantiate the RINorm? If it's a bool, it would use the existing behavior.

Then for the foundation models we would pass {"affine": False} whenever use_reversible_instance_norm=True.

This would be a quick fix while still allowing the foundation models to use RINorm (could be good for fine-tuning).

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>
Co-authored-by: Zhihao Dai <zhihao.dai@eng.ox.ac.uk>
@daidahao
Copy link
Contributor Author

daidahao commented Feb 24, 2026

@dennisbader

This would be a quick fix while still allowing the foundation models to use RINorm (could be good for fine-tuning).

Personally, I would not recommend using RINorm for prediction or fine-tuning since almost all foundation models have their own RINorm. That's why I have now removed any reference to RINorm in Chronos-2 and TimesFM. Nevertheless, in FoundationModel, use_reversible_instance_norm is being handled properly to produce warnings and override "affine" key to False.

For all torch models, I've updated PLForecastingModule so that it now accepts use_reversible_instance_norm as either a bool or dict of hyperparameters. One question remains, should we update all torch model doctorings to highlight this new feature?

Let me know what you think.

Co-authored-by: Zhihao Dai <zhihao.dai@eng.ox.ac.uk>
Co-authored-by: Zhihao Dai <zhihao.dai@eng.ox.ac.uk>
@daidahao daidahao marked this pull request as ready for review February 26, 2026 23:04
@daidahao daidahao changed the title [Bugfix] Disallow RINorm for foundation models [Feature] Allow custom RINorm kwargs & fix foundation compatibility Feb 26, 2026
@daidahao daidahao requested a review from dennisbader February 27, 2026 00:00
Copy link
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 @daidahao 🚀
I applied some minor updates (shortened a bit the parameter description and added it to all model docs)

@dennisbader dennisbader merged commit 350449d into unit8co:master Feb 27, 2026
9 checks passed
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.

[BUG] RINorm incompatible with foundation models [FEAT] Expose RINorm kwargs

2 participants