For a merged GGUF checkpoint (no PEFT required), see
sakthai-context-7b-merged.
This adapter emits structured tool calls as XML. Provide a <tools> block in the system prompt, and the model responds with a <tool_call> block instead of plain text when a tool is needed:
1<tools>
2{"type": "function", "function": {"name": "get_weather", "description": "Get current weather", "parameters": {"type": "object", "properties": {"location": {"type": "string"}}, "required": ["location"]}}}
3</tools>
1<tool_call>
2{"name": "get_weather", "arguments": {"location": "Tokyo"}}
3</tool_call>
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3from peft import PeftModel
4
5model = AutoModelForCausalLM.from_pretrained(
6 "Qwen/Qwen2.5-7B-Instruct",
7 torch_dtype=torch.bfloat16,
8 device_map="auto"
9)
10tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-7B-Instruct")
11
12model = PeftModel.from_pretrained(model, "Nanthasit/sakthai-context-7b-tools")
13
14messages = [{"role": "user", "content": "What's the weather in Bangkok?"}]
15inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
16outputs = model.generate(**inputs, max_new_tokens=128)
17print(tokenizer.decode(outputs[0], skip_special_tokens=True))
To bake the adapter into the weights (e.g. for export or merging):
1model = model.merge_and_unload()
2model.save_pretrained("./sakthai-context-7b-tools-merged")
3tokenizer.save_pretrained("./sakthai-context-7b-tools-merged")
Prefer GGUF / llama.cpp? Use the merged sibling
sakthai-context-7b-merged instead — full weights, no PEFT step.
All public repositories in the
SakThai Model Family (downloads and sizes live as of 2026-07-31; sizes from
model_info when available):
If you use this adapter in your work, please cite both the base model and the fine-tune:
1@article{qwen2.5,
2 title={Qwen2.5 Technical Report},
3 author={Qwen Team},
4 journal={arXiv preprint arXiv:2412.15115},
5 year={2024}
6}
7
8@misc{sakthai-context-7b-tools,
9 title={SakThai Context 7B Tools: Tool-Calling LoRA Adapter},
10 author={Nanthasit, Beer and the SakThai Family Agents},
11 year={2026},
12 howpublished={\url{https://huggingface.co/Nanthasit/sakthai-context-7b-tools}},
13 note={Apache 2.0; fine-tuned from Qwen/Qwen2.5-7B-Instruct via QLoRA}
14}