Image-Text-to-Text
Transformers
Safetensors
qwen3_5
vision-language
visual-question-answering
conversational
Instructions to use Yizou/STAR-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Yizou/STAR-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Yizou/STAR-4B") 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("Yizou/STAR-4B") model = AutoModelForMultimodalLM.from_pretrained("Yizou/STAR-4B", 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 Yizou/STAR-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Yizou/STAR-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Yizou/STAR-4B", "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/Yizou/STAR-4B
- SGLang
How to use Yizou/STAR-4B 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 "Yizou/STAR-4B" \ --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": "Yizou/STAR-4B", "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 "Yizou/STAR-4B" \ --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": "Yizou/STAR-4B", "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 Yizou/STAR-4B with Docker Model Runner:
docker model run hf.co/Yizou/STAR-4B
|
Download README.md from Yizou/STAR-4B: direct link, hf CLI and curl.
- Browser
- Download file 2.71 kB
-
https://huggingface.co/Yizou/STAR-4B/resolve/main/README.md
- Command line
-
hf download hf://Yizou/STAR-4B/README.md
-
curl -L -o README.md https://huggingface.co/Yizou/STAR-4B/resolve/main/README.md
2.71 kB
| library_name: transformers | |
| pipeline_tag: image-text-to-text | |
| base_model: Qwen/Qwen3.5-4B | |
| base_model_relation: finetune | |
| license: apache-2.0 | |
| tags: | |
| - vision-language | |
| - visual-question-answering | |
| # STAR-Qwen3.5-4B | |
| STAR-Qwen3.5-4B is a vision-language student fine-tuned from [Qwen3.5-4B](https://huggingface.co/Qwen/Qwen3.5-4B). This release contains the full BF16 student weights from training step 60, along with the tokenizer, image processor and chat template used for inference. | |
| The student trained on 6,176 pairs of original and locally edited images. Each pair shares a question, with a different correct answer in each image. A frozen teacher uses an evidence crop and its mean-color control to form token-specific distillation targets. At inference the student answers directly from the image and question. | |
| ## Run locally | |
| Install PyTorch and its matching torchvision build, Transformers with Qwen3.5 support, Accelerate and Pillow. Set model_dir to the downloaded repository. The example uses a generated red square. Its image and text preprocessing was verified with Transformers 5.20.1. | |
| ```python | |
| import torch | |
| from PIL import Image | |
| from transformers import AutoModelForImageTextToText, AutoProcessor | |
| model_dir = "./STAR-Qwen3.5-4B" | |
| processor = AutoProcessor.from_pretrained(model_dir) | |
| model = AutoModelForImageTextToText.from_pretrained( | |
| model_dir, dtype=torch.bfloat16, device_map="auto" | |
| ).eval() | |
| messages = [{"role": "user", "content": [ | |
| {"type": "image", "image": Image.new("RGB", (224, 224), "red")}, | |
| {"type": "text", "text": "What color is the square?"}, | |
| ]}] | |
| inputs = processor.apply_chat_template( | |
| messages, add_generation_prompt=True, tokenize=True, enable_thinking=False, | |
| return_dict=True, return_tensors="pt", | |
| ).to(model.device) | |
| with torch.inference_mode(): | |
| output = model.generate(**inputs, do_sample=False, max_new_tokens=32) | |
| answer = processor.batch_decode( | |
| output[:, inputs["input_ids"].shape[1]:], skip_special_tokens=True | |
| )[0] | |
| print(answer) | |
| ``` | |
| ## Evaluation | |
| Accuracy is expressed as a percentage. Avg6 is the unweighted mean of the six benchmark scores. These are the selected checkpoint's reported results under greedy, non-thinking evaluation with an 8,192-token output limit. | |
| | Model | V* | Zoom | HR-Bench 4K | HR-Bench 8K | MME-RealWorld EN | MME-RealWorld CN | Avg6 | | |
| |---|---:|---:|---:|---:|---:|---:|---:| | |
| | Qwen3.5-4B | 81.68 | 49.35 | 86.25 | 82.75 | 63.81 | 63.77 | 71.27 | | |
| | STAR-Qwen3.5-4B | 94.76 | 60.95 | 87.50 | 84.38 | 77.76 | 70.51 | 79.31 | | |
| ## License | |
| These fine-tuned weights are released under the Apache License 2.0. See [LICENSE](./LICENSE) and the [upstream model card](https://huggingface.co/Qwen/Qwen3.5-4B). | |