chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Any, Dict, Iterator, Tuple
|
||||
import logging
|
||||
|
||||
import torch
|
||||
|
||||
from config import BenchmarkConfig, DataLoaderConfig
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class BaseDataLoaderFactory(ABC):
|
||||
"""Base class for creating and managing dataloaders."""
|
||||
|
||||
def __init__(self, benchmark_config: BenchmarkConfig):
|
||||
self.benchmark_config = benchmark_config
|
||||
|
||||
def get_dataloader_config(self) -> DataLoaderConfig:
|
||||
return self.benchmark_config.dataloader_config
|
||||
|
||||
@abstractmethod
|
||||
def get_train_dataloader(self) -> Iterator[Tuple[torch.Tensor, torch.Tensor]]:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_val_dataloader(self) -> Iterator[Tuple[torch.Tensor, torch.Tensor]]:
|
||||
pass
|
||||
|
||||
def get_metrics(self) -> Dict[str, Any]:
|
||||
"""Return metrics about dataloader performance."""
|
||||
return {}
|
||||
Reference in New Issue
Block a user