Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring: Deleting base pipeline #61

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 6 additions & 20 deletions pipelines/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,6 @@
from torch.utils.data import DataLoader


class BaseRunner(ABC):
@abstractmethod
def run(self, *args, **kwargs):
pass


class BasePipeline(ABC):
@abstractmethod
def preprocess(self):
pass

@abstractmethod
def train(self):
pass

@abstractmethod
def evaluate(self):
pass


class BaseDataLoaders(ABC):
@property
@abstractmethod
Expand All @@ -38,3 +18,9 @@ def validation_dataloader(self) -> DataLoader:
@abstractmethod
def test_dataloader(self) -> DataLoader:
pass


class BaseRunner(ABC):
@abstractmethod
def run(self, *args, **kwargs):
pass
97 changes: 0 additions & 97 deletions pipelines/moving_mnist_pipeline/convlstm.py

This file was deleted.

12 changes: 11 additions & 1 deletion pipelines/trainer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from typing import Callable, Dict, List, Optional, TypedDict, cast
from typing import Callable, Dict, List, NotRequired, Optional, TypedDict, cast

import pandas as pd
import torch
Expand All @@ -13,6 +13,16 @@
from pipelines.utils.early_stopping import EarlyStopping


class TrainingParams(TypedDict):
epochs: int
batch_size: int
loss_criterion: nn.Module
accuracy_criterion: nn.Module
optimizer: nn.Module
early_stopping: EarlyStopping
metrics_filename: NotRequired[str]


class TrainingMetrics(TypedDict):
train_loss: List[float]
validation_loss: List[float]
Expand Down