guidellm.schemas.data.preprocess
Preprocess strategy argument models and short-prompt handlers.
ConcatenatePreprocessStrategyArgs
Bases: PreprocessStrategyArgs
Concatenate successive short prompts until the target length is reached.
Source code in src/guidellm/schemas/data/preprocess.py
ErrorPreprocessStrategyArgs
Bases: PreprocessStrategyArgs
Raise an error when a prompt is shorter than the target length.
Source code in src/guidellm/schemas/data/preprocess.py
IgnorePreprocessStrategyArgs
Bases: PreprocessStrategyArgs
Skip prompts that are shorter than the target token length.
Source code in src/guidellm/schemas/data/preprocess.py
PadPreprocessStrategyArgs
Bases: PreprocessStrategyArgs
Pad short prompts with a character until the target length is reached.
Source code in src/guidellm/schemas/data/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/schemas/data/preprocess.py
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 149 150 | |
__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/schemas/data/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. |