Create appropriate dataset loader for the specified evaluation set. Factory method that instantiates the correct dataset loader class based on the evaluation set name. Provides type safety and centralized loader management. Args: eval_set (str): Name of the eval
(cls, eval_set: str, root_dir: str)
| 945 | |
| 946 | @classmethod |
| 947 | def create_loader(cls, eval_set: str, root_dir: str) -> BaseDatasetLoader: |
| 948 | """Create appropriate dataset loader for the specified evaluation set. |
| 949 | |
| 950 | Factory method that instantiates the correct dataset loader class based on |
| 951 | the evaluation set name. Provides type safety and centralized loader management. |
| 952 | |
| 953 | Args: |
| 954 | eval_set (str): Name of the evaluation dataset (must be in supported list) |
| 955 | root_dir (str): Root directory path containing the dataset files |
| 956 | |
| 957 | Returns: |
| 958 | BaseDatasetLoader: Instantiated dataset loader for the specified eval_set |
| 959 | |
| 960 | Raises: |
| 961 | ValueError: If eval_set is not in the supported datasets registry |
| 962 | |
| 963 | Example: |
| 964 | >>> loader = DatasetFactory.create_loader("librispeech_clean", "/data/libri") |
| 965 | >>> audio_files, transcripts = loader.load() |
| 966 | >>> print(f"Loaded {len(audio_files)} audio files") |
| 967 | """ |
| 968 | if eval_set not in cls._loaders: |
| 969 | raise ValueError(f"Unknown eval_set: {eval_set}") |
| 970 | return cls._loaders[eval_set](root_dir) |
| 971 | |
| 972 | |
| 973 | # Legacy classes for backwards compatibility |
no outgoing calls
no test coverage detected