Instructions to use game-plus/qwen3.5-4b-gameworld-sft-final with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use game-plus/qwen3.5-4b-gameworld-sft-final with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="game-plus/qwen3.5-4b-gameworld-sft-final") 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("game-plus/qwen3.5-4b-gameworld-sft-final") model = AutoModelForMultimodalLM.from_pretrained("game-plus/qwen3.5-4b-gameworld-sft-final", 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 game-plus/qwen3.5-4b-gameworld-sft-final with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "game-plus/qwen3.5-4b-gameworld-sft-final" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "game-plus/qwen3.5-4b-gameworld-sft-final", "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/game-plus/qwen3.5-4b-gameworld-sft-final
- SGLang
How to use game-plus/qwen3.5-4b-gameworld-sft-final 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 "game-plus/qwen3.5-4b-gameworld-sft-final" \ --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": "game-plus/qwen3.5-4b-gameworld-sft-final", "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 "game-plus/qwen3.5-4b-gameworld-sft-final" \ --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": "game-plus/qwen3.5-4b-gameworld-sft-final", "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 game-plus/qwen3.5-4b-gameworld-sft-final with Docker Model Runner:
docker model run hf.co/game-plus/qwen3.5-4b-gameworld-sft-final
Qwen3.5-4B GameWorld SFT — final (1 epoch, step 9237)
Full-parameter SFT of Qwen/Qwen3.5-4B (language model trained; vision encoder and aligner frozen) on the
GameWorld game-agent data. Final checkpoint after one full epoch (9237 steps). Final train loss 0.283 (running average over the epoch).
(running average over the epoch; last logged step 0.257).
Training setup
- Data: 5 sources mixed (4 teacher-model sources + policy rollouts), 1,564,236 rows, ~10.9B tokens, max 25,000 tokens/sample.
Each sample: system prompt, user turn with up to 7 game screenshots (≤1024 image tokens each), assistant
<think>\n\n</think>+<tool_call>action. Policy samples mask the empty-think turn from the loss; teacher samples train on the whole assistant message. - Optimizer: AdamW, lr 1e-5 cosine, warmup 3%, per-device batch 2 × accumulation 3 = 48 packed sequences × 25K tokens ≈ 1.18M tokens/step (~165 samples).
- BF16, DeepSpeed ZeRO-2, sequence packing, Liger kernel, flash-attention 2, gradient checkpointing.
- 1 node × 8 H100 80GB, ~37 h wall clock, 14.3 s/step. ms-swift 4.5.3, transformers 5.16.1, DeepSpeed 0.19.8.
- Weights: bf16 safetensors, 3 shards (~9.3 GB).
Inference
Set IMAGE_MAX_TOKEN_NUM=1024 (or the equivalent max_pixels) so screenshots are tokenized as in training.
from transformers import AutoProcessor, AutoModelForImageTextToText
import torch
repo = "game-plus/qwen3.5-4b-gameworld-sft-final"
processor = AutoProcessor.from_pretrained(repo)
model = AutoModelForImageTextToText.from_pretrained(repo, dtype=torch.bfloat16, device_map="cuda")
messages = [{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": [{"type": "image", "image": "screen.png"}, {"type": "text", "text": USER_TEXT}]}]
inputs = processor.apply_chat_template(messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=256)
print(processor.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
With ms-swift: swift infer --model game-plus/qwen3.5-4b-gameworld-sft-final --template qwen3_5 --use_hf true.
The model emits an empty think block followed by a <tool_call> JSON, matching the training format.
- Downloads last month
- 2