Text Generation
Transformers
Safetensors
HERMES
English
llama
function-calling
tool-use
chatml
full-fine-tune
withinusai
text-generation-inference
Instructions to use WithinUsAI/WIUAI.Mini.Coder.ToolCalling with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use WithinUsAI/WIUAI.Mini.Coder.ToolCalling with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="WithinUsAI/WIUAI.Mini.Coder.ToolCalling")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("WithinUsAI/WIUAI.Mini.Coder.ToolCalling") model = AutoModelForCausalLM.from_pretrained("WithinUsAI/WIUAI.Mini.Coder.ToolCalling", device_map="auto") - HERMES
How to use WithinUsAI/WIUAI.Mini.Coder.ToolCalling with HERMES:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use WithinUsAI/WIUAI.Mini.Coder.ToolCalling with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "WithinUsAI/WIUAI.Mini.Coder.ToolCalling" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "WithinUsAI/WIUAI.Mini.Coder.ToolCalling", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/WithinUsAI/WIUAI.Mini.Coder.ToolCalling
- SGLang
How to use WithinUsAI/WIUAI.Mini.Coder.ToolCalling 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 "WithinUsAI/WIUAI.Mini.Coder.ToolCalling" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "WithinUsAI/WIUAI.Mini.Coder.ToolCalling", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "WithinUsAI/WIUAI.Mini.Coder.ToolCalling" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "WithinUsAI/WIUAI.Mini.Coder.ToolCalling", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use WithinUsAI/WIUAI.Mini.Coder.ToolCalling with Docker Model Runner:
docker model run hf.co/WithinUsAI/WIUAI.Mini.Coder.ToolCalling
Commit ·
48906c3
0
Parent(s):
Super-squash branch 'main' using huggingface_hub
Browse files- .gitattributes +35 -0
- README.md +108 -0
- config.json +32 -0
- generation_config.json +11 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +40 -0
- train_state.json +1 -0
.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
library_name: transformers
|
| 5 |
+
pipeline_tag: text-generation
|
| 6 |
+
base_model: WithinUsAI/WIUAI.Mini.Coder
|
| 7 |
+
datasets:
|
| 8 |
+
- NousResearch/hermes-function-calling-v1
|
| 9 |
+
tags:
|
| 10 |
+
- function-calling
|
| 11 |
+
- tool-use
|
| 12 |
+
- hermes
|
| 13 |
+
- chatml
|
| 14 |
+
- full-fine-tune
|
| 15 |
+
- withinusai
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# WIUAI.Mini.Coder.ToolCalling
|
| 19 |
+
|
| 20 |
+
Full fine-tune of [WithinUsAI/WIUAI.Mini.Coder](https://huggingface.co/WithinUsAI/WIUAI.Mini.Coder) on
|
| 21 |
+
[NousResearch/hermes-function-calling-v1](https://huggingface.co/datasets/NousResearch/hermes-function-calling-v1) only. Published by WithinUsAI.
|
| 22 |
+
|
| 23 |
+
> **Status:** checkpoint at **step 237 of 237** (epoch 1.00). This README and the model weights are
|
| 24 |
+
> replaced automatically at every checkpoint, so the repo always holds one complete, latest model.
|
| 25 |
+
> Elapsed training time so far: 59 min. No task benchmark has been run.
|
| 26 |
+
|
| 27 |
+
## Prompt format
|
| 28 |
+
|
| 29 |
+
Hermes function-calling ChatML. Roles: system, user, assistant, tool. The system prompt lists tools inside
|
| 30 |
+
`<tools> </tools>`; the assistant answers with `<tool_call> ... </tool_call>`; tool results go in a `tool` turn
|
| 31 |
+
inside `<tool_response>` tags. The assistant turn ends with `<|im_end|>`. Stop generation at `<|im_end|>`.
|
| 32 |
+
|
| 33 |
+
```python
|
| 34 |
+
import torch
|
| 35 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 36 |
+
repo = "WithinUsAI/WIUAI.Mini.Coder.ToolCalling"
|
| 37 |
+
tok = AutoTokenizer.from_pretrained(repo)
|
| 38 |
+
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.float16, device_map="auto")
|
| 39 |
+
# SYSTEM_PROMPT = the Hermes function-calling system prompt with your tool list inside <tools> </tools>
|
| 40 |
+
prompt = ("<|im_start|>system\n" + SYSTEM_PROMPT + "<|im_end|>\n"
|
| 41 |
+
"<|im_start|>user\n" + USER_MESSAGE + "<|im_end|>\n"
|
| 42 |
+
"<|im_start|>assistant\n")
|
| 43 |
+
ids = tok(prompt, return_tensors="pt", add_special_tokens=False).to(model.device)
|
| 44 |
+
out = model.generate(**ids, max_new_tokens=200, do_sample=False,
|
| 45 |
+
eos_token_id=tok.convert_tokens_to_ids("<|im_end|>"))
|
| 46 |
+
print(tok.decode(out[0][ids["input_ids"].shape[1]:]))
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
## Training data
|
| 50 |
+
|
| 51 |
+
Only `NousResearch/hermes-function-calling-v1` (all five files). Conversations are ShareGPT-style turns converted to ChatML. Duplicates are removed
|
| 52 |
+
(SHA-256). Conversations longer than 1024 tokens are **dropped, not truncated**.
|
| 53 |
+
|
| 54 |
+
| File | Raw | Duplicates | Rejected | Too long | Kept | Kept with tool call |
|
| 55 |
+
|---|---|---|---|---|---|---|
|
| 56 |
+
| func-calling-singleturn.json | 1893 | 0 | 0 | 1212 | 681 | 676 |
|
| 57 |
+
| func-calling.json | 1893 | 793 | 0 | 988 | 112 | 110 |
|
| 58 |
+
| glaive-function-calling-5k.json | 5209 | 2 | 0 | 581 | 4626 | 4128 |
|
| 59 |
+
| json-mode-agentic.json | 1342 | 41 | 0 | 170 | 1131 | 0 |
|
| 60 |
+
| json-mode-singleturn.json | 1241 | 0 | 0 | 2 | 1239 | 0 |
|
| 61 |
+
|
| 62 |
+
Kept 7789 of 10742 unique conversations (73%). Token length of all conversations: median 786, 90th percentile 2146, max 5187.
|
| 63 |
+
Split: 7556 train / 233 validation (random, seed 1147).
|
| 64 |
+
|
| 65 |
+
## Training
|
| 66 |
+
|
| 67 |
+
| Setting | Value |
|
| 68 |
+
|---|---|
|
| 69 |
+
| Hardware | 2x Tesla T4 (Kaggle), DataParallel via Hugging Face Trainer |
|
| 70 |
+
| Precision | fp32 master weights, fp16 mixed precision, gradient checkpointing |
|
| 71 |
+
| Context length | 1024 |
|
| 72 |
+
| Batch | 4 per GPU x 2 GPUs x 4 accumulation = 32 |
|
| 73 |
+
| Learning rate | 2e-05 peak, cosine, 3% warmup, weight decay 0.01, grad clip 1.0 |
|
| 74 |
+
| Planned epochs | 1 (237 steps) |
|
| 75 |
+
| Objective | Next-token loss on **assistant turns only** (system, user and tool turns are masked) |
|
| 76 |
+
| Tokens per epoch | 5,216,618 |
|
| 77 |
+
| Seed | 1147 |
|
| 78 |
+
|
| 79 |
+
## Progress (validation loss is on assistant tokens of the held-out split)
|
| 80 |
+
|
| 81 |
+
Base model before training: **1.1192**
|
| 82 |
+
|
| 83 |
+
| Step | Epoch | Train loss | Validation loss | Spot check |
|
| 84 |
+
|---|---|---|---|---|
|
| 85 |
+
| 100 | 0.42 | 0.5178 | 0.4836 | 2/2 |
|
| 86 |
+
| 200 | 0.85 | 0.4736 | 0.4624 | 2/2 |
|
| 87 |
+
| 237 | 1.00 | 0.5467 | 0.4620 | 2/2 |
|
| 88 |
+
|
| 89 |
+
## Spot check at this checkpoint
|
| 90 |
+
|
| 91 |
+
Two fixed prompts in the Hermes format with a one-tool system prompt. Pass = valid `<tool_call>` with the right function name
|
| 92 |
+
and an arguments dict. This is a tiny smoke test, not a benchmark.
|
| 93 |
+
|
| 94 |
+
| Prompt | Expected | Pass | Output |
|
| 95 |
+
|---|---|---|---|
|
| 96 |
+
| What's the weather in Paris right now? | get_weather | yes | `<tool_call> / {"name": "get_weather", "arguments": {"city": "Paris", "weather_type": "weather"}} / </tool_call> / <tool_call> / {"name": "get_weather", "argumen...` |
|
| 97 |
+
| Add 17 and 25. | add_numbers | yes | `<tool_call> / {"name": "add_numbers", "arguments": {"a": 1, "b": 2, "c": 3}} / </tool_call> / <tool_call> / {"name": "get_camera_live_feed", "arguments": {"came...` |
|
| 98 |
+
|
| 99 |
+
## Limitations
|
| 100 |
+
|
| 101 |
+
- Trained only on Hermes Function-Calling V1. Coding ability of the base model was not re-tested and may have regressed.
|
| 102 |
+
- Conversations over 1024 tokens were dropped, so long multi-turn sessions with large tool lists are under-represented.
|
| 103 |
+
- The validation split is random from the same dataset, so it can overstate generalization. No external benchmark was run.
|
| 104 |
+
- Can produce malformed calls, wrong arguments, or invented tool names. Validate output before executing any call.
|
| 105 |
+
|
| 106 |
+
## License and attribution
|
| 107 |
+
|
| 108 |
+
See the base model card and the dataset card (NousResearch/hermes-function-calling-v1) for licenses. This card grants no additional rights.
|
config.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"LlamaForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 0,
|
| 8 |
+
"dtype": "float32",
|
| 9 |
+
"eos_token_id": 0,
|
| 10 |
+
"head_dim": 96,
|
| 11 |
+
"hidden_act": "silu",
|
| 12 |
+
"hidden_size": 768,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": 3072,
|
| 15 |
+
"max_position_embeddings": 1024,
|
| 16 |
+
"mlp_bias": false,
|
| 17 |
+
"model_type": "llama",
|
| 18 |
+
"num_attention_heads": 8,
|
| 19 |
+
"num_hidden_layers": 24,
|
| 20 |
+
"num_key_value_heads": 8,
|
| 21 |
+
"pad_token_id": 0,
|
| 22 |
+
"pretraining_tp": 1,
|
| 23 |
+
"rms_norm_eps": 1e-05,
|
| 24 |
+
"rope_parameters": {
|
| 25 |
+
"rope_theta": 10000.0,
|
| 26 |
+
"rope_type": "default"
|
| 27 |
+
},
|
| 28 |
+
"tie_word_embeddings": false,
|
| 29 |
+
"transformers_version": "5.24.0",
|
| 30 |
+
"use_cache": true,
|
| 31 |
+
"vocab_size": 49152
|
| 32 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 0,
|
| 4 |
+
"eos_token_id": [
|
| 5 |
+
0,
|
| 6 |
+
2
|
| 7 |
+
],
|
| 8 |
+
"pad_token_id": 0,
|
| 9 |
+
"transformers_version": "5.24.0",
|
| 10 |
+
"use_cache": false
|
| 11 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e5187cd763537207e5b03850c11f5bd36992afda395597ec09e79e79e12d2c65
|
| 3 |
+
size 1208134600
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<|endoftext|>",
|
| 5 |
+
"clean_up_tokenization_spaces": false,
|
| 6 |
+
"eos_token": "<|endoftext|>",
|
| 7 |
+
"errors": "replace",
|
| 8 |
+
"extra_special_tokens": [
|
| 9 |
+
"<|endoftext|>",
|
| 10 |
+
"<fim_prefix>",
|
| 11 |
+
"<fim_middle>",
|
| 12 |
+
"<fim_suffix>",
|
| 13 |
+
"<fim_pad>",
|
| 14 |
+
"<filename>",
|
| 15 |
+
"<gh_stars>",
|
| 16 |
+
"<issue_start>",
|
| 17 |
+
"<issue_comment>",
|
| 18 |
+
"<issue_closed>",
|
| 19 |
+
"<jupyter_start>",
|
| 20 |
+
"<jupyter_text>",
|
| 21 |
+
"<jupyter_code>",
|
| 22 |
+
"<jupyter_output>",
|
| 23 |
+
"<empty_output>",
|
| 24 |
+
"<commit_before>",
|
| 25 |
+
"<commit_msg>",
|
| 26 |
+
"<commit_after>",
|
| 27 |
+
"<reponame>"
|
| 28 |
+
],
|
| 29 |
+
"is_local": false,
|
| 30 |
+
"local_files_only": false,
|
| 31 |
+
"max_length": 1023,
|
| 32 |
+
"model_max_length": 1024,
|
| 33 |
+
"pad_token": "<|endoftext|>",
|
| 34 |
+
"stride": 0,
|
| 35 |
+
"tokenizer_class": "GPT2Tokenizer",
|
| 36 |
+
"truncation_side": "right",
|
| 37 |
+
"truncation_strategy": "longest_first",
|
| 38 |
+
"unk_token": "<|endoftext|>",
|
| 39 |
+
"vocab_size": 49152
|
| 40 |
+
}
|
train_state.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"global_step": 237, "base_model": "WithinUsAI/WIUAI.Mini.Coder", "data": "NousResearch/hermes-function-calling-v1"}
|