unitorch.cli.models.vllm¤
QWen3VLLMForGeneration¤
Tip
core/model/vllm/generation/qwen3 is the section for configuration of QWen3VLLMForGeneration.
Bases: VLLMForGeneration
QWen3 text generation model using the vLLM inference engine.
Uses vLLM's offline batch engine for high-throughput inference.
Accepts tokenized input_ids tensors and returns GenerationOutputs
compatible with unitorch-infer.
Source code in src/unitorch/cli/models/vllm/modeling.py
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 | |
from_config
classmethod
¤
from_config(config, **kwargs)
Source code in src/unitorch/cli/models/vllm/modeling.py
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 | |
__call__ ¤
__call__(
input_ids: Tensor,
max_gen_seq_length: Optional[int] = 512,
min_gen_seq_length: Optional[int] = 0,
num_return_sequences: Optional[int] = 1,
num_beams: Optional[int] = 1,
do_sample: Optional[bool] = False,
temperature: Optional[float] = 1.0,
top_k: Optional[int] = 50,
top_p: Optional[float] = 1.0,
repetition_penalty: Optional[float] = 1.0,
stop: Optional[Union[str, List[str]]] = None,
pad_token_id: Optional[int] = 151643,
) -> GenerationOutputs
Generates sequences for the given input token IDs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_ids
|
Tensor
|
Input token ID tensor of shape |
required |
max_gen_seq_length
|
int
|
Maximum tokens to generate. Defaults to 512. |
512
|
min_gen_seq_length
|
int
|
Minimum tokens to generate. Defaults to 0. |
0
|
num_return_sequences
|
int
|
Completions per prompt. Defaults to 1. |
1
|
num_beams
|
int
|
Beam search width. Defaults to 1. |
1
|
do_sample
|
bool
|
Enable sampling. Defaults to False. |
False
|
temperature
|
float
|
Sampling temperature. Defaults to 1.0. |
1.0
|
top_k
|
int
|
Top-k sampling. Defaults to 50. |
50
|
top_p
|
float
|
Top-p sampling. Defaults to 1.0. |
1.0
|
repetition_penalty
|
float
|
Repetition penalty. Defaults to 1.0. |
1.0
|
stop
|
str or List[str]
|
Stop strings. |
None
|
pad_token_id
|
int
|
Token ID used for padding. Defaults to 0. |
151643
|
Returns:
| Name | Type | Description |
|---|---|---|
GenerationOutputs |
GenerationOutputs
|
Sequences tensor of shape |
Source code in src/unitorch/cli/models/vllm/modeling.py
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 | |
QWen3VLVLLMForGeneration¤
Tip
core/model/vllm/generation/qwen3_vl is the section for configuration of QWen3VLVLLMForGeneration.
Bases: VLLMVLForGeneration
QWen3-VL vision-language generation model using the vLLM inference engine.
Uses vLLM's multimodal offline batch engine for high-throughput inference
over text and image inputs. Accepts tokenized input_ids tensors and
pixel-values tensors (or raw PIL.Image) and returns GenerationOutputs
compatible with unitorch-infer.
Source code in src/unitorch/cli/models/vllm/modeling_vl.py
27 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 | |
from_config
classmethod
¤
from_config(config, **kwargs)
Source code in src/unitorch/cli/models/vllm/modeling_vl.py
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 | |
__call__ ¤
__call__(
input_ids: Tensor,
pixel_values: Optional[Tensor] = None,
image_grid_thw: Optional[Tensor] = None,
max_gen_seq_length: Optional[int] = 512,
min_gen_seq_length: Optional[int] = 0,
num_return_sequences: Optional[int] = 1,
do_sample: Optional[bool] = False,
temperature: Optional[float] = 1.0,
top_k: Optional[int] = 50,
top_p: Optional[float] = 1.0,
repetition_penalty: Optional[float] = 1.0,
stop: Optional[Union[str, List[str]]] = None,
pad_token_id: Optional[int] = 151643,
) -> GenerationOutputs
Generates sequences for the given text and image inputs.
Passes already-preprocessed pixel_values (shape (B, num_patches, channels))
and image_grid_thw directly to vLLM via mm_processor_kwargs, bypassing
vLLM's own image pre-processing pipeline so that the unitorch processor output
is used as-is (matching the HuggingFace reference implementation).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_ids
|
Tensor
|
Input token ID tensor of shape |
required |
pixel_values
|
Tensor
|
Pre-processed patch tensor of shape
|
None
|
image_grid_thw
|
Tensor
|
Grid metadata tensor of shape
|
None
|
max_gen_seq_length
|
int
|
Maximum tokens to generate. Defaults to 512. |
512
|
min_gen_seq_length
|
int
|
Minimum tokens to generate. Defaults to 0. |
0
|
num_return_sequences
|
int
|
Completions per prompt. Defaults to 1. |
1
|
do_sample
|
bool
|
Enable sampling. Defaults to False. |
False
|
temperature
|
float
|
Sampling temperature. Defaults to 1.0. |
1.0
|
top_k
|
int
|
Top-k sampling. Defaults to 50. |
50
|
top_p
|
float
|
Top-p sampling. Defaults to 1.0. |
1.0
|
repetition_penalty
|
float
|
Repetition penalty. Defaults to 1.0. |
1.0
|
stop
|
str or List[str]
|
Stop strings. |
None
|
pad_token_id
|
int
|
Token ID used for padding. Defaults to 0. |
151643
|
Returns:
| Name | Type | Description |
|---|---|---|
GenerationOutputs |
GenerationOutputs
|
Sequences tensor of shape |
Source code in src/unitorch/cli/models/vllm/modeling_vl.py
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 | |