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
_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,
) -> Optional[Module]
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_reward_model ¶
Subclass an existing vLLM model to support reward modeling.
By default, we return the hidden states of each token directly.
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
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 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
|