[WIP][ENH] TTM data pipeline: _dataset_class hook + TTMDataModule#2206
Draft
StrikerEureka34 wants to merge 2 commits intosktime:mainfrom
Draft
[WIP][ENH] TTM data pipeline: _dataset_class hook + TTMDataModule#2206StrikerEureka34 wants to merge 2 commits intosktime:mainfrom
StrikerEureka34 wants to merge 2 commits intosktime:mainfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2206 +/- ##
=======================================
Coverage ? 85.23%
=======================================
Files ? 167
Lines ? 9909
Branches ? 0
=======================================
Hits ? 8446
Misses ? 1463
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:
|
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
WIP towards #2184. Related: #1959 #2051
What does this implement/fix? Explain your changes.
WIP draft for #2184, that is integrating IBM's TinyTimeMixer (TTM) into pytorch-forecasting's v2 pipeline.
TTM is a pretrained foundation model for zero-shot and fine-tuned time series forecasting, and it expects a specific input format that our current v2 pipeline doesn't produce.
This draft/WIP PR covers the data layer only. No model weights, no
tsfm_publicdependency yet, as the main aim of it was to just getting the pipeline to speak TTM's language.Issues I ran into
TslibDataModule.setup()had four hardcoded_TslibDataset(...)calls.So there was no clean way to swap in a different dataset class without duplicating the entire method.
Changes made
Added
_dataset_class = _TslibDatasetto TslibDataModule and replaced those four calls withself._dataset_class(...).Which gives a zero behavioral change for existing code.
On top of that hook:
__getitem__to produce TTM-format batches:past_values, past_observed_mask, future_values, prediction_channel_indices
from metadata, and provides a
collate_fnfor the mixed Tensor/non-Tensor batchSo the channel ordering follows TTM's spec:
[targets | past-only covariates | known-future covariates]Does it work?
Yes, with a
MockTTMstanding in for the real model:One pre-existing failure in test_multivariate_target ('list' object has no attribute 'shape') which was reproducible on
main, so unrelated to this PR and the changes made by it, worth a separate issue if not already tracked?What's left
_preprocess_dataruns per__getitem__so it needs a per-series cache before this is usable at scale (I mentioned it as a TODO in the code and using a short term fix for current scope)tsfm_public.models.tinytimemixer, as an optional dependency.TslibBaseModelThe _dataset_class hook is intentionally generic, with TTMDataModule as the first user, but the same pattern should work for Chronos, Moirai, and others with their own
__getitem__overrides.More discussion and testing is needed for that I believe, but initial findings seem promising.
Looking for early feedback on this hook design and TTM channel format assumptions before going further, thanks!
@phoeenniixx @PranavBhatP @agrob