Instructions to use JianhuiWei/qwen35_4b_sft_VE_masked_error_tool_call with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use JianhuiWei/qwen35_4b_sft_VE_masked_error_tool_call with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="JianhuiWei/qwen35_4b_sft_VE_masked_error_tool_call") 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)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("JianhuiWei/qwen35_4b_sft_VE_masked_error_tool_call") model = AutoModelForMultimodalLM.from_pretrained("JianhuiWei/qwen35_4b_sft_VE_masked_error_tool_call", 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use JianhuiWei/qwen35_4b_sft_VE_masked_error_tool_call with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "JianhuiWei/qwen35_4b_sft_VE_masked_error_tool_call" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "JianhuiWei/qwen35_4b_sft_VE_masked_error_tool_call", "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/JianhuiWei/qwen35_4b_sft_VE_masked_error_tool_call
- SGLang
How to use JianhuiWei/qwen35_4b_sft_VE_masked_error_tool_call 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 "JianhuiWei/qwen35_4b_sft_VE_masked_error_tool_call" \ --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": "JianhuiWei/qwen35_4b_sft_VE_masked_error_tool_call", "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 "JianhuiWei/qwen35_4b_sft_VE_masked_error_tool_call" \ --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": "JianhuiWei/qwen35_4b_sft_VE_masked_error_tool_call", "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 JianhuiWei/qwen35_4b_sft_VE_masked_error_tool_call with Docker Model Runner:
docker model run hf.co/JianhuiWei/qwen35_4b_sft_VE_masked_error_tool_call
Qwen3.5-4B · Pareto Curriculum SFT · Error Tool-Call Mask
This is the best checkpoint from a three-stage Pareto curriculum SFT run on Qwen3.5-4B with Error Tool-Call Mask enabled.
Training summary
- Base model:
Qwen/Qwen3.5-4B - Selected checkpoint: Stage 3, global step 105
- Training data: Qwen3.5-122B distilled trajectories with reward >= 0.3
- Curriculum: reward 0.3-0.5 -> case-wise Pareto 0.3-0.7 -> highest band per case 0.3-1.0
- Loss: unweighted assistant-token cross-entropy
- Error Tool-Call Mask: enabled
For a tool response classified as an error, the assistant turn that issued the
matching tool_call_id remains in the input context but all of that turn's
assistant tokens receive loss mask 0. If a parallel assistant turn contains
multiple tool calls and any matched response is erroneous, the entire assistant
turn is masked.
Custom chat template
The repository includes chat_template.jinja, a custom Qwen3.5 template used
for both SFT rendering and inference. Unlike the stock history behavior, it
always replays non-empty assistant reasoning_content inside <think> blocks.
It also renders parallel tool calls with the XML-style Qwen tool-call format and
groups tool responses into the following user turn.
AutoProcessor.from_pretrained() loads the bundled template. When serving with
SGLang, pass it explicitly to ensure training/inference parity:
python -m sglang.launch_server \
--model-path /path/to/model \
--chat-template /path/to/model/chat_template.jinja \
--reasoning-parser qwen3 \
--tool-call-parser qwen3_coder
Thinking is enabled by default. To render a generation prompt without an open
reasoning block, pass enable_thinking=False in the chat-template kwargs.
Transformers loading
import torch
from transformers import AutoProcessor, Qwen3_5ForConditionalGeneration
model_id = "/path/to/model"
processor = AutoProcessor.from_pretrained(model_id)
model = Qwen3_5ForConditionalGeneration.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
text = processor.apply_chat_template(
[{"role": "user", "content": "Describe the video."}],
tokenize=False,
add_generation_prompt=True,
enable_thinking=True,
)
The checkpoint is stored as Hugging Face safetensors. Optimizer, scheduler, trainer, and RNG states are intentionally excluded.
- Downloads last month
- 3