--- license: apache-2.0 language: - en library_name: peft pipeline_tag: text-generation tags: - qwen2 - lora - peft - sft - trl - transformers - sakthai - tool-calling - instruct - function-calling - text-generation datasets: - Nanthasit/sakthai-combined-v5 base_model: Qwen/Qwen2.5-7B-Instruct --- # SakThai Context 7B — LoRA Adapter A LoRA fine-tune of [Qwen/Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct) for structured tool-calling and instruction following, trained on the SakThai tool-calling curriculum. ## Model Details - **Developed by:** Nanthasit - **Base model:** Qwen/Qwen2.5-7B-Instruct (7B parameters) - **Architecture:** Qwen2.5 decoder-only transformer + LoRA adapters - **Fine-tuning method:** LoRA (rank=16, alpha=32) via TRL SFTTrainer - **Training data:** [Nanthasit/sakthai-combined-v5](https://huggingface.co/datasets/Nanthasit/sakthai-combined-v5) - **License:** Apache 2.0 - **Inference:** BF16 (use `transformers` with `device_map="auto"`) ## Usage ```python from transformers import AutoModelForCausalLM, AutoTokenizer from peft import PeftModel base_model = AutoModelForCausalLM.from_pretrained( "Qwen/Qwen2.5-7B-Instruct", torch_dtype="bfloat16", device_map="auto" ) tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-7B-Instruct") model = PeftModel.from_pretrained(base_model, "Nanthasit/sakthai-context-7b-tools") ``` ### Chat Template The model uses Qwen2.5's standard chat template with system/user/assistant roles and supports function-calling via the `tools` parameter in the tokenizer. ## Merged Version For production inference, use the merged model instead: 👉 [Nanthasit/sakthai-context-7b-merged](https://huggingface.co/Nanthasit/sakthai-context-7b-merged) ## Intended Use - Tool-calling and function-calling agents - Structured instruction following - Chat and assistant applications requiring external tool use ## Training Details - **Framework:** Hugging Face TRL (SFTTrainer) - **Compute:** HF Jobs (T4 GPU) - **Quantization:** 4-bit NF4 for training - **Dataset size:** ~4,000+ tool-calling examples - **LoRA config:** `r=16, lora_alpha=32, target_modules=["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"]`