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
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 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 |
|