Instructions to use wealthcoders/qwen3-vl with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use wealthcoders/qwen3-vl with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="wealthcoders/qwen3-vl") 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 AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("wealthcoders/qwen3-vl") model = AutoModelForMultimodalLM.from_pretrained("wealthcoders/qwen3-vl", device_map="auto") 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?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use wealthcoders/qwen3-vl with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "wealthcoders/qwen3-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": "wealthcoders/qwen3-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/wealthcoders/qwen3-vl
- SGLang
How to use wealthcoders/qwen3-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 "wealthcoders/qwen3-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": "wealthcoders/qwen3-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 "wealthcoders/qwen3-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": "wealthcoders/qwen3-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 wealthcoders/qwen3-vl with Docker Model Runner:
docker model run hf.co/wealthcoders/qwen3-vl
File size: 3,165 Bytes
3fdba7b ca17628 8128625 0ba1f5a 40f9682 8128625 83af6e8 3fdba7b 49630f8 16ceee2 49630f8 3fdba7b 5bdd01a 8128625 ba690ad 8128625 3fdba7b 16ceee2 8128625 3fdba7b 16ceee2 3fdba7b 147fcdd 1fe38b4 bd0b411 1fe38b4 05dd32e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | from transformers import Qwen3VLForConditionalGeneration, AutoProcessor
from typing import Dict, List, Any
import torch
import io
from PIL import Image
import base64
import time
import uuid
prompt = """**Task**:
Analyze this document image exhaustively and output in Markdown format.
**Rules**:
- Do not add any comments, provide content only;
- Extract ALL visible text exactly as written;
- Preserve possible additional languages;
- Maintain line breaks, indentation, and spacing;
- Never translate non-English text.
- Do not add unnecessary or additional information. Do not add any links or images. Do not add Chinese symbols.
**Important**: the output format must be Markdown (use bold text, headlines, so on)."""
class EndpointHandler:
def __init__(self, path: str = "Qwen/Qwen3-VL-8B-Instruct"):
# Load tokenizer and model
self.processor = AutoProcessor.from_pretrained(path)
self.model = Qwen3VLForConditionalGeneration.from_pretrained(path, device_map="auto")
self.model.eval()
def __call__(self, data: Dict[str, Any]) -> str:
# Prepare your messages with image and text
inputs = data.get("inputs")
base64image = inputs["base64"]
img_bytes = base64.b64decode(base64image)
pil_img = Image.open(io.BytesIO(img_bytes)).convert("RGB")
messages = [
{
"role": "user",
"content": [
{"type": "image", "image": pil_img}, # pass PIL image directly
{"type": "text", "text": prompt},
]
}
]
# Process the input and generate a response
inputs = self.processor.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_dict=True,
return_tensors="pt"
)
inputs = inputs.to(self.model.device)
generated_ids = self.model.generate(**inputs, max_new_tokens=2048)
generated_ids_trimmed = [
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]
output_text = self.processor.batch_decode(
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
response = {
"id": f"chatcmpl-{uuid.uuid4().hex}",
"object": "chat.completion",
"created": int(time.time()),
"model": "Qwen/Qwen3-VL-8B-Instruct",
"usage": {
# you might compute these if you can get token counts
"prompt_tokens": None,
"completion_tokens": None,
"total_tokens": None
},
"choices": [
{
"message": {
"role": "assistant",
"content": output_text[0]
},
"finish_reason": "stop",
"index": 0
}
]
}
return response |