支持的模型:https://docs.vllm.ai/en/latest/models/supported_models.html
要确定是否支持给定模型,您可以检查HF存储库中的config.json
文件。
如果"architectures"
字段包含下面列出的模型架构,那么理论上应该支持它。
查看 模型的 config.json
中的 architectures
cat ~/.cache/huggingface/hub/models--deepseek-ai--DeepSeek-R1-Distill-Qwen-32B/snapshots/3865e12a1eb7cbd641ab3f9dfc28c588c6b0c1e9
DeepSeek-R1-Distill-Qwen-32B
architectures 为 Qwen2ForCausalLM
{
"architectures": [
"Qwen2ForCausalLM"
],
"attention_dropout": 0.0,
"bos_token_id": 151643,
"eos_token_id": 151643,
"hidden_act": "silu",
"hidden_size": 5120,
"initializer_range": 0.02,
"intermediate_size": 27648,
"max_position_embeddings": 131072,
"max_window_layers": 64,
"model_type": "qwen2",
"num_attention_heads": 40,
"num_hidden_layers": 64,
"num_key_value_heads": 8,
"rms_norm_eps": 1e-05,
"rope_theta": 1000000.0,
"sliding_window": 131072,
"tie_word_embeddings": false,
"torch_dtype": "bfloat16",
"transformers_version": "4.43.1",
"use_cache": true,
"use_sliding_window": false,
"vocab_size": 152064
}
**Alibaba-NLP–gte-Qwen2-7B-instruct ** – Qwen2ForCausalLM
{
"architectures": [
"Qwen2ForCausalLM"
],
"attention_dropout": 0.0,
"auto_map": {
"AutoModel": "modeling_qwen.Qwen2Model",
"AutoModelForCausalLM": "modeling_qwen.Qwen2ForCausalLM",
"AutoModelForSequenceClassification": "modeling_qwen.Qwen2ForSequenceClassification"
},
"bos_token_id": 151643,
"eos_token_id": 151643,
"hidden_act": "silu",
"hidden_size": 3584,
"initializer_range": 0.02,
"intermediate_size": 18944,
"max_position_embeddings": 131072,
"max_window_layers": 28,
"model_type": "qwen2",
"num_attention_heads": 28,
"num_hidden_layers": 28,
"num_key_value_heads": 4,
"rms_norm_eps": 1e-06,
"rope_theta": 1000000.0,
"sliding_window": 131072,
"tie_word_embeddings": false,
"torch_dtype": "float32",
"transformers_version": "4.41.2",
"use_cache": true,
"use_sliding_window": false,
"vocab_size": 151646
}
就是直接运行
from vllm import LLM
# For generative models (task=generate) only
llm = LLM(model=..., task="generate") # Name or path of your model
output = llm.generate("Hello, my name is")
print(output)
# For pooling models (task={embed,classify,reward,score}) only
llm = LLM(model=..., task="embed") # Name or path of your model
output = llm.encode("Hello, my name is")
print(output)
from vllm import LLM
model_name = 'deepseek-ai/DeepSeek-R1-Distill-Qwen-32B'
model_name = 'Qwen/Qwen2.5-Coder-7B-Instruct'
model_name = 'Qwen/Qwen2.5-Coder-32B-Instruct-GPTQ-Int4'
llm = LLM(model=model_name, task="generate") # Name or path of your model
output = llm.generate("Hello, my name is")
print(output)