vllm.model_executor.models.adapters ¶
SEQ_CLS_LOAD_METHODS module-attribute ¶
SEQ_CLS_LOAD_METHODS = {
"from_2_way_softmax": load_weights_using_from_2_way_softmax,
"no_post_processing": load_weights_no_post_processing,
}
_GENERATE_SUFFIXES module-attribute ¶
SequenceClassificationConfig ¶
Bases: VerifyAndUpdateConfig
Source code in vllm/model_executor/models/adapters.py
verify_and_update_config staticmethod ¶
verify_and_update_config(vllm_config: VllmConfig) -> None
Source code in vllm/model_executor/models/adapters.py
_create_pooling_model_cls ¶
Source code in vllm/model_executor/models/adapters.py
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 | |
_disable_seq_cls_loading_on_inner_model ¶
_disable_seq_cls_loading_on_inner_model(
language_model, is_vlm: bool
)
Context manager to temporarily disable sequence classification loading on inner VLM models to prevent recursive seq_cls_model_loader calls.
Source code in vllm/model_executor/models/adapters.py
_get_language_model_for_seq_cls ¶
_get_language_model_for_seq_cls(model) -> Module
Get the language model component for sequence classification conversion. For VLMs, returns the inner language model. For standard LLMs, returns model itself.
Source code in vllm/model_executor/models/adapters.py
_get_pooling_model_name ¶
Source code in vllm/model_executor/models/adapters.py
_load_dense_weights ¶
_load_dense_weights(
linear: Linear, folder: str, model_config: ModelConfig
) -> bool
Load weights using vLLM's weight_loader pattern.
Source code in vllm/model_executor/models/adapters.py
_load_st_projector ¶
_load_st_projector(
model_config: ModelConfig,
) -> Module | None
Load Sentence-Transformers Dense projection layers.
Source code in vllm/model_executor/models/adapters.py
as_embedding_model ¶
Subclass an existing vLLM model to support embeddings.
By default, the embeddings of the whole prompt are extracted from the normalized hidden state corresponding to the last token.
Note
We assume that no extra layers are added to the original model; please implement your own model if this is not the case.
Source code in vllm/model_executor/models/adapters.py
as_seq_cls_model ¶
Subclass an existing vLLM model to support classify and score tasks.
By default, the class probabilities are extracted from the softmaxed hidden state corresponding to the last token.
Note
We assume that the classification head is a single linear layer stored as the attribute score of the top-level model; please implement your own model if this is not the case.
Source code in vllm/model_executor/models/adapters.py
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | |
load_weights_no_post_processing ¶
Source code in vllm/model_executor/models/adapters.py
load_weights_using_from_2_way_softmax ¶
Source code in vllm/model_executor/models/adapters.py
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 | |