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
Download handler.py from wealthcoders/qwen3-vl: direct link, hf CLI and curl.
- Browser
- Download file 3.17 kB
-
https://huggingface.co/wealthcoders/qwen3-vl/resolve/main/handler.py
- Command line
-
hf download hf://wealthcoders/qwen3-vl/handler.py
-
curl -L -o handler.py https://huggingface.co/wealthcoders/qwen3-vl/resolve/main/handler.py
3.17 kB
| 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 |