vllm.transformers_utils.processors.qwen3_asr ¶
Qwen3ASRProcessor ¶
Bases: ProcessorMixin
Constructs a Qwen3ASR processor. [Qwen3ASRProcessor] offers all the functionalities of [WhisperFeatureExtractor], and [Qwen2TokenizerFast]. See the [~Qwen3ASRProcessor.__call__] and [~Qwen3ASRProcessor.decode] for more information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature_extractor | [`WhisperFeatureExtractor`], *optional* | The audio feature extractor. | None |
tokenizer | [`Qwen2TokenizerFast`], *optional* | The text tokenizer. | None |
chat_template | `Optional[str]`, *optional* | The Jinja template to use for formatting the conversation. If not provided, the default chat template is used. | None |
Source code in vllm/transformers_utils/processors/qwen3_asr.py
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 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
feature_extractor_class class-attribute instance-attribute ¶
tokenizer_class class-attribute instance-attribute ¶
__call__ ¶
Main method to prepare for the model one or several sequences(s) and audio(s). This method forwards the text and kwargs arguments to Qwen2TokenizerFast's [~Qwen2TokenizerFast.__call__] if text is not None to encode the text. To prepare the audio(s), this method forwards the audio and kwargs arguments to WhisperFeatureExtractor's [~WhisperFeatureExtractor.__call__] if audio is not None. Please refer to the doctsring of the above two methods for more information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text | `str`, `List[str]`, `List[List[str]]` | The sequence or batch of sequences to be encoded. Each sequence can be a string or a list of strings (pretokenized string). If the sequences are provided as list of strings (pretokenized), you must set | None |
audio | `np.ndarray`, `List[np.ndarray]` | The audio or batch of audio to be prepared. Each audio can be a NumPy array. | None |
Source code in vllm/transformers_utils/processors/qwen3_asr.py
__init__ ¶
Source code in vllm/transformers_utils/processors/qwen3_asr.py
apply_chat_template ¶
get_chunked_index ¶
Splits token index list into chunks based on token value ranges.
Given a list of token indices, returns a list of (start, end) index tuples representing slices of the list where the token values fall within successive ranges of tokens_per_chunk.
For example, if tokens_per_chunk is 1000, the function will create chunks such that: - the first chunk contains token values < 1000, - the second chunk contains values >= 1000 and < 2000, and so on.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token_indices | `np.ndarray` | A monotonically increasing list of token index values. | required |
tokens_per_chunk | `int` | Number of tokens per chunk (used as the chunk size threshold). | required |
Returns:
| Type | Description |
|---|---|
list[tuple[int, int]] |
|
Source code in vllm/transformers_utils/processors/qwen3_asr.py
replace_multimodal_special_tokens ¶
Source code in vllm/transformers_utils/processors/qwen3_asr.py
Qwen3ASRProcessorKwargs ¶
Bases: ProcessingKwargs
Source code in vllm/transformers_utils/processors/qwen3_asr.py
_defaults class-attribute instance-attribute ¶
_defaults = {
"text_kwargs": {
"padding": False,
"padding_side": "left",
},
"audio_kwargs": {
"sampling_rate": 16000,
"padding": True,
"return_attention_mask": True,
},
}
_get_feat_extract_output_lengths ¶
Computes the output length of the convolutional layers and the output length of the audio encoder