diff --git a/epochalyst/__init__.py b/epochalyst/__init__.py index b5395a7..64eaef1 100644 --- a/epochalyst/__init__.py +++ b/epochalyst/__init__.py @@ -1,6 +1,9 @@ -"""The epochalyst package. +"""The epochalyst package.""" -It consists of the following modules: -- `logging`: The logging module contains the classes and methods to log the pipeline. -- `pipeline`: The pipeline module contains the classes and methods to create a pipeline for the model. -""" +from .ensemble import EnsemblePipeline +from .model import ModelPipeline + +__all__ = [ + "ModelPipeline", + "EnsemblePipeline", +] diff --git a/epochalyst/_core/__init__.py b/epochalyst/_core/__init__.py deleted file mode 100644 index 3835ea8..0000000 --- a/epochalyst/_core/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Module containing the core functionality of the epochalyst package.""" diff --git a/epochalyst/_core/_caching/__init__.py b/epochalyst/_core/_caching/__init__.py deleted file mode 100644 index d1647e3..0000000 --- a/epochalyst/_core/_caching/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Module for core caching functionality.""" diff --git a/epochalyst/_core/_pipeline/__init__.py b/epochalyst/_core/_pipeline/__init__.py deleted file mode 100644 index 1393da4..0000000 --- a/epochalyst/_core/_pipeline/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Module for core pipeline functionality.""" diff --git a/epochalyst/caching/__init__.py b/epochalyst/caching/__init__.py new file mode 100644 index 0000000..c4f989f --- /dev/null +++ b/epochalyst/caching/__init__.py @@ -0,0 +1,5 @@ +"""Caching module for epochalyst.""" + +from .cacher import CacheArgs, Cacher + +__all__ = ["Cacher", "CacheArgs"] diff --git a/epochalyst/_core/_caching/_cacher.py b/epochalyst/caching/cacher.py similarity index 99% rename from epochalyst/_core/_caching/_cacher.py rename to epochalyst/caching/cacher.py index 15d061e..6a4dcc3 100644 --- a/epochalyst/_core/_caching/_cacher.py +++ b/epochalyst/caching/cacher.py @@ -1,10 +1,12 @@ +"""The cacher module contains the Cacher class.""" + import glob import os import pickle import sys from typing import Any, Literal, TypedDict -from epochalyst.logging.logger import Logger +from epochalyst.logging import Logger try: import dask.array as da @@ -27,7 +29,6 @@ except ImportError: """User doesn't require these packages""" - if sys.version_info < (3, 11): # pragma: no cover ( torch.Tensor: @dataclass -class SubstractChannels(torch.nn.Module): +class SubtractChannels(torch.nn.Module): """Randomly substract other channels from the current one.""" p: float = 0.5 diff --git a/epochalyst/pipeline/model/training/augmentation/utils.py b/epochalyst/training/augmentation/utils.py similarity index 98% rename from epochalyst/pipeline/model/training/augmentation/utils.py rename to epochalyst/training/augmentation/utils.py index 3addfe9..2dcd370 100644 --- a/epochalyst/pipeline/model/training/augmentation/utils.py +++ b/epochalyst/training/augmentation/utils.py @@ -12,7 +12,7 @@ import torch -from epochalyst.pipeline.model.training.utils.recursive_repr import recursive_repr +from epochalyst.training.utils.recursive_repr import recursive_repr def get_audiomentations() -> ModuleType: diff --git a/epochalyst/training/models/__init__.py b/epochalyst/training/models/__init__.py new file mode 100644 index 0000000..165fb70 --- /dev/null +++ b/epochalyst/training/models/__init__.py @@ -0,0 +1,7 @@ +"""Module for reusable models or wrappers.""" + +from .timm import Timm + +__all__ = [ + "Timm", +] diff --git a/epochalyst/pipeline/model/training/models/timm.py b/epochalyst/training/models/timm.py similarity index 100% rename from epochalyst/pipeline/model/training/models/timm.py rename to epochalyst/training/models/timm.py diff --git a/epochalyst/pipeline/model/training/pretrain_block.py b/epochalyst/training/pretrain_block.py similarity index 97% rename from epochalyst/pipeline/model/training/pretrain_block.py rename to epochalyst/training/pretrain_block.py index cab6ed5..7aaef74 100644 --- a/epochalyst/pipeline/model/training/pretrain_block.py +++ b/epochalyst/training/pretrain_block.py @@ -6,7 +6,7 @@ from joblib import hash -from epochalyst.pipeline.model.training.training_block import TrainingBlock +from .training_block import TrainingBlock @dataclass diff --git a/epochalyst/pipeline/model/training/torch_trainer.py b/epochalyst/training/torch_trainer.py similarity index 97% rename from epochalyst/pipeline/model/training/torch_trainer.py rename to epochalyst/training/torch_trainer.py index 35cd4b6..7f49c05 100644 --- a/epochalyst/pipeline/model/training/torch_trainer.py +++ b/epochalyst/training/torch_trainer.py @@ -19,22 +19,21 @@ from torch.utils.data import DataLoader, Dataset, TensorDataset from tqdm import tqdm -from epochalyst._core._pipeline._custom_data_parallel import _CustomDataParallel -from epochalyst.pipeline.model.training.training_block import TrainingBlock -from epochalyst.pipeline.model.training.utils import _get_onnxrt, _get_openvino -from epochalyst.pipeline.model.training.utils.tensor_functions import batch_to_device +from ._custom_data_parallel import _CustomDataParallel +from .training_block import TrainingBlock +from .utils import _get_onnxrt, _get_openvino, batch_to_device T = TypeVar("T", bound=Dataset) # type: ignore[type-arg] T_co = TypeVar("T_co", covariant=True) -def custom_collate(batch: tuple[Tensor, ...]) -> tuple[Tensor, ...]: +def custom_collate(batch: list[Tensor]) -> tuple[Tensor, Tensor]: """Collate function for the dataloader. :param batch: The batch to collate. :return: Collated batch. """ - X, y = batch + X, y = batch[0], batch[1] return X, y @@ -167,7 +166,7 @@ def log_to_terminal(self, message: str) -> None: epochs: Annotated[int, Gt(0)] = 10 patience: Annotated[int, Gt(0)] = -1 # Early stopping batch_size: Annotated[int, Gt(0)] = 32 - collate_fn: Callable[[tuple[Tensor, ...]], tuple[Tensor, ...]] = field(default=custom_collate, init=True, repr=False, compare=False) + collate_fn: Callable[[list[Tensor]], tuple[Tensor, Tensor]] = field(default=custom_collate, init=True, repr=False, compare=False) # Checkpointing checkpointing_enabled: bool = field(default=True, init=True, repr=False, compare=False) @@ -379,9 +378,7 @@ def _predict_after_train( concat_dataset, batch_size=self.batch_size, shuffle=False, - collate_fn=( - self.collate_fn if hasattr(concat_dataset, "__getitems__") else None # type: ignore[arg-type] - ), + collate_fn=(self.collate_fn if hasattr(concat_dataset, "__getitems__") else None), ) return self.predict_on_loader(pred_dataloader), y case "validation": @@ -413,7 +410,7 @@ def custom_predict(self, x: Any, **pred_args: Any) -> npt.NDArray[np.float32]: pred_dataset, batch_size=curr_batch_size, shuffle=False, - collate_fn=(self.collate_fn if hasattr(pred_dataset, "__getitems__") else None), # type: ignore[arg-type] + collate_fn=(self.collate_fn if hasattr(pred_dataset, "__getitems__") else None), ) # Predict with a single model @@ -459,9 +456,7 @@ def predict_on_loader( loader.dataset, batch_size=loader.batch_size, shuffle=False, - collate_fn=( - self.collate_fn if hasattr(loader.dataset, "__getitems__") else None # type: ignore[arg-type] - ), + collate_fn=(self.collate_fn if hasattr(loader.dataset, "__getitems__") else None), **self.dataloader_args, ) if compile_method is None: @@ -572,14 +567,14 @@ def create_dataloaders( train_dataset, batch_size=self.batch_size, shuffle=True, - collate_fn=(self.collate_fn if hasattr(train_dataset, "__getitems__") else None), # type: ignore[arg-type] + collate_fn=(self.collate_fn if hasattr(train_dataset, "__getitems__") else None), **self.dataloader_args, ) validation_loader = DataLoader( validation_dataset, batch_size=self.batch_size, shuffle=False, - collate_fn=(self.collate_fn if hasattr(validation_dataset, "__getitems__") else None), # type: ignore[arg-type] + collate_fn=(self.collate_fn if hasattr(validation_dataset, "__getitems__") else None), **self.dataloader_args, ) return train_loader, validation_loader diff --git a/epochalyst/pipeline/model/training/training.py b/epochalyst/training/training.py similarity index 88% rename from epochalyst/pipeline/model/training/training.py rename to epochalyst/training/training.py index 1017c07..5453719 100644 --- a/epochalyst/pipeline/model/training/training.py +++ b/epochalyst/training/training.py @@ -4,10 +4,10 @@ from agogos.training import TrainingSystem, TrainType -from epochalyst._core._caching._cacher import CacheArgs, _Cacher +from epochalyst.caching import CacheArgs, Cacher -class TrainingPipeline(TrainingSystem, _Cacher): +class TrainingPipeline(TrainingSystem, Cacher): """The training pipeline. This is the class used to create the pipeline for the training of the model. :param steps: The steps to train the model. @@ -35,9 +35,9 @@ def train(self, x: Any, y: Any, cache_args: CacheArgs | None = None, **train_arg # Furthest step for i, step in enumerate(self.get_steps()): - # Check if step is instance of _Cacher and if cache_args exists - if not isinstance(step, _Cacher) or not isinstance(step, TrainType): - self.log_to_debug(f"{step} is not instance of _Cacher or TrainType") + # Check if step is instance of Cacher and if cache_args exists + if not isinstance(step, Cacher) or not isinstance(step, TrainType): + self.log_to_debug(f"{step} is not instance of Cacher or TrainType") continue step_args = train_args.get(step.__class__.__name__, None) @@ -89,9 +89,9 @@ def predict(self, x: Any, cache_args: CacheArgs | None = None, **pred_args: Any) # Retrieve furthest step calculated for i, step in enumerate(self.get_steps()): - # Check if step is instance of _Cacher and if cache_args exists - if not isinstance(step, _Cacher) or not isinstance(step, TrainType): - self.log_to_debug(f"{step} is not instance of _Cacher or TrainType") + # Check if step is instance of Cacher and if cache_args exists + if not isinstance(step, Cacher) or not isinstance(step, TrainType): + self.log_to_debug(f"{step} is not instance of Cacher or TrainType") continue step_args = pred_args.get(step.__class__.__name__, None) diff --git a/epochalyst/pipeline/model/training/training_block.py b/epochalyst/training/training_block.py similarity index 97% rename from epochalyst/pipeline/model/training/training_block.py rename to epochalyst/training/training_block.py index 3f35d73..d64cf8f 100644 --- a/epochalyst/pipeline/model/training/training_block.py +++ b/epochalyst/training/training_block.py @@ -5,10 +5,10 @@ from agogos.training import Trainer -from epochalyst._core._caching._cacher import CacheArgs, _Cacher +from epochalyst.caching import CacheArgs, Cacher -class TrainingBlock(Trainer, _Cacher): +class TrainingBlock(Trainer, Cacher): """The training block is a flexible block that allows for training of any model. Methods diff --git a/epochalyst/pipeline/model/training/utils/__init__.py b/epochalyst/training/utils/__init__.py similarity index 54% rename from epochalyst/pipeline/model/training/utils/__init__.py rename to epochalyst/training/utils/__init__.py index 526b575..5b91f9e 100644 --- a/epochalyst/pipeline/model/training/utils/__init__.py +++ b/epochalyst/training/utils/__init__.py @@ -1,8 +1,12 @@ """Module with utility functions for training.""" from .get_dependencies import _get_onnxrt, _get_openvino +from .recursive_repr import recursive_repr +from .tensor_functions import batch_to_device __all__ = [ "_get_onnxrt", "_get_openvino", + "batch_to_device", + "recursive_repr", ] diff --git a/epochalyst/pipeline/model/training/utils/get_dependencies.py b/epochalyst/training/utils/get_dependencies.py similarity index 100% rename from epochalyst/pipeline/model/training/utils/get_dependencies.py rename to epochalyst/training/utils/get_dependencies.py diff --git a/epochalyst/pipeline/model/training/utils/recursive_repr.py b/epochalyst/training/utils/recursive_repr.py similarity index 100% rename from epochalyst/pipeline/model/training/utils/recursive_repr.py rename to epochalyst/training/utils/recursive_repr.py diff --git a/epochalyst/pipeline/model/training/utils/tensor_functions.py b/epochalyst/training/utils/tensor_functions.py similarity index 100% rename from epochalyst/pipeline/model/training/utils/tensor_functions.py rename to epochalyst/training/utils/tensor_functions.py diff --git a/epochalyst/transformation/__init__.py b/epochalyst/transformation/__init__.py new file mode 100644 index 0000000..3a85565 --- /dev/null +++ b/epochalyst/transformation/__init__.py @@ -0,0 +1,9 @@ +"""Module containing transformation functions for the model pipeline.""" + +from .transformation import TransformationPipeline +from .transformation_block import TransformationBlock + +__all__ = [ + "TransformationPipeline", + "TransformationBlock", +] diff --git a/epochalyst/pipeline/model/transformation/transformation.py b/epochalyst/transformation/transformation.py similarity index 91% rename from epochalyst/pipeline/model/transformation/transformation.py rename to epochalyst/transformation/transformation.py index 463dc0c..cbd342c 100644 --- a/epochalyst/pipeline/model/transformation/transformation.py +++ b/epochalyst/transformation/transformation.py @@ -1,15 +1,15 @@ -"""TransformationPipeline that extends from TransformingSystem, _Cacher and _Logger.""" +"""TransformationPipeline that extends from TransformingSystem, Cacher and _Logger.""" from dataclasses import dataclass from typing import Any from agogos.transforming import TransformingSystem, TransformType -from epochalyst._core._caching._cacher import CacheArgs, _Cacher +from epochalyst.caching.cacher import CacheArgs, Cacher @dataclass -class TransformationPipeline(TransformingSystem, _Cacher): +class TransformationPipeline(TransformingSystem, Cacher): """TransformationPipeline is the class used to create the pipeline for the transformation of the data. ### Parameters: @@ -80,9 +80,9 @@ def transform(self, data: Any, cache_args: CacheArgs | None = None, **transform_ # Furthest step for i, step in enumerate(self.get_steps()): - # Check if step is instance of _Cacher and if cache_args exists - if not isinstance(step, _Cacher) or not isinstance(step, TransformType): - self.log_to_debug(f"{step} is not instance of _Cacher or TransformType") + # Check if step is instance of Cacher and if cache_args exists + if not isinstance(step, Cacher) or not isinstance(step, TransformType): + self.log_to_debug(f"{step} is not instance of Cacher or TransformType") continue step_args = transform_args.get(step.__class__.__name__, None) diff --git a/epochalyst/pipeline/model/transformation/transformation_block.py b/epochalyst/transformation/transformation_block.py similarity index 96% rename from epochalyst/pipeline/model/transformation/transformation_block.py rename to epochalyst/transformation/transformation_block.py index 8836ffa..a163c7b 100644 --- a/epochalyst/pipeline/model/transformation/transformation_block.py +++ b/epochalyst/transformation/transformation_block.py @@ -5,10 +5,10 @@ from agogos.transforming import Transformer -from epochalyst._core._caching._cacher import CacheArgs, _Cacher +from epochalyst.caching.cacher import CacheArgs, Cacher -class TransformationBlock(Transformer, _Cacher): +class TransformationBlock(Transformer, Cacher): """The transformation block is a flexible block that allows for transformation of any data. Methods diff --git a/tests/caching/__init__.py b/tests/caching/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/_core/_caching/test__cacher.py b/tests/caching/test__cacher.py similarity index 99% rename from tests/_core/_caching/test__cacher.py rename to tests/caching/test__cacher.py index 042e398..f119c28 100644 --- a/tests/_core/_caching/test__cacher.py +++ b/tests/caching/test__cacher.py @@ -5,12 +5,12 @@ import polars as pl import pytest -from epochalyst._core._caching._cacher import _Cacher +from epochalyst.caching.cacher import Cacher from epochalyst.logging.logger import Logger from tests.constants import TEMP_DIR -class Implemented_Cacher(_Cacher, Logger): +class Implemented_Cacher(Cacher, Logger): pass diff --git a/tests/logging/__init__.py b/tests/logging/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/pipeline/test_ensemble.py b/tests/test_ensemble.py similarity index 92% rename from tests/pipeline/test_ensemble.py rename to tests/test_ensemble.py index 42c7b55..b998bc9 100644 --- a/tests/pipeline/test_ensemble.py +++ b/tests/test_ensemble.py @@ -5,12 +5,10 @@ import numpy as np import pytest -from epochalyst.pipeline.ensemble import EnsemblePipeline -from epochalyst.pipeline.model.model import ModelPipeline -from epochalyst.pipeline.model.transformation.transformation import \ - TransformationPipeline -from epochalyst.pipeline.model.transformation.transformation_block import \ - TransformationBlock +from epochalyst import EnsemblePipeline +from epochalyst import ModelPipeline +from epochalyst.transformation import TransformationPipeline +from epochalyst.transformation import TransformationBlock from tests.constants import TEMP_DIR diff --git a/tests/pipeline/model/test_model.py b/tests/test_model.py similarity index 91% rename from tests/pipeline/model/test_model.py rename to tests/test_model.py index 6c46b47..f33554b 100644 --- a/tests/pipeline/model/test_model.py +++ b/tests/test_model.py @@ -5,11 +5,9 @@ import numpy as np import pytest -from epochalyst.pipeline.model.model import ModelPipeline -from epochalyst.pipeline.model.transformation.transformation import \ - TransformationPipeline -from epochalyst.pipeline.model.transformation.transformation_block import \ - TransformationBlock +from epochalyst import ModelPipeline +from epochalyst.transformation import TransformationPipeline +from epochalyst.transformation import TransformationBlock from tests.constants import TEMP_DIR diff --git a/tests/training/__init__.py b/tests/training/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/training/augmentation/__init__.py b/tests/training/augmentation/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/pipeline/model/training/augmentation/test_audio/white_noise.wav b/tests/training/augmentation/test_audio/white_noise.wav similarity index 100% rename from tests/pipeline/model/training/augmentation/test_audio/white_noise.wav rename to tests/training/augmentation/test_audio/white_noise.wav diff --git a/tests/pipeline/model/training/augmentation/test_image_augmentations.py b/tests/training/augmentation/test_image_augmentations.py similarity index 96% rename from tests/pipeline/model/training/augmentation/test_image_augmentations.py rename to tests/training/augmentation/test_image_augmentations.py index 323b880..f7a53e3 100644 --- a/tests/pipeline/model/training/augmentation/test_image_augmentations.py +++ b/tests/training/augmentation/test_image_augmentations.py @@ -1,6 +1,6 @@ import torch -from epochalyst.pipeline.model.training.augmentation import image_augmentations +from epochalyst.training.augmentation import image_augmentations class TestImageAugmentations: diff --git a/tests/pipeline/model/training/augmentation/test_time_series_augmentations.py b/tests/training/augmentation/test_time_series_augmentations.py similarity index 95% rename from tests/pipeline/model/training/augmentation/test_time_series_augmentations.py rename to tests/training/augmentation/test_time_series_augmentations.py index 02faca6..662ea7e 100644 --- a/tests/pipeline/model/training/augmentation/test_time_series_augmentations.py +++ b/tests/training/augmentation/test_time_series_augmentations.py @@ -1,8 +1,7 @@ import numpy as np import torch -from epochalyst.pipeline.model.training.augmentation import \ - time_series_augmentations +from epochalyst.training.augmentation import time_series_augmentations def set_torch_seed(seed: int = 42) -> None: @@ -153,7 +152,7 @@ def test_reverse_1d(self): def test_subtract_channels(self): set_torch_seed(42) - subtract_channels = time_series_augmentations.SubstractChannels(p=1.0) + subtract_channels = time_series_augmentations.SubtractChannels(p=1.0) # Only works for multi-channel sequences x = torch.ones(32, 2, 100) augmented_x = subtract_channels(x) @@ -163,7 +162,7 @@ def test_subtract_channels(self): assert torch.allclose(torch.zeros(*augmented_x.shape), augmented_x) - subtract_channels = time_series_augmentations.SubstractChannels(p=0) + subtract_channels = time_series_augmentations.SubtractChannels(p=0) augmented_x = subtract_channels(x) assert torch.all(augmented_x == x) @@ -206,10 +205,10 @@ def test_energy_cutmix(self): def test_add_background_noise_wrapper(self): add_background_noise_wrapper = time_series_augmentations.AddBackgroundNoiseWrapper(p=1.0, - sounds_path='tests/pipeline/model/training/augmentation/test_audio/white_noise.wav') + sounds_path='tests/training/augmentation/test_audio/white_noise.wav') x = torch.rand(44100, dtype=torch.float32) sr = 44100 augmented_x = add_background_noise_wrapper(x, sr) # verify that not applying augmentation doesnt do anything - assert not torch.all(x == augmented_x) \ No newline at end of file + assert not torch.all(x == augmented_x) diff --git a/tests/pipeline/model/training/augmentation/test_utils.py b/tests/training/augmentation/test_utils.py similarity index 97% rename from tests/pipeline/model/training/augmentation/test_utils.py rename to tests/training/augmentation/test_utils.py index df4aabc..d62ff2f 100644 --- a/tests/pipeline/model/training/augmentation/test_utils.py +++ b/tests/training/augmentation/test_utils.py @@ -1,6 +1,6 @@ import torch -from epochalyst.pipeline.model.training.augmentation import utils +from epochalyst.training.augmentation import utils def set_torch_seed(seed: int = 42) -> None: diff --git a/tests/training/models/__init__.py b/tests/training/models/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/pipeline/model/training/models/test_timm.py b/tests/training/models/test_timm.py similarity index 81% rename from tests/pipeline/model/training/models/test_timm.py rename to tests/training/models/test_timm.py index 65b7aac..ab847d7 100644 --- a/tests/pipeline/model/training/models/test_timm.py +++ b/tests/training/models/test_timm.py @@ -1,6 +1,6 @@ import torch -from epochalyst.pipeline.model.training.models.timm import Timm +from epochalyst.training.models import Timm class TestTimm: diff --git a/tests/pipeline/model/training/test_pretrain_block.py b/tests/training/test_pretrain_block.py similarity index 89% rename from tests/pipeline/model/training/test_pretrain_block.py rename to tests/training/test_pretrain_block.py index 9c4cdd4..afe0e43 100644 --- a/tests/pipeline/model/training/test_pretrain_block.py +++ b/tests/training/test_pretrain_block.py @@ -1,6 +1,6 @@ import pytest -from epochalyst.pipeline.model.training.pretrain_block import PretrainBlock +from epochalyst.training import PretrainBlock class TestPretrainBlock: diff --git a/tests/pipeline/model/training/test_torch_trainer.py b/tests/training/test_torch_trainer.py similarity index 98% rename from tests/pipeline/model/training/test_torch_trainer.py rename to tests/training/test_torch_trainer.py index 0d55800..4e88d58 100644 --- a/tests/pipeline/model/training/test_torch_trainer.py +++ b/tests/training/test_torch_trainer.py @@ -4,11 +4,9 @@ import time from dataclasses import dataclass -from epochalyst._core._pipeline._custom_data_parallel import _CustomDataParallel -from epochalyst.pipeline.model.training.utils import _get_onnxrt, _get_openvino -from types import ModuleType +from epochalyst.training._custom_data_parallel import _CustomDataParallel -from epochalyst.pipeline.model.training.torch_trainer import custom_collate +from epochalyst.training.torch_trainer import custom_collate from typing import Any from unittest.mock import patch @@ -16,7 +14,7 @@ import pytest import torch -from epochalyst.pipeline.model.training.torch_trainer import TorchTrainer +from epochalyst.training.torch_trainer import TorchTrainer from tests.constants import TEMP_DIR diff --git a/tests/pipeline/model/training/test_training.py b/tests/training/test_training.py similarity index 96% rename from tests/pipeline/model/training/test_training.py rename to tests/training/test_training.py index 3891b2a..ec495b3 100644 --- a/tests/pipeline/model/training/test_training.py +++ b/tests/training/test_training.py @@ -1,11 +1,9 @@ -from pathlib import Path - import numpy as np import pytest from agogos.training import Trainer -from epochalyst.pipeline.model.training.training import TrainingPipeline -from epochalyst.pipeline.model.training.training_block import TrainingBlock +from epochalyst.training import TrainingPipeline +from epochalyst.training import TrainingBlock from tests.constants import TEMP_DIR diff --git a/tests/pipeline/model/training/test_training_block.py b/tests/training/test_training_block.py similarity index 95% rename from tests/pipeline/model/training/test_training_block.py rename to tests/training/test_training_block.py index 15d7a35..accadb0 100644 --- a/tests/pipeline/model/training/test_training_block.py +++ b/tests/training/test_training_block.py @@ -1,9 +1,8 @@ -import shutil from pathlib import Path import pytest -from epochalyst.pipeline.model.training.training_block import TrainingBlock +from epochalyst.training import TrainingBlock TEMP_DIR = Path("tests/temp") diff --git a/tests/training/utils/__init__.py b/tests/training/utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/pipeline/model/training/utils/test_get_dependencies.py b/tests/training/utils/test_get_dependencies.py similarity index 95% rename from tests/pipeline/model/training/utils/test_get_dependencies.py rename to tests/training/utils/test_get_dependencies.py index e1938ac..2f91c22 100644 --- a/tests/pipeline/model/training/utils/test_get_dependencies.py +++ b/tests/training/utils/test_get_dependencies.py @@ -3,7 +3,7 @@ import pytest -from epochalyst.pipeline.model.training.utils import _get_openvino, _get_onnxrt +from epochalyst.training.utils import _get_openvino, _get_onnxrt class TestGetDependencies: diff --git a/tests/pipeline/test_recursive_repr.py b/tests/training/utils/test_recursive_repr.py similarity index 89% rename from tests/pipeline/test_recursive_repr.py rename to tests/training/utils/test_recursive_repr.py index d98a93d..81bcb75 100644 --- a/tests/pipeline/test_recursive_repr.py +++ b/tests/training/utils/test_recursive_repr.py @@ -1,6 +1,4 @@ -import pytest - -from epochalyst.pipeline.model.training.utils.recursive_repr import recursive_repr +from epochalyst.training.utils.recursive_repr import recursive_repr class TestRecursiveRepr: @@ -40,4 +38,4 @@ def __init__(self): def test_recursive_repr_with_no_dict(self): obj = 123 expected_repr = repr(obj) - assert recursive_repr(obj) == expected_repr \ No newline at end of file + assert recursive_repr(obj) == expected_repr diff --git a/tests/transformation/__init__.py b/tests/transformation/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/pipeline/model/transformation/test_transformation.py b/tests/transformation/test_transformation.py similarity index 95% rename from tests/pipeline/model/transformation/test_transformation.py rename to tests/transformation/test_transformation.py index e9444f8..453462f 100644 --- a/tests/pipeline/model/transformation/test_transformation.py +++ b/tests/transformation/test_transformation.py @@ -5,10 +5,8 @@ import pytest from agogos.transforming import Transformer -from epochalyst.pipeline.model.transformation.transformation import \ - TransformationPipeline -from epochalyst.pipeline.model.transformation.transformation_block import \ - TransformationBlock +from epochalyst.transformation import TransformationPipeline +from epochalyst.transformation import TransformationBlock from tests.constants import TEMP_DIR diff --git a/tests/pipeline/model/transformation/test_transformation_block.py b/tests/transformation/test_transformation_block.py similarity index 96% rename from tests/pipeline/model/transformation/test_transformation_block.py rename to tests/transformation/test_transformation_block.py index b62aa8f..710b580 100644 --- a/tests/pipeline/model/transformation/test_transformation_block.py +++ b/tests/transformation/test_transformation_block.py @@ -6,8 +6,7 @@ import numpy as np import pytest -from epochalyst.pipeline.model.transformation.transformation_block import \ - TransformationBlock +from epochalyst.transformation import TransformationBlock TEMP_DIR = Path("tests/temp")