库名称: vllm
支持语言:
- 阿拉伯语
- 德语
- 英语
- 西班牙语
- 法语
- 印地语
- 印尼语
- 意大利语
- 葡萄牙语
- 泰语
- 他加禄语
- 越南语
基础模型:
- meta-llama/Llama-4-Scout-17B-16E-Instruct
任务类型: 图文生成
标签:
- facebook
- meta
- pytorch
- llama
- llama4
- neuralmagic
- redhat
- llmcompressor
- 量化版
- W4A16
- INT4
许可证类型: 其他
许可证名称: llama4
Llama-4-Scout-17B-16E-Instruct量化版.w4a16
模型概览
- 模型架构: Llama4条件生成模型
- 模型优化:
- 发布日期: 2025年4月25日
- 版本: 1.0
- 开发团队: 红帽(Neural Magic)
优化说明
本模型通过对Llama-4-Scout-17B-16E-Instruct进行INT4权重量化获得。
该优化将权重表示从16位降至4位,显存需求降低约75%,磁盘空间需求同步减少75%。量化过程使用llm-compressor库实现。
部署方案
本模型可高效部署于vLLM、红帽企业Linux AI和Openshift AI平台,示例如下:
vLLM部署示例
from vllm import LLM, SamplingParams
from transformers import AutoTokenizer
model_id = "RedHatAI/Llama-4-Scout-17B-16E-Instruct-quantized.w4a16"
gpu数量 = 4
采样参数 = SamplingParams(温度=0.7, 最高概率=0.8, 最大令牌数=256)
分词器 = AutoTokenizer.from_pretrained(model_id)
提示词 = "请简要介绍大语言模型。"
大模型 = LLM(model=model_id, tensor_parallel_size=gpu数量)
输出结果 = 大模型.generate(提示词, 采样参数)
生成文本 = 输出结果[0].outputs[0].text
print(生成文本)
vLLM同时支持OpenAI兼容服务,详见官方文档。
红帽AI推理服务器部署
$ podman run --rm -it --device nvidia.com/gpu=all -p 8000:8000 \
--ipc=host \
--env "HUGGING_FACE_HUB_TOKEN=$HF_TOKEN" \
--env "HF_HUB_OFFLINE=0" -v ~/.cache/vllm:/home/vllm/.cache \
--name=vllm \
registry.access.redhat.com/rhaiis/rh-vllm-cuda \
vllm serve \
--tensor-parallel-size 8 \
--max-model-len 32768 \
--enforce-eager --model RedHatAI/Llama-4-Scout-17B-16E-Instruct-quantized.w4a16
详见红帽AI推理服务器文档。
红帽企业Linux AI部署
ilab model download --repository docker://registry.redhat.io/rhelai1/llama-4-scout-17b-16e-instruct-quantized-w4a16:1.5
ilab model serve --model-path ~/.cache/instructlab/models/llama-4-scout-17b-16e-instruct-quantized-w4a16
ilab model chat --model ~/.cache/instructlab/models/llama-4-scout-17b-16e-instruct-quantized-w4a16
详见红帽企业Linux AI文档。
红帽Openshift AI部署
apiVersion: serving.kserve.io/v1alpha1
kind: ServingRuntime
metadata:
name: vllm-cuda-runtime
annotations:
openshift.io/display-name: vLLM NVIDIA GPU服务运行时
opendatahub.io/recommended-accelerators: '["nvidia.com/gpu"]'
labels:
opendatahub.io/dashboard: 'true'
spec:
annotations:
prometheus.io/port: '8080'
prometheus.io/path: '/metrics'
multiModel: false
supportedModelFormats:
- autoSelect: true
name: vLLM
containers:
- name: kserve-container
image: quay.io/modh/vllm:rhoai-2.20-cuda
command:
- python
- -m
- vllm.entrypoints.openai.api_server
args:
- "--port=8080"
- "--model=/mnt/models"
- "--served-model-name={{.Name}}"
env:
- name: HF_HOME
value: /tmp/hf_home
ports:
- containerPort: 8080
protocol: TCP
apiVersion: serving.kserve.io/v1beta1
kind: InferenceService
metadata:
annotations:
openshift.io/display-name: Llama-4-Scout-17B-16E-Instruct量化版
serving.kserve.io/deploymentMode: RawDeployment
name: Llama-4-Scout-17B-16E-Instruct-quantized.w4a16
labels:
opendatahub.io/dashboard: 'true'
spec:
predictor:
maxReplicas: 1
minReplicas: 1
model:
modelFormat:
name: vLLM
name: ''
resources:
limits:
cpu: '2'
memory: 8Gi
nvidia.com/gpu: '1'
requests:
cpu: '1'
memory: 4Gi
nvidia.com/gpu: '1'
runtime: vllm-cuda-runtime
storageUri: oci://registry.redhat.io/rhelai1/modelcar-llama-4-scout-17b-16e-instruct-quantized-w4a16:1.5
tolerations:
- effect: NoSchedule
key: nvidia.com/gpu
operator: Exists
oc apply -f vllm-servingruntime.yaml
oc apply -f qwen-inferenceservice.yaml
curl https://<推理服务名称>-predictor-default.<域名>/v1/chat/completions
-H "Content-Type: application/json" \
-d '{
"model": "Llama-4-Scout-17B-16E-Instruct-quantized.w4a16",
"stream": true,
"stream_options": {
"include_usage": true
},
"max_tokens": 1,
"messages": [
{
"role": "user",
"content": "蜜蜂翅膀这么小是如何飞行的?"
}
]
}'
详见红帽Openshift AI文档。