Text Generation
PEFT
Safetensors
Transformers
English
qwen2
lora
sft
trl
sakthai
tool-calling
instruct
function-calling
conversational
Instructions to use Nanthasit/sakthai-context-7b-tools with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Nanthasit/sakthai-context-7b-tools with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-7B-Instruct") model = PeftModel.from_pretrained(base_model, "Nanthasit/sakthai-context-7b-tools") - Transformers
How to use Nanthasit/sakthai-context-7b-tools with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Nanthasit/sakthai-context-7b-tools") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Nanthasit/sakthai-context-7b-tools", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Nanthasit/sakthai-context-7b-tools with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Nanthasit/sakthai-context-7b-tools" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Nanthasit/sakthai-context-7b-tools", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Nanthasit/sakthai-context-7b-tools
- SGLang
How to use Nanthasit/sakthai-context-7b-tools 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 "Nanthasit/sakthai-context-7b-tools" \ --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": "Nanthasit/sakthai-context-7b-tools", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "Nanthasit/sakthai-context-7b-tools" \ --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": "Nanthasit/sakthai-context-7b-tools", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Nanthasit/sakthai-context-7b-tools with Docker Model Runner:
docker model run hf.co/Nanthasit/sakthai-context-7b-tools
| 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"]` |