From 3812c18fea7f84395e3b348826cb214f2a7f29e1 Mon Sep 17 00:00:00 2001 From: "Wesley M. Gifford" Date: Tue, 16 Jul 2024 16:52:00 -0400 Subject: [PATCH 1/3] hf style imports --- tsfm_public/__init__.py | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/tsfm_public/__init__.py b/tsfm_public/__init__.py index 51ab4da0..20005ac4 100644 --- a/tsfm_public/__init__.py +++ b/tsfm_public/__init__.py @@ -2,3 +2,53 @@ # from .version import __version__, __version_tuple__ + +from pathlib import Path +from typing import TYPE_CHECKING + + +# Check the dependencies satisfy the minimal versions required. +from transformers.utils import _LazyModule, logging + + +logger = logging.get_logger(__name__) # pylint: disable=invalid-name + +# Base objects, independent of any specific backend +_import_structure = { + "models": [], + "models.tinytimemixer": ["TINYTIMEMIXER_PRETRAINED_CONFIG_ARCHIVE_MAP", "TinyTimeMixerConfig"], + "toolkit": [], +} + + +# PyTorch-backed objects +_import_structure["models.tinytimemixer"].extend( + [ + "TINYTIMEMIXER_PRETRAINED_MODEL_ARCHIVE_LIST", + "TinyTimeMixerPreTrainedModel", + "TinyTimeMixerModel", + "TinyTimeMixerForPrediction", + ] +) + +# Direct imports for type-checking +if TYPE_CHECKING: + from .models.tinytimemixer import ( + TINYTIMEMIXER_PRETRAINED_CONFIG_ARCHIVE_MAP, + TINYTIMEMIXER_PRETRAINED_MODEL_ARCHIVE_LIST, + TinyTimeMixerConfig, + TinyTimeMixerForPrediction, + TinyTimeMixerModel, + TinyTimeMixerPreTrainedModel, + ) +else: + # Standard + import sys + + sys.modules[__name__] = _LazyModule( + __name__, + globals()["__file__"], + _import_structure, + module_spec=__spec__, + extra_objects={"__version__": __version__}, + ) From 8e5d467bbf29b2f65870983d4c6f2956eb251c2a Mon Sep 17 00:00:00 2001 From: "Wesley M. Gifford" Date: Thu, 18 Jul 2024 12:37:10 -0400 Subject: [PATCH 2/3] style --- tsfm_public/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tsfm_public/__init__.py b/tsfm_public/__init__.py index 20005ac4..214a3921 100644 --- a/tsfm_public/__init__.py +++ b/tsfm_public/__init__.py @@ -1,15 +1,14 @@ # Copyright contributors to the TSFM project # -from .version import __version__, __version_tuple__ - from pathlib import Path from typing import TYPE_CHECKING - # Check the dependencies satisfy the minimal versions required. from transformers.utils import _LazyModule, logging +from .version import __version__, __version_tuple__ + logger = logging.get_logger(__name__) # pylint: disable=invalid-name From c9e1337ad4548e30c6a3695a366e18e739f08fba Mon Sep 17 00:00:00 2001 From: "Wesley M. Gifford" Date: Fri, 19 Jul 2024 09:36:05 -0400 Subject: [PATCH 3/3] ease import of some toolkit items --- tsfm_public/__init__.py | 15 ++++++++++++++- tsfm_public/toolkit/__init__.py | 4 ++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tsfm_public/__init__.py b/tsfm_public/__init__.py index 214a3921..1eb66186 100644 --- a/tsfm_public/__init__.py +++ b/tsfm_public/__init__.py @@ -16,7 +16,13 @@ _import_structure = { "models": [], "models.tinytimemixer": ["TINYTIMEMIXER_PRETRAINED_CONFIG_ARCHIVE_MAP", "TinyTimeMixerConfig"], - "toolkit": [], + "toolkit": [ + "TimeSeriesPreprocessor", + "TimeSeriesForecastingPipeline", + "ForecastDFDataset", + "PretrainDFDataset", + "RegressionDFDataset", + ], } @@ -40,6 +46,13 @@ TinyTimeMixerModel, TinyTimeMixerPreTrainedModel, ) + from .toolkit import ( + ForecastDFDataset, + PretrainDFDataset, + RegressionDFDataset, + TimeSeriesForecastingPipeline, + TimeSeriesPreprocessor, + ) else: # Standard import sys diff --git a/tsfm_public/toolkit/__init__.py b/tsfm_public/toolkit/__init__.py index 4f85bd0b..6c019cb7 100644 --- a/tsfm_public/toolkit/__init__.py +++ b/tsfm_public/toolkit/__init__.py @@ -1,2 +1,6 @@ # Copyright contributors to the TSFM project # + +from .dataset import ForecastDFDataset, PretrainDFDataset, RegressionDFDataset +from .time_series_forecasting_pipeline import TimeSeriesForecastingPipeline +from .time_series_preprocessor import TimeSeriesPreprocessor