Text Generation
Transformers
Safetensors
PEFT
English
qwen2
function-calling
tool-use
lora
qwen2.5
json-generation
nano-slm
resource-constrained
conversational
text-generation-inference
Instructions to use silvermete0r/qwen2.5-nano-function-master with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use silvermete0r/qwen2.5-nano-function-master with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="silvermete0r/qwen2.5-nano-function-master") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("silvermete0r/qwen2.5-nano-function-master") model = AutoModelForCausalLM.from_pretrained("silvermete0r/qwen2.5-nano-function-master", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - PEFT
How to use silvermete0r/qwen2.5-nano-function-master with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use silvermete0r/qwen2.5-nano-function-master with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "silvermete0r/qwen2.5-nano-function-master" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "silvermete0r/qwen2.5-nano-function-master", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/silvermete0r/qwen2.5-nano-function-master
- SGLang
How to use silvermete0r/qwen2.5-nano-function-master 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 "silvermete0r/qwen2.5-nano-function-master" \ --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": "silvermete0r/qwen2.5-nano-function-master", "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 "silvermete0r/qwen2.5-nano-function-master" \ --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": "silvermete0r/qwen2.5-nano-function-master", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use silvermete0r/qwen2.5-nano-function-master with Docker Model Runner:
docker model run hf.co/silvermete0r/qwen2.5-nano-function-master
full model card refresh
Browse files
README.md
CHANGED
|
@@ -43,9 +43,9 @@ for function-calling tasks in private/resource-constrained environments.
|
|
| 43 |
| LoRA dropout | 0.05 |
|
| 44 |
| Training samples | 9,000 |
|
| 45 |
| Eval samples | 1,000 |
|
| 46 |
-
| Max steps |
|
| 47 |
| Effective batch size | 16 (4 × 4 grad accumulation) |
|
| 48 |
-
| Learning rate |
|
| 49 |
| LR scheduler | Cosine with 20 warmup steps |
|
| 50 |
| Optimizer | AdamW (fused) |
|
| 51 |
| Weight decay | 0.01 |
|
|
@@ -66,24 +66,24 @@ Evaluated on 1,000 held-out samples from `xlam-function-calling-60k`:
|
|
| 66 |
Metric Before After Delta
|
| 67 |
--------------------------------------------------------------
|
| 68 |
json_valid_pct 100.0 100.0 +0.0
|
| 69 |
-
name_match_pct
|
| 70 |
-
args_keys_match_pct
|
| 71 |
-
args_exact_pct
|
| 72 |
```
|
| 73 |
|
| 74 |
*Estimated during the final evaluation inference stage of the fine-tuned model.*
|
| 75 |
|
| 76 |
| Metric | Value |
|
| 77 |
| --------------------------------- | ------: |
|
| 78 |
-
| Average TTFT (s) | 0.
|
| 79 |
-
| Average Tokens per Second |
|
| 80 |
-
| Average Tokens Generated | 52.
|
| 81 |
-
| Average VRAM Delta (MB) | 0.
|
| 82 |
-
| Peak VRAM Reserved (MB) |
|
| 83 |
-
| Average RAM Delta (MB) | 0.
|
| 84 |
-
| Average CPU Usage (%) |
|
| 85 |
-
| Throughput (samples/s) | 1.
|
| 86 |
-
| Estimated CO₂ Emissions (g CO₂eq) |
|
| 87 |
|
| 88 |
---
|
| 89 |
|
|
@@ -162,3 +162,31 @@ responses = [
|
|
| 162 |
- ✅ Privacy-sensitive environments (no API calls)
|
| 163 |
- ✅ Structured JSON output generation
|
| 164 |
- ❌ Not intended for open-ended conversational use
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
| LoRA dropout | 0.05 |
|
| 44 |
| Training samples | 9,000 |
|
| 45 |
| Eval samples | 1,000 |
|
| 46 |
+
| Max steps | 300 |
|
| 47 |
| Effective batch size | 16 (4 × 4 grad accumulation) |
|
| 48 |
+
| Learning rate | 5e-5 |
|
| 49 |
| LR scheduler | Cosine with 20 warmup steps |
|
| 50 |
| Optimizer | AdamW (fused) |
|
| 51 |
| Weight decay | 0.01 |
|
|
|
|
| 66 |
Metric Before After Delta
|
| 67 |
--------------------------------------------------------------
|
| 68 |
json_valid_pct 100.0 100.0 +0.0
|
| 69 |
+
name_match_pct 37.4 95.5 +58.1
|
| 70 |
+
args_keys_match_pct 37.0 87.5 +50.5
|
| 71 |
+
args_exact_pct 28.9 75.9 +47.0
|
| 72 |
```
|
| 73 |
|
| 74 |
*Estimated during the final evaluation inference stage of the fine-tuned model.*
|
| 75 |
|
| 76 |
| Metric | Value |
|
| 77 |
| --------------------------------- | ------: |
|
| 78 |
+
| Average TTFT (s) | 0.0841 |
|
| 79 |
+
| Average Tokens per Second | 78.4802 |
|
| 80 |
+
| Average Tokens Generated | 52.592 |
|
| 81 |
+
| Average VRAM Delta (MB) | 0.0096 |
|
| 82 |
+
| Peak VRAM Reserved (MB) | 13752.0 |
|
| 83 |
+
| Average RAM Delta (MB) | 0.0051 |
|
| 84 |
+
| Average CPU Usage (%) | 61.2656 |
|
| 85 |
+
| Throughput (samples/s) | 1.04 |
|
| 86 |
+
| Estimated CO₂ Emissions (g CO₂eq) | 8.3489 |
|
| 87 |
|
| 88 |
---
|
| 89 |
|
|
|
|
| 162 |
- ✅ Privacy-sensitive environments (no API calls)
|
| 163 |
- ✅ Structured JSON output generation
|
| 164 |
- ❌ Not intended for open-ended conversational use
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
## References
|
| 168 |
+
|
| 169 |
+
```
|
| 170 |
+
@misc{qwen2.5,
|
| 171 |
+
title = {Qwen2.5: A Party of Foundation Models},
|
| 172 |
+
url = {https://qwenlm.github.io/blog/qwen2.5/},
|
| 173 |
+
author = {Qwen Team},
|
| 174 |
+
month = {September},
|
| 175 |
+
year = {2024}
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
@article{qwen2,
|
| 179 |
+
title={Qwen2 Technical Report},
|
| 180 |
+
author={An Yang and Baosong Yang and Binyuan Hui and Bo Zheng and Bowen Yu and Chang Zhou and Chengpeng Li and Chengyuan Li and Dayiheng Liu and Fei Huang and Guanting Dong and Haoran Wei and Huan Lin and Jialong Tang and Jialin Wang and Jian Yang and Jianhong Tu and Jianwei Zhang and Jianxin Ma and Jin Xu and Jingren Zhou and Jinze Bai and Jinzheng He and Junyang Lin and Kai Dang and Keming Lu and Keqin Chen and Kexin Yang and Mei Li and Mingfeng Xue and Na Ni and Pei Zhang and Peng Wang and Ru Peng and Rui Men and Ruize Gao and Runji Lin and Shijie Wang and Shuai Bai and Sinan Tan and Tianhang Zhu and Tianhao Li and Tianyu Liu and Wenbin Ge and Xiaodong Deng and Xiaohuan Zhou and Xingzhang Ren and Xinyu Zhang and Xipin Wei and Xuancheng Ren and Yang Fan and Yang Yao and Yichang Zhang and Yu Wan and Yunfei Chu and Yuqiong Liu and Zeyu Cui and Zhenru Zhang and Zhihao Fan},
|
| 181 |
+
journal={arXiv preprint arXiv:2407.10671},
|
| 182 |
+
year={2024}
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
@article{liu2024apigen,
|
| 186 |
+
title={APIGen: Automated Pipeline for Generating Verifiable and Diverse Function-Calling Datasets},
|
| 187 |
+
author={Liu, Zuxin and Hoang, Thai and Zhang, Jianguo and Zhu, Ming and Lan, Tian and Kokane, Shirley and Tan, Juntao and Yao, Weiran and Liu, Zhiwei and Feng, Yihao and others},
|
| 188 |
+
journal={arXiv preprint arXiv:2406.18518},
|
| 189 |
+
year={2024}
|
| 190 |
+
}
|
| 191 |
+
```
|
| 192 |
+
|