guidellm.data
ConcatenatePreprocessStrategyArgs
Bases: PreprocessStrategyArgs
Concatenate successive short prompts until the target length is reached.
Source code in src/guidellm/data/schemas/preprocess.py
DataArgs
Bases: PydanticClassRegistryMixin['DataArgs'], ABC
Base class for data loading and processing argument models.
This class serves as a base for defining argument models related to data loading and processing. It inherits from PydanticClassRegistryMixin to enable automatic registration of subclasses, allowing for flexible and extensible data handling configurations.
Attributes:
| Name | Type | Description |
|---|---|---|
schema_discriminator | str | Field name for polymorphic deserialization |
Source code in src/guidellm/data/schemas/entrypoints.py
__pydantic_schema_base_type__() classmethod
Return base type for polymorphic validation hierarchy.
Returns:
| Type | Description |
|---|---|
type[DataArgs] | Base Profile class for schema validation |
Source code in src/guidellm/data/schemas/entrypoints.py
DataFinalizerArgs
Bases: PydanticClassRegistryMixin['DataFinalizerArgs'], ABC
Base class for data finalizer argument models.
This class serves as a base for defining arguments related to data finalization configurations. It inherits from PydanticClassRegistryMixin to enable automatic registration of subclasses, allowing for flexible and extensible data finalization configurations.
Attributes:
| Name | Type | Description |
|---|---|---|
schema_discriminator | str | Field name for polymorphic deserialization |
Source code in src/guidellm/data/schemas/entrypoints.py
__pydantic_schema_base_type__() classmethod
Return base type for polymorphic validation hierarchy.
Returns:
| Type | Description |
|---|---|
type[DataFinalizerArgs] | Base DataFinalizerArgs class for schema validation |
Source code in src/guidellm/data/schemas/entrypoints.py
DataLoaderArgs
Bases: PydanticClassRegistryMixin['DataLoaderArgs'], ABC
Base class for data loader argument models.
This class serves as a base for defining argument models related to data loading configurations. It inherits from PydanticClassRegistryMixin to enable automatic registration of subclasses, allowing for flexible and extensible data loading configurations.
Attributes:
| Name | Type | Description |
|---|---|---|
schema_discriminator | str | Field name for polymorphic deserialization |
Source code in src/guidellm/data/schemas/entrypoints.py
__pydantic_schema_base_type__() classmethod
Return base type for polymorphic validation hierarchy.
Returns:
| Type | Description |
|---|---|
type[DataLoaderArgs] | Base DataLoaderArgs class for schema validation |
Source code in src/guidellm/data/schemas/entrypoints.py
DataLoaderRegistry
Bases: Generic[DataT_co], RegistryMixin[type[DataLoader]]
Source code in src/guidellm/data/loaders/loader.py
create(config, datasets, preprocessors, finalizer, random_seed, **kwargs) classmethod
Factory method to create a DataLoader instance based on provided configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config | DataLoaderArgs | A DataEntrypointArgs object containing the configuration. | required |
Source code in src/guidellm/data/loaders/loader.py
DataNotSupportedError
DataPreprocessorArgs
Bases: PydanticClassRegistryMixin['DataPreprocessorArgs'], ABC
Base class for data preprocessor argument models.
This class serves as a base for defining arguments related to data preprocessing configurations. It inherits from PydanticClassRegistryMixin to enable automatic registration of subclasses, allowing for flexible and extensible data preprocessing configurations.
Attributes:
| Name | Type | Description |
|---|---|---|
schema_discriminator | str | Field name for polymorphic deserialization |
Source code in src/guidellm/data/schemas/entrypoints.py
__pydantic_schema_base_type__() classmethod
Return base type for polymorphic validation hierarchy.
Returns:
| Type | Description |
|---|---|
type[DataPreprocessorArgs] | Base DataPreprocessorArgs class for schema validation |
Source code in src/guidellm/data/schemas/entrypoints.py
DataTokenizerArgs
Bases: PydanticClassRegistryMixin['DataTokenizerArgs'], ABC
Base class for data tokenizer argument models.
This class serves as a base for defining arguments related to data tokenization configurations. It inherits from PydanticClassRegistryMixin to enable automatic registration of subclasses, allowing for flexible and extensible data tokenization configurations.
Attributes:
| Name | Type | Description |
|---|---|---|
schema_discriminator | str | Field name for polymorphic deserialization |
Source code in src/guidellm/data/schemas/entrypoints.py
__pydantic_schema_base_type__() classmethod
Return base type for polymorphic validation hierarchy.
Returns:
| Type | Description |
|---|---|
type[DataTokenizerArgs] | Base DataTokenizerArgs class for schema validation |
Source code in src/guidellm/data/schemas/entrypoints.py
DatasetFinalizer
Bases: Protocol[DataT_co]
Protocol for finalizing dataset rows into a desired data type.
Source code in src/guidellm/data/finalizers/finalizer.py
ErrorPreprocessStrategyArgs
Bases: PreprocessStrategyArgs
Raise an error when a prompt is shorter than the target length.
Source code in src/guidellm/data/schemas/preprocess.py
FinalizerRegistry
Bases: RegistryMixin[type[DatasetFinalizer]]
Source code in src/guidellm/data/finalizers/finalizer.py
create(config) classmethod
Factory method to create a DatasetFinalizer instance based on configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config | DataFinalizerArgs | A DataFinalizerArgs object containing the configuration. | required |
Source code in src/guidellm/data/finalizers/finalizer.py
GenerativeRequestFinalizer
Bases: DatasetFinalizer[Iterable[tuple[GenerationRequest, RequestSettings]]]
Finalizer that converts dataset rows into GenerationRequest objects, aggregating usage metrics from the provided columns.
Source code in src/guidellm/data/finalizers/generative.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
GenerativeRequestFinalizerArgs
Bases: DataFinalizerArgs
Model for generative request finalizer arguments.
Source code in src/guidellm/data/finalizers/generative.py
IgnorePreprocessStrategyArgs
Bases: PreprocessStrategyArgs
Skip prompts that are shorter than the target token length.
Source code in src/guidellm/data/schemas/preprocess.py
PadPreprocessStrategyArgs
Bases: PreprocessStrategyArgs
Pad short prompts with a character until the target length is reached.
Source code in src/guidellm/data/schemas/preprocess.py
PreprocessStrategyArgs
Bases: PydanticClassRegistryMixin['PreprocessStrategyArgs'], ABC
Base class for dataset preprocessing strategy configurations.
Combines target token-count settings with a short-prompt handling strategy selected by kind. Subclasses encapsulate strategy-specific options and short-prompt handling logic.
Source code in src/guidellm/data/schemas/preprocess.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | |
__pydantic_schema_base_type__() classmethod
Return base type for polymorphic validation hierarchy.
Returns:
| Type | Description |
|---|---|
type[PreprocessStrategyArgs] | Base PreprocessStrategyArgs class for schema validation |
Source code in src/guidellm/data/schemas/preprocess.py
handle_short_prompt(current_prompt, min_prompt_tokens, tokenizer, *, dataset_iterator=None, prompt_column=None) abstractmethod
Apply this strategy when a prompt is shorter than the target length.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
current_prompt | str | The input prompt string. | required |
min_prompt_tokens | int | Minimum required token count. | required |
tokenizer | PreTrainedTokenizerBase | Tokenizer used to count tokens. | required |
dataset_iterator | Iterator[dict[str, Any]] | None | Optional iterator for strategies that consume additional rows (e.g. concatenate). | None |
prompt_column | str | None | Optional prompt column name for row extraction. | None |
Returns:
| Type | Description |
|---|---|
str | None | Adjusted prompt text, or None to skip the row. |
Source code in src/guidellm/data/schemas/preprocess.py
PreprocessorRegistry
Bases: RegistryMixin[type[DatasetPreprocessor] | type[DataDependentPreprocessor]]
Source code in src/guidellm/data/preprocessors/preprocessor.py
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
PromptTooShortError
TorchDataLoaderArgs
Bases: DataLoaderArgs
Model for PyTorch data loader arguments.
Source code in src/guidellm/data/loaders/torch.py
create_data_loader(loader_config, data_config, tokenizer_config, column_mapper_config, preprocessors_config, finalizer_config, random_seed=42, console=None) async
Factory function to create a DataLoader instance based on provided configurations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loader_config | DataLoaderArgs | Configuration for the data loader. | required |
data_config | list[DataArgs] | List of configurations for dataset deserialization. | required |
tokenizer_config | DataTokenizerArgs | Configuration for the tokenizer factory. | required |
column_mapper_config | DataPreprocessorArgs | Configuration for the column mapping preprocessor. | required |
preprocessors_config | list[DataPreprocessorArgs] | List of configurations for additional preprocessors. | required |
finalizer_config | DataFinalizerArgs | Configuration for the dataset finalizer. | required |
random_seed | int | Seed for random operations to ensure reproducibility. | 42 |
console | Console | None | Optional Console instance for logging and progress display. | None |
Returns:
| Type | Description |
|---|---|
DataLoader | An instance of DataLoader configured according to the provided arguments. |
Source code in src/guidellm/data/entrypoints.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
process_dataset(data, output_path, tokenizer, strategy, data_column_mapper=None, data_loader=None, push_to_hub=False, hub_dataset_id=None, random_seed=42)
Main method to process and save a dataset with sampled prompt/output token counts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data | DataArgs | dict[str, Any] | Dataset source configuration ( | required |
output_path | str | Path | File path to save the processed dataset. | required |
tokenizer | DataTokenizerArgs | dict[str, Any] | Tokenizer configuration ( | required |
strategy | PreprocessStrategyArgs | dict[str, Any] | Preprocess strategy configuration including token targets and short-prompt handling ( | required |
data_column_mapper | DataPreprocessorArgs | dict[str, Any] | None | Optional column mapping configuration. | None |
data_loader | DataLoaderArgs | dict[str, Any] | None | Optional data loader configuration. | None |
push_to_hub | bool | Whether to push to Hugging Face Hub. | False |
hub_dataset_id | str | None | Dataset ID on Hugging Face Hub. | None |
random_seed | int | Seed for random sampling. | 42 |
Raises:
| Type | Description |
|---|---|
ValueError | If the output path is invalid or pushing conditions unmet. |