Views
No views yet
<tool_call> / <tool_response> XML format and can handle both text and image inputs.| Property | Value |
|---|---|
| Base Model | unsloth/qwen3-vl-4b-instruct-bnb-4bit |
| Model Type | Vision-Language (Qwen3-VL), Causal LM |
| Fine-tune Method | LoRA (PEFT) |
| LoRA Rank (r) | 16 |
| LoRA Alpha | 16 |
| LoRA Dropout | 0 |
| Target Modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Adapter Size | ~143 MB |
| PEFT Version | 0.18.1 |
| License | Apache 2.0 |
| Developed by | Mustafaege |
pip install transformers peft unsloth torch1from peft import PeftModel
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4base_model_id = "unsloth/qwen3-vl-4b-instruct-bnb-4bit"
5adapter_id = "Mustafaege/Qwen3-VL-4B-tool-calling-ft"
6
7tokenizer = AutoTokenizer.from_pretrained(base_model_id)
8model = AutoModelForCausalLM.from_pretrained(base_model_id, device_map="auto")
9model = PeftModel.from_pretrained(model, adapter_id)
10model.eval()1tools = [
2 {
3 "name": "get_weather",
4 "description": "Get current weather for a location",
5 "parameters": {
6 "type": "object",
7 "properties": {
8 "location": {"type": "string", "description": "City name"},
9 "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
10 },
11 "required": ["location"]
12 }
13 }
14]
15
16messages = [
17 {"role": "user", "content": "What's the weather like in Istanbul?"}
18]
19
20text = tokenizer.apply_chat_template(
21 messages,
22 tools=tools,
23 tokenize=False,
24 add_generation_prompt=True
25)
26
27inputs = tokenizer(text, return_tensors="pt").to(model.device)
28outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.1)
29response = tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
30print(response)
31# Expected: <tool_call>
32# {"name": "get_weather", "arguments": {"location": "Istanbul", "unit": "celsius"}}
33# </tool_call>1from unsloth import FastVisionModel
2
3model, tokenizer = FastVisionModel.from_pretrained(
4 model_name="Mustafaege/Qwen3-VL-4B-tool-calling-ft",
5 load_in_4bit=True,
6)
7FastVisionModel.for_inference(model)1<tool_call>
2{"name": "function_name", "arguments": {"param1": "value1"}}
3</tool_call>1<tool_response>
2{"result": "..."}
3</tool_response>1@misc{qwen3vl,
2 title={Qwen3-VL Technical Report},
3 author={Qwen Team},
4 year={2025},
5 publisher={Alibaba Cloud}
6}