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
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 230 231 232 233 234 235 236 | |
_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 ¶
as_seq_cls_model(cls: _T" backlink-type="used-by" backlink-anchor="vllm.model_executor.models.adapters.as_seq_cls_model" optional hover>_T) -> _T
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
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 | |