Text Generation
Transformers
Safetensors
GGUF
English
qwen3
text-to-sql
spider
bird
grpo
reinforcement-learning
conversational
text-generation-inference
Instructions to use Alpericon/tiny-sql-rl with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Alpericon/tiny-sql-rl with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Alpericon/tiny-sql-rl") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Alpericon/tiny-sql-rl") model = AutoModelForCausalLM.from_pretrained("Alpericon/tiny-sql-rl", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Alpericon/tiny-sql-rl with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf Alpericon/tiny-sql-rl:Q8_0 # Run inference directly in the terminal: llama cli -hf Alpericon/tiny-sql-rl:Q8_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Alpericon/tiny-sql-rl:Q8_0 # Run inference directly in the terminal: llama cli -hf Alpericon/tiny-sql-rl:Q8_0
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf Alpericon/tiny-sql-rl:Q8_0 # Run inference directly in the terminal: ./build/bin/llama cli -hf Alpericon/tiny-sql-rl:Q8_0
Use Docker
docker model run hf.co/Alpericon/tiny-sql-rl:Q8_0
- Llama new
- LM Studio
- Jan
- vLLM
How to use Alpericon/tiny-sql-rl with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Alpericon/tiny-sql-rl" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Alpericon/tiny-sql-rl", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Alpericon/tiny-sql-rl:Q8_0
- SGLang
How to use Alpericon/tiny-sql-rl 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 "Alpericon/tiny-sql-rl" \ --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": "Alpericon/tiny-sql-rl", "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 "Alpericon/tiny-sql-rl" \ --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": "Alpericon/tiny-sql-rl", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use Alpericon/tiny-sql-rl with Ollama:
ollama run hf.co/Alpericon/tiny-sql-rl:Q8_0
- Unsloth Desktop
- Pi
How to use Alpericon/tiny-sql-rl with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Alpericon/tiny-sql-rl:Q8_0
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Alpericon/tiny-sql-rl:Q8_0" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use Alpericon/tiny-sql-rl with Docker Model Runner:
docker model run hf.co/Alpericon/tiny-sql-rl:Q8_0
- Lemonade
How to use Alpericon/tiny-sql-rl with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Alpericon/tiny-sql-rl:Q8_0
Run and chat with the model
lemonade run user.tiny-sql-rl-Q8_0
List all available models
lemonade list
- Hermes Agent
How to use Alpericon/tiny-sql-rl with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Alpericon/tiny-sql-rl:Q8_0
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:9931/v1 hermes config set model.default Alpericon/tiny-sql-rl:Q8_0
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use Alpericon/tiny-sql-rl with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Alpericon/tiny-sql-rl:Q8_0
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:9931/v1 \ --custom-model-id "Alpericon/tiny-sql-rl:Q8_0" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Add files using upload-large-folder tool
Browse files- .gitattributes +2 -0
- README.md +101 -0
- adapter/adapter_config.json +55 -0
- adapter/adapter_model.safetensors +3 -0
- chat_template.jinja +89 -0
- config.json +63 -0
- generation_config.json +13 -0
- gguf/tiny-sql-rl-Q8_0.gguf +3 -0
- merge_info.json +5 -0
- model.safetensors +3 -0
- tokenizer.json +3 -0
- tokenizer_config.json +30 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ saved_model/**/* 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
|
|
|
|
|
|
|
|
|
| 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
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
gguf/tiny-sql-rl-Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: Qwen/Qwen3-1.7B
|
| 4 |
+
library_name: transformers
|
| 5 |
+
tags:
|
| 6 |
+
- text-to-sql
|
| 7 |
+
- spider
|
| 8 |
+
- grpo
|
| 9 |
+
- reinforcement-learning
|
| 10 |
+
- gguf
|
| 11 |
+
datasets:
|
| 12 |
+
- xlangai/spider
|
| 13 |
+
language:
|
| 14 |
+
- en
|
| 15 |
+
pipeline_tag: text-generation
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# tiny-sql-rl: Qwen3-1.7B + GRPO for text-to-SQL
|
| 19 |
+
|
| 20 |
+
Qwen3-1.7B, fine-tuned with GRPO using an **execution reward** on Spider: a generated query is
|
| 21 |
+
rewarded when its result matches the gold query's result. It was trained as a 4-bit QLoRA on one
|
| 22 |
+
8 GB laptop GPU (RTX 3070 Ti Laptop).
|
| 23 |
+
|
| 24 |
+
This repository contains:
|
| 25 |
+
- `adapter/`: the LoRA adapter (checkpoint v2-900);
|
| 26 |
+
- the merged bf16 model (root);
|
| 27 |
+
- `gguf/tiny-sql-rl-Q8_0.gguf`: a llama.cpp export.
|
| 28 |
+
|
| 29 |
+
Code, training logs and every number below: https://github.com/alpericon/tiny-sql-rl
|
| 30 |
+
|
| 31 |
+
## Results
|
| 32 |
+
|
| 33 |
+
**Spider dev, 1,034 questions** (greedy decoding, thinking off, 256 new tokens). "Official" is
|
| 34 |
+
Spider's official evaluation script (exec EX on the standard databases). "Ours" is the project's
|
| 35 |
+
column-permutation-tolerant multiset EX.
|
| 36 |
+
|
| 37 |
+
| Model | Ours | Official |
|
| 38 |
+
|---|---|---|
|
| 39 |
+
| Qwen3-1.7B zero-shot (nf4) | 53.7% | 54.1% |
|
| 40 |
+
| + GRPO, unfiltered data (nf4) | 57.1% | 58.1% |
|
| 41 |
+
| **+ GRPO, pass-rate-filtered data (this model, nf4 + adapter)** | **58.5%** | **59.0%** |
|
| 42 |
+
|
| 43 |
+
- **vs zero-shot:** 84 wins / 33 losses on the same questions (official metric, exact McNemar p<0.0001).
|
| 44 |
+
- **vs the unfiltered run:** 39 / 30, p=0.34. That gap is not significant.
|
| 45 |
+
- **This release:**
|
| 46 |
+
- merged bf16: 59.7% (ours);
|
| 47 |
+
- merged and re-quantised to nf4: 57.5%;
|
| 48 |
+
- Q8_0 GGUF: 63.5% on a 200-question subset vs 64.5% for bf16 (they disagree on 6 of 200; no
|
| 49 |
+
detectable difference).
|
| 50 |
+
- **Q4_K_M is not provided.** It breaks the model's output format: −12.5 points on the same subset.
|
| 51 |
+
|
| 52 |
+
**Spoken questions** (100 SpokenSpider queries with ASR transcripts, compared with SQLCoder-7B as
|
| 53 |
+
used in a voice-to-SQL pipeline):
|
| 54 |
+
|
| 55 |
+
| Input | this model | SQLCoder-7B |
|
| 56 |
+
|---|---|---|
|
| 57 |
+
| clean | 52% | 52% |
|
| 58 |
+
| 20 dB SNR | 55% | 50% |
|
| 59 |
+
| 10 dB SNR | 52% | 48% |
|
| 60 |
+
| 0 dB SNR | 38% | 44% |
|
| 61 |
+
|
| 62 |
+
None of these differences is significant (n=100, 3 databases).
|
| 63 |
+
|
| 64 |
+
**Latency** (RTX 3070 Ti Laptop, nf4, batch 1): 1.42 s median per query, vs 2.08 s for SQLCoder-7B
|
| 65 |
+
measured in the same session. Peak VRAM is 1.4 GiB vs 4.0 GiB.
|
| 66 |
+
|
| 67 |
+
## Training
|
| 68 |
+
|
| 69 |
+
- **Data:** Spider train, minus the 100 SpokenSpider queries (held out for the voice evaluation).
|
| 70 |
+
Questions whose gold result is empty are dropped; they reward any empty query.
|
| 71 |
+
- A pass-rate filter then keeps only questions the base model solves 1–7 times out of 8 samples:
|
| 72 |
+
1,688 of 6,638.
|
| 73 |
+
- **GRPO:** TRL + Unsloth, 4-bit QLoRA (r=16, alpha=16, all linear projections).
|
| 74 |
+
- 8 generations per prompt, 4 prompts per step, 900 steps (best dev-200 checkpoint of 1,000; rule fixed in advance).
|
| 75 |
+
- lr 5e-6 (cosine), β (KL) 0.04, temperature 1.0, seed 3407.
|
| 76 |
+
- **Reward:** 1.0 if the result matches gold, 0.1 if the SQL executes but the result is wrong, else 0.
|
| 77 |
+
A binary-reward ablation gave the same accuracy (19 / 17 on full dev).
|
| 78 |
+
|
| 79 |
+
## Usage
|
| 80 |
+
|
| 81 |
+
The prompt format matters. Use the chat template with `enable_thinking=False`, and give the schema
|
| 82 |
+
as `CREATE TABLE` statements followed by the question. The exact prompt is `tinysql.prompt.build_messages`
|
| 83 |
+
in the repository. The model answers with a ```sql block. Decode greedily, with no repetition penalty:
|
| 84 |
+
llama-cpp-python's default `repeat_penalty=1.1` noticeably hurts it.
|
| 85 |
+
|
| 86 |
+
## Limitations
|
| 87 |
+
|
| 88 |
+
- **Single seed per run.** The McNemar tests cover question sampling, not training variance.
|
| 89 |
+
- **English only, SQLite only.** It is evaluated only on Spider-style databases. About 4 in 10 Spider
|
| 90 |
+
dev questions are still answered wrongly, mostly with valid SQL that returns the wrong result.
|
| 91 |
+
- **Spoken input loses literal formatting** (case, quotes, "1,000"), which costs ~5 points even on
|
| 92 |
+
clean ASR.
|
| 93 |
+
- **The official metric's default removes DISTINCT**, which makes it slightly more lenient than ours.
|
| 94 |
+
Both are reported.
|
| 95 |
+
|
| 96 |
+
## License and attribution
|
| 97 |
+
|
| 98 |
+
- Base model: Qwen3-1.7B (Apache-2.0).
|
| 99 |
+
- Training/evaluation data: Spider (Yu et al., 2018; CC BY-SA 4.0).
|
| 100 |
+
- SpokenSpider transcripts and SQLCoder outputs come from the author's earlier voice-to-SQL project.
|
| 101 |
+
- This adapter and the merged weights are released under Apache-2.0.
|
adapter/adapter_config.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alora_invocation_tokens": null,
|
| 3 |
+
"alpha_pattern": {},
|
| 4 |
+
"arrow_config": null,
|
| 5 |
+
"auto_mapping": {
|
| 6 |
+
"base_model_class": "Qwen3ForCausalLM",
|
| 7 |
+
"parent_library": "transformers.models.qwen3.modeling_qwen3",
|
| 8 |
+
"unsloth_fixed": true
|
| 9 |
+
},
|
| 10 |
+
"base_model_name_or_path": "unsloth/Qwen3-1.7B-unsloth-bnb-4bit",
|
| 11 |
+
"bias": "none",
|
| 12 |
+
"corda_config": null,
|
| 13 |
+
"ensure_weight_tying": false,
|
| 14 |
+
"eva_config": null,
|
| 15 |
+
"exclude_modules": null,
|
| 16 |
+
"fan_in_fan_out": false,
|
| 17 |
+
"inference_mode": true,
|
| 18 |
+
"init_lora_weights": true,
|
| 19 |
+
"kasa_config": null,
|
| 20 |
+
"layer_replication": null,
|
| 21 |
+
"layers_pattern": null,
|
| 22 |
+
"layers_to_transform": null,
|
| 23 |
+
"loftq_config": {},
|
| 24 |
+
"lora_alpha": 16,
|
| 25 |
+
"lora_bias": false,
|
| 26 |
+
"lora_dropout": 0.0,
|
| 27 |
+
"lora_ga_config": null,
|
| 28 |
+
"megatron_config": null,
|
| 29 |
+
"megatron_core": "megatron.core",
|
| 30 |
+
"modules_to_save": null,
|
| 31 |
+
"monteclora_config": null,
|
| 32 |
+
"peft_type": "LORA",
|
| 33 |
+
"peft_version": "0.21.3",
|
| 34 |
+
"qalora_group_size": 16,
|
| 35 |
+
"r": 16,
|
| 36 |
+
"rank_pattern": {},
|
| 37 |
+
"revision": null,
|
| 38 |
+
"target_modules": [
|
| 39 |
+
"o_proj",
|
| 40 |
+
"q_proj",
|
| 41 |
+
"v_proj",
|
| 42 |
+
"gate_proj",
|
| 43 |
+
"down_proj",
|
| 44 |
+
"up_proj",
|
| 45 |
+
"k_proj"
|
| 46 |
+
],
|
| 47 |
+
"target_parameters": null,
|
| 48 |
+
"task_type": "CAUSAL_LM",
|
| 49 |
+
"trainable_token_indices": null,
|
| 50 |
+
"use_bdlora": null,
|
| 51 |
+
"use_dora": false,
|
| 52 |
+
"use_qalora": false,
|
| 53 |
+
"use_rslora": false,
|
| 54 |
+
"velora_config": null
|
| 55 |
+
}
|
adapter/adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:144c4baf8f48a5294eb6b6eb0fa2ad97fbd1d9bed652179f131a6a0e3e3fe84d
|
| 3 |
+
size 69782384
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- if tools %}
|
| 2 |
+
{{- '<|im_start|>system\n' }}
|
| 3 |
+
{%- if messages[0].role == 'system' %}
|
| 4 |
+
{{- messages[0].content + '\n\n' }}
|
| 5 |
+
{%- endif %}
|
| 6 |
+
{{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
| 7 |
+
{%- for tool in tools %}
|
| 8 |
+
{{- "\n" }}
|
| 9 |
+
{{- tool | tojson }}
|
| 10 |
+
{%- endfor %}
|
| 11 |
+
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
| 12 |
+
{%- else %}
|
| 13 |
+
{%- if messages[0].role == 'system' %}
|
| 14 |
+
{{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
|
| 15 |
+
{%- endif %}
|
| 16 |
+
{%- endif %}
|
| 17 |
+
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
| 18 |
+
{%- for message in messages[::-1] %}
|
| 19 |
+
{%- set index = (messages|length - 1) - loop.index0 %}
|
| 20 |
+
{%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
|
| 21 |
+
{%- set ns.multi_step_tool = false %}
|
| 22 |
+
{%- set ns.last_query_index = index %}
|
| 23 |
+
{%- endif %}
|
| 24 |
+
{%- endfor %}
|
| 25 |
+
{%- for message in messages %}
|
| 26 |
+
{%- if message.content is string %}
|
| 27 |
+
{%- set content = message.content %}
|
| 28 |
+
{%- else %}
|
| 29 |
+
{%- set content = '' %}
|
| 30 |
+
{%- endif %}
|
| 31 |
+
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
|
| 32 |
+
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
| 33 |
+
{%- elif message.role == "assistant" %}
|
| 34 |
+
{%- set reasoning_content = '' %}
|
| 35 |
+
{%- if message.reasoning_content is string %}
|
| 36 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 37 |
+
{%- else %}
|
| 38 |
+
{%- if '</think>' in content %}
|
| 39 |
+
{%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
|
| 40 |
+
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
| 41 |
+
{%- endif %}
|
| 42 |
+
{%- endif %}
|
| 43 |
+
{%- if loop.index0 > ns.last_query_index %}
|
| 44 |
+
{%- if loop.last or (not loop.last and reasoning_content) %}
|
| 45 |
+
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
|
| 46 |
+
{%- else %}
|
| 47 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 48 |
+
{%- endif %}
|
| 49 |
+
{%- else %}
|
| 50 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 51 |
+
{%- endif %}
|
| 52 |
+
{%- if message.tool_calls %}
|
| 53 |
+
{%- for tool_call in message.tool_calls %}
|
| 54 |
+
{%- if (loop.first and content) or (not loop.first) %}
|
| 55 |
+
{{- '\n' }}
|
| 56 |
+
{%- endif %}
|
| 57 |
+
{%- if tool_call.function %}
|
| 58 |
+
{%- set tool_call = tool_call.function %}
|
| 59 |
+
{%- endif %}
|
| 60 |
+
{{- '<tool_call>\n{"name": "' }}
|
| 61 |
+
{{- tool_call.name }}
|
| 62 |
+
{{- '", "arguments": ' }}
|
| 63 |
+
{%- if tool_call.arguments is string %}
|
| 64 |
+
{{- tool_call.arguments }}
|
| 65 |
+
{%- else %}
|
| 66 |
+
{{- tool_call.arguments | tojson }}
|
| 67 |
+
{%- endif %}
|
| 68 |
+
{{- '}\n</tool_call>' }}
|
| 69 |
+
{%- endfor %}
|
| 70 |
+
{%- endif %}
|
| 71 |
+
{{- '<|im_end|>\n' }}
|
| 72 |
+
{%- elif message.role == "tool" %}
|
| 73 |
+
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
|
| 74 |
+
{{- '<|im_start|>user' }}
|
| 75 |
+
{%- endif %}
|
| 76 |
+
{{- '\n<tool_response>\n' }}
|
| 77 |
+
{{- content }}
|
| 78 |
+
{{- '\n</tool_response>' }}
|
| 79 |
+
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
| 80 |
+
{{- '<|im_end|>\n' }}
|
| 81 |
+
{%- endif %}
|
| 82 |
+
{%- endif %}
|
| 83 |
+
{%- endfor %}
|
| 84 |
+
{%- if add_generation_prompt %}
|
| 85 |
+
{{- '<|im_start|>assistant\n' }}
|
| 86 |
+
{%- if enable_thinking is defined and enable_thinking is false %}
|
| 87 |
+
{{- '<think>\n\n</think>\n\n' }}
|
| 88 |
+
{%- endif %}
|
| 89 |
+
{%- endif %}
|
config.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen3ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 151643,
|
| 8 |
+
"dtype": "bfloat16",
|
| 9 |
+
"eos_token_id": 151645,
|
| 10 |
+
"head_dim": 128,
|
| 11 |
+
"hidden_act": "silu",
|
| 12 |
+
"hidden_size": 2048,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": 6144,
|
| 15 |
+
"layer_types": [
|
| 16 |
+
"full_attention",
|
| 17 |
+
"full_attention",
|
| 18 |
+
"full_attention",
|
| 19 |
+
"full_attention",
|
| 20 |
+
"full_attention",
|
| 21 |
+
"full_attention",
|
| 22 |
+
"full_attention",
|
| 23 |
+
"full_attention",
|
| 24 |
+
"full_attention",
|
| 25 |
+
"full_attention",
|
| 26 |
+
"full_attention",
|
| 27 |
+
"full_attention",
|
| 28 |
+
"full_attention",
|
| 29 |
+
"full_attention",
|
| 30 |
+
"full_attention",
|
| 31 |
+
"full_attention",
|
| 32 |
+
"full_attention",
|
| 33 |
+
"full_attention",
|
| 34 |
+
"full_attention",
|
| 35 |
+
"full_attention",
|
| 36 |
+
"full_attention",
|
| 37 |
+
"full_attention",
|
| 38 |
+
"full_attention",
|
| 39 |
+
"full_attention",
|
| 40 |
+
"full_attention",
|
| 41 |
+
"full_attention",
|
| 42 |
+
"full_attention",
|
| 43 |
+
"full_attention"
|
| 44 |
+
],
|
| 45 |
+
"max_position_embeddings": 40960,
|
| 46 |
+
"max_window_layers": 28,
|
| 47 |
+
"model_type": "qwen3",
|
| 48 |
+
"num_attention_heads": 16,
|
| 49 |
+
"num_hidden_layers": 28,
|
| 50 |
+
"num_key_value_heads": 8,
|
| 51 |
+
"pad_token_id": null,
|
| 52 |
+
"rms_norm_eps": 1e-06,
|
| 53 |
+
"rope_parameters": {
|
| 54 |
+
"rope_theta": 1000000,
|
| 55 |
+
"rope_type": "default"
|
| 56 |
+
},
|
| 57 |
+
"sliding_window": null,
|
| 58 |
+
"tie_word_embeddings": true,
|
| 59 |
+
"transformers_version": "5.17.0",
|
| 60 |
+
"use_cache": true,
|
| 61 |
+
"use_sliding_window": false,
|
| 62 |
+
"vocab_size": 151936
|
| 63 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 151643,
|
| 3 |
+
"do_sample": true,
|
| 4 |
+
"eos_token_id": [
|
| 5 |
+
151645,
|
| 6 |
+
151643
|
| 7 |
+
],
|
| 8 |
+
"pad_token_id": 151643,
|
| 9 |
+
"temperature": 0.6,
|
| 10 |
+
"top_k": 20,
|
| 11 |
+
"top_p": 0.95,
|
| 12 |
+
"transformers_version": "5.17.0"
|
| 13 |
+
}
|
gguf/tiny-sql-rl-Q8_0.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2d273bedd10c581940f661a68a659cb475ea4679ad87d8780d3a2c156743b466
|
| 3 |
+
size 1834426208
|
merge_info.json
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"base": "Qwen/Qwen3-1.7B",
|
| 3 |
+
"adapter": "checkpoints/v2/checkpoint-900",
|
| 4 |
+
"dtype": "bfloat16"
|
| 5 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:95c4b1f7414208fd31d6cc1bd5959eed2e8bbe6a6ea2c16cca9a87a7fff46fd5
|
| 3 |
+
size 3441185608
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:be75606093db2094d7cd20f3c2f385c212750648bd6ea4fb2bf507a6a4c55506
|
| 3 |
+
size 11422650
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": null,
|
| 5 |
+
"clean_up_tokenization_spaces": false,
|
| 6 |
+
"eos_token": "<|im_end|>",
|
| 7 |
+
"errors": "replace",
|
| 8 |
+
"extra_special_tokens": [
|
| 9 |
+
"<|im_start|>",
|
| 10 |
+
"<|im_end|>",
|
| 11 |
+
"<|object_ref_start|>",
|
| 12 |
+
"<|object_ref_end|>",
|
| 13 |
+
"<|box_start|>",
|
| 14 |
+
"<|box_end|>",
|
| 15 |
+
"<|quad_start|>",
|
| 16 |
+
"<|quad_end|>",
|
| 17 |
+
"<|vision_start|>",
|
| 18 |
+
"<|vision_end|>",
|
| 19 |
+
"<|vision_pad|>",
|
| 20 |
+
"<|image_pad|>",
|
| 21 |
+
"<|video_pad|>"
|
| 22 |
+
],
|
| 23 |
+
"is_local": false,
|
| 24 |
+
"local_files_only": false,
|
| 25 |
+
"model_max_length": 131072,
|
| 26 |
+
"pad_token": "<|endoftext|>",
|
| 27 |
+
"split_special_tokens": false,
|
| 28 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 29 |
+
"unk_token": null
|
| 30 |
+
}
|