测试gemma-3-4b-it小模型
·
huggingface-cli login
# Install vLLM from pip:
pip install vllm
# Load and run the model:
vllm serve "google/gemma-3-1b-it"
# Call the server using curl:
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "google/gemma-3-1b-it",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'
使用docker
# Deploy with docker on Linux:
docker run --runtime nvidia --gpus all \
--name my_vllm_container \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HUGGING_FACE_HUB_TOKEN=<secret>" \
-p 8000:8000 \
--ipc=host \
vllm/vllm-openai:latest \
--model google/gemma-3-1b-it
# Load and run the model:
docker exec -it my_vllm_container bash -c "vllm serve google/gemma-3-4b-it"
# Call the server using curl:
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "google/gemma-3-4b-it",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Describe this image in one sentence."
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg"
}
}
]
}
]
}'
更多推荐
所有评论(0)