Instructions to use agentscope-ai/Piccolo-0.8B-VL with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use agentscope-ai/Piccolo-0.8B-VL with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="agentscope-ai/Piccolo-0.8B-VL", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("agentscope-ai/Piccolo-0.8B-VL", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use agentscope-ai/Piccolo-0.8B-VL with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "agentscope-ai/Piccolo-0.8B-VL" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "agentscope-ai/Piccolo-0.8B-VL", "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" } } ] } ] }'Use Docker
docker model run hf.co/agentscope-ai/Piccolo-0.8B-VL
- SGLang
How to use agentscope-ai/Piccolo-0.8B-VL with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "agentscope-ai/Piccolo-0.8B-VL" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "agentscope-ai/Piccolo-0.8B-VL", "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" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "agentscope-ai/Piccolo-0.8B-VL" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "agentscope-ai/Piccolo-0.8B-VL", "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" } } ] } ] }' - Docker Model Runner
How to use agentscope-ai/Piccolo-0.8B-VL with Docker Model Runner:
docker model run hf.co/agentscope-ai/Piccolo-0.8B-VL
Piccolo-0.8B-VL
Piccolo-0.8B-VL is a vision-language model checkpoint with the Qwen3_5ForConditionalGeneration architecture and a vision configuration.
This release contains Safetensors weights: 1 main shard and model-frozen-mtp.safetensors. Both weight files are referenced by model.safetensors.index.json. The original model, generation, tokenizer and processor configurations and chat template are included.
Requirements
Python 3.12 or newer and a CUDA-capable GPU are required for the example below. Save this list as requirements.txt.
torch>=2.11
torchvision
transformers==5.19.0
safetensors>=0.8
pydantic>=2.0
Pillow>=11.3.0
httpx>=0.27.0
jinja2>=3.1.0
opencv-python-headless
pyclipper
causal-conv1d==1.7.0
flash-linear-attention>=0.6.0
huggingface_hub
numpy
Usage
This example uses a local models/Piccolo-9B-VL checkpoint and an invoice.png image in the current directory.
import base64
from pathlib import Path
import torch
from huggingface_hub import snapshot_download
from transformers import AutoModel, AutoProcessor
model_path = "models/Piccolo-9B-VL"
image_path = Path("invoice.png")
device = "cuda:0"
payload = {
"state": {"image": "photo"},
"questions": {
"q": {
"type": "noul",
"instructions": "Does the image contain the word 'Invoice'?",
},
},
"assets": {
"photo": {
"type": "image",
"format": "png",
"data_base64": base64.b64encode(image_path.read_bytes()).decode("ascii"),
},
},
}
processor = AutoProcessor.from_pretrained(model_path, trust_remote_code=True)
model = AutoModel.from_pretrained(
model_path,
trust_remote_code=True,
dtype=torch.bfloat16,
attn_implementation="sdpa",
).to(device).eval()
detector_path = snapshot_download("PaddlePaddle/PP-OCRv5_mobile_det_safetensors")
recognizer_path = snapshot_download("PaddlePaddle/en_PP-OCRv5_mobile_rec_safetensors")
ocr = processor.load_ocr(detector_path, recognizer_path, device=device)
with torch.inference_mode():
for item in processor.encode_request(payload, ocr=ocr):
result = model(**item.inputs.to(model.device))
probabilities = dict(zip(item.option_keys, result.probabilities[0].tolist()))
print(item.question_id, probabilities)
- Downloads last month
- 116