Bases: RegistryMixin[type[DatasetPreprocessor] | type[DataDependentPreprocessor]]
Source code in src/guidellm/data/preprocessors/preprocessor.py
| class PreprocessorRegistry(
RegistryMixin[type[DatasetPreprocessor] | type[DataDependentPreprocessor]]
):
@classmethod
def create(cls, config: DataPreprocessorArgs) -> DatasetPreprocessor:
"""
Factory method to create a DatasetPreprocessor instance based on configuration.
:param config: A DataPreprocessorArgs object containing the configuration.
"""
kind = config.kind
preprocessor_cls = cls.get_registered_object(kind)
if preprocessor_cls is None:
raise ValueError(
f"DatasetPreprocessor type '{kind}' is not registered."
f"Available types: {list(cls.registry.keys()) if cls.registry else []}"
)
return preprocessor_cls(config)
|
create(config) classmethod
Factory method to create a DatasetPreprocessor instance based on configuration.
Parameters:
| Name | Type | Description | Default |
config | DataPreprocessorArgs | A DataPreprocessorArgs object containing the configuration. | required |
Source code in src/guidellm/data/preprocessors/preprocessor.py
| @classmethod
def create(cls, config: DataPreprocessorArgs) -> DatasetPreprocessor:
"""
Factory method to create a DatasetPreprocessor instance based on configuration.
:param config: A DataPreprocessorArgs object containing the configuration.
"""
kind = config.kind
preprocessor_cls = cls.get_registered_object(kind)
if preprocessor_cls is None:
raise ValueError(
f"DatasetPreprocessor type '{kind}' is not registered."
f"Available types: {list(cls.registry.keys()) if cls.registry else []}"
)
return preprocessor_cls(config)
|