[ENH] Add contributor extension template for v2 model implementation #2194#2230
Draft
sujanyd wants to merge 1 commit intosktime:mainfrom
Draft
[ENH] Add contributor extension template for v2 model implementation #2194#2230sujanyd wants to merge 1 commit intosktime:mainfrom
sujanyd wants to merge 1 commit intosktime:mainfrom
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2230 +/- ##
=======================================
Coverage ? 86.71%
=======================================
Files ? 167
Lines ? 9782
Branches ? 0
=======================================
Hits ? 8482
Misses ? 1300
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
8e89a01 to
59e81cf
Compare
phoeenniixx
requested changes
Mar 29, 2026
Member
phoeenniixx
left a comment
There was a problem hiding this comment.
Thanks a lot!
- Can you please create 2 separate files - for model and
pkg. - Please add the pointers to all the methods what they expect, what to pass etc. Look at
sktimeextension templates for reference. - Add all the tags and what they mean in the
pkgclass
Member
There was a problem hiding this comment.
Do we need tests for templates as well?
59e81cf to
6f436a9
Compare
6f436a9 to
2f52d7b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
-> Reference Issues/PRs
Fixes #2194. See also #1993 (v2 roadmap).
-> What does this implement/fix? Explain your changes.
This PR adds standardized extension templates for contributors implementing new models under the v2 architecture. Previously, contributors had to reverse-engineer the expected structure from existing model implementations that were themselves still being migrated.
New files added
- pytorch_forecasting/models/model_template.py
Template for subclassing BaseModel, including init, forward, and optional training_step with inline RATIONALE: comments
- pytorch_forecasting/models/pkg_template.py
Template for the model’s package container (Base_pkg), with _tags, get_cls, get_datamodule_cls, and get_test_train_params
- pytorch_forecasting/data/datamodule_template.py
Template for a custom DataModule when EncoderDecoderTimeSeriesDataModule is insufficient
- tests/test_models/test_template.py
Test template covering integration and pickle tests
Modified files
- CONTRIBUTING.md
Added Implementing New Models (v2) section with direct links to all templates
-> Bonus enhancement (can be split into a separate PR if preferred)
- pytorch_forecasting/data/timeseries/_timeseries.py
Added interpolation_strategy parameter (forward_fill, linear, zero) to TimeSeriesDataSet
- tests/test_data/test_interpolation.py
Full test coverage for all strategies including mixed per-column strategies
- scripts/demo_interpolation.py
Visual demo comparing the three interpolation strategies
-> What should a reviewer concentrate their feedback on?
- Are the CONTRIBUTOR TODO and RATIONALE: comments clear and sufficient for a new contributor?
- Does the model_template.py correctly reflect the v2 BaseModel API (especially metadata, _pkg, and training_step)?
- Is pkg_template.py aligned with the current Base_pkg interface?
- Should the interpolation changes in _timeseries.py be moved to a separate PR?
-> Did you add any tests for the change?
- Added tests/test_models/test_template.py
A contributor-facing test template with integration and pickle test stubs
- Added tests/test_data/test_interpolation.py
Full tests for the interpolation_strategy feature covering forward_fill, linear, zero, and mixed per-column strategies
-> Any other comments?
This was listed as an explicit open work item in the v2 roadmap issue #1993: Add extension Templates for new contributors.
All template files follow a consistent pattern of CONTRIBUTOR TODO for actionable items and RATIONALE: for explanatory context, to make onboarding as smooth as possible.
⸻
-> PR checklist
- The PR title starts with [ENH]
- Added/modified tests
- Used pre-commit hooks when committing to ensure that code is compliant with hooks
(Install hooks with pre-commit install. To run hooks independently, execute pre-commit run --all-files)