MCPcopy Create free account
hub / github.com/allenai/OLMoASR / BaseDatasetLoader

Class BaseDatasetLoader

scripts/eval/eval.py:283–317  ·  view source on GitHub ↗

Abstract base class for dataset loaders. Defines the common interface for all dataset loaders in the evaluation pipeline. Each concrete loader implements dataset-specific logic for loading audio files and their corresponding transcripts. Attributes: root_dir (str): Root dir

Source from the content-addressed store, hash-verified

281
282
283class BaseDatasetLoader(ABC):
284 """Abstract base class for dataset loaders.
285
286 Defines the common interface for all dataset loaders in the evaluation pipeline.
287 Each concrete loader implements dataset-specific logic for loading audio files
288 and their corresponding transcripts.
289
290 Attributes:
291 root_dir (str): Root directory containing the dataset files
292
293 Methods:
294 load: Abstract method to load dataset audio files and transcripts
295 """
296
297 def __init__(self, root_dir: str):
298 """Initialize the dataset loader with root directory.
299
300 Args:
301 root_dir (str): Path to the root directory containing dataset files
302 """
303 self.root_dir = root_dir
304
305 @abstractmethod
306 def load(self) -> Tuple[list, list]:
307 """Load audio files and transcripts from the dataset.
308
309 Returns:
310 Tuple[list, list]: A tuple containing:
311 - List of audio file paths or AudioSegment objects
312 - List of corresponding transcript strings
313
314 Raises:
315 NotImplementedError: If not implemented by concrete subclass
316 """
317 pass
318
319
320class LibrispeechLoader(BaseDatasetLoader):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected