vllm.entrypoints.speech_to_text.translation.protocol ¶
Classes:
-
TranslationRequest– -
TranslationResponse– -
TranslationResponseVerbose– -
TranslationSegment– -
TranslationWord–
TranslationRequest ¶
Bases: OpenAIBaseModel
Attributes:
-
file(UploadFile) –The audio file object (not file name) to translate, in one of these
-
hotwords(str | None) –hotwords refers to a list of important words or phrases that the model
-
include_stop_str_in_output(bool) –Whether to include the stop strings in output text.
-
language(str | None) –The language of the input audio we translate from.
-
length_penalty(float) –Length penalty to be used for beam search.
-
max_completion_tokens(int | None) –The maximum number of tokens to generate.
-
model(str | None) –ID of the model to use.
-
n(int) –The number of beams to be used in beam search.
-
prompt(str) –An optional text to guide the model's style or continue a previous audio
-
response_format(AudioResponseFormat) –The format of the output, in one of these options:
json,text,srt, -
seed(int | None) –The seed to use for sampling.
-
stream(bool | None) –Custom field not present in the original OpenAI definition. When set,
-
temperature(float) –The sampling temperature, between 0 and 1.
-
to_language(str | None) –The language of the input audio we translate to.
-
use_beam_search(bool) –Whether or not beam search should be used.
Source code in vllm/entrypoints/speech_to_text/translation/protocol.py
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 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
file instance-attribute ¶
The audio file object (not file name) to translate, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
hotwords = None class-attribute instance-attribute ¶
hotwords refers to a list of important words or phrases that the model should pay extra attention to during transcription.
include_stop_str_in_output = False class-attribute instance-attribute ¶
Whether to include the stop strings in output text.
language = None class-attribute instance-attribute ¶
The language of the input audio we translate from.
Supplying the input language in ISO-639-1 format will improve accuracy.
length_penalty = 1.0 class-attribute instance-attribute ¶
Length penalty to be used for beam search.
max_completion_tokens = None class-attribute instance-attribute ¶
The maximum number of tokens to generate.
model = None class-attribute instance-attribute ¶
ID of the model to use.
n = 1 class-attribute instance-attribute ¶
The number of beams to be used in beam search.
prompt = Field(default='') class-attribute instance-attribute ¶
An optional text to guide the model's style or continue a previous audio segment.
The prompt should match the audio language.
response_format = Field(default='json') class-attribute instance-attribute ¶
The format of the output, in one of these options: json, text, srt, verbose_json, or vtt.
seed = Field(None, ge=(_LONG_INFO.min), le=(_LONG_INFO.max)) class-attribute instance-attribute ¶
The seed to use for sampling.
stream = False class-attribute instance-attribute ¶
Custom field not present in the original OpenAI definition. When set, it will enable output to be streamed in a similar fashion as the Chat Completion endpoint.
temperature = Field(default=0.0) class-attribute instance-attribute ¶
The sampling temperature, between 0 and 1.
Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused / deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.
to_language = None class-attribute instance-attribute ¶
The language of the input audio we translate to.
Please note that this is not supported by all models, refer to the specific model documentation for more details. For instance, Whisper only supports to_language=en.
use_beam_search = False class-attribute instance-attribute ¶
Whether or not beam search should be used.
TranslationResponse ¶
TranslationResponseVerbose ¶
Bases: OpenAIBaseModel
Attributes:
-
duration(str) –The duration of the input audio.
-
language(str) –The language of the input audio.
-
segments(list[TranslationSegment] | None) –Segments of the translated text and their corresponding details.
-
text(str) –The translated text.
-
words(list[TranslationWord] | None) –Extracted words and their corresponding timestamps.
Source code in vllm/entrypoints/speech_to_text/translation/protocol.py
duration instance-attribute ¶
The duration of the input audio.
language instance-attribute ¶
The language of the input audio.
segments = None class-attribute instance-attribute ¶
Segments of the translated text and their corresponding details.
text instance-attribute ¶
The translated text.
words = None class-attribute instance-attribute ¶
Extracted words and their corresponding timestamps.
TranslationSegment ¶
Bases: OpenAIBaseModel
Attributes:
-
avg_logprob(float) –Average logprob of the segment.
-
compression_ratio(float) –Compression ratio of the segment.
-
end(float) –End time of the segment in seconds.
-
id(int) –Unique identifier of the segment.
-
no_speech_prob(float | None) –Probability of no speech in the segment.
-
seek(int) –Seek offset of the segment.
-
start(float) –Start time of the segment in seconds.
-
temperature(float) –Temperature parameter used for generating the segment.
-
text(str) –Text content of the segment.
-
tokens(list[int]) –Array of token IDs for the text content.
Source code in vllm/entrypoints/speech_to_text/translation/protocol.py
avg_logprob instance-attribute ¶
Average logprob of the segment.
If the value is lower than -1, consider the logprobs failed.
compression_ratio instance-attribute ¶
Compression ratio of the segment.
If the value is greater than 2.4, consider the compression failed.
end instance-attribute ¶
End time of the segment in seconds.
id instance-attribute ¶
Unique identifier of the segment.
no_speech_prob = None class-attribute instance-attribute ¶
Probability of no speech in the segment.
If the value is higher than 1.0 and the avg_logprob is below -1, consider this segment silent.
seek instance-attribute ¶
Seek offset of the segment.
start instance-attribute ¶
Start time of the segment in seconds.
temperature instance-attribute ¶
Temperature parameter used for generating the segment.
text instance-attribute ¶
Text content of the segment.
tokens instance-attribute ¶
Array of token IDs for the text content.