初始化项目,由ModelHub XC社区提供模型
Model: kabilesh-c/daedalus-designer-v2 Source: Original Platform
This commit is contained in:
36
.gitattributes
vendored
Normal file
36
.gitattributes
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.model filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||||
|
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||||
316
README.md
Normal file
316
README.md
Normal file
@@ -0,0 +1,316 @@
|
|||||||
|
---
|
||||||
|
license: apache-2.0
|
||||||
|
base_model: Qwen/Qwen2.5-1.5B-Instruct
|
||||||
|
library_name: transformers
|
||||||
|
pipeline_tag: text-generation
|
||||||
|
tags:
|
||||||
|
- openenv
|
||||||
|
- reinforcement-learning
|
||||||
|
- mechanism-design
|
||||||
|
- auctions
|
||||||
|
- llm-agents
|
||||||
|
- grpo
|
||||||
|
- trl
|
||||||
|
- unsloth
|
||||||
|
- peft
|
||||||
|
- lora
|
||||||
|
- qwen2.5
|
||||||
|
language:
|
||||||
|
- en
|
||||||
|
model-index:
|
||||||
|
- name: daedalus-designer-v2
|
||||||
|
results:
|
||||||
|
- task:
|
||||||
|
type: reinforcement-learning
|
||||||
|
name: Adversarial mechanism design (DAEDALUS)
|
||||||
|
dataset:
|
||||||
|
type: kabilesh-c/Daedalus-Env
|
||||||
|
name: DAEDALUS OpenEnv
|
||||||
|
metrics:
|
||||||
|
- type: composite_reward
|
||||||
|
value: 0.434
|
||||||
|
name: Informed-greedy baseline (mean over 30 episodes)
|
||||||
|
- type: composite_reward
|
||||||
|
value: 0.326
|
||||||
|
name: Uniform-random baseline (mean over 30 episodes)
|
||||||
|
---
|
||||||
|
|
||||||
|
# DAEDALUS Designer v2 — Adversarial Auction-Mechanism Design
|
||||||
|
|
||||||
|
> A 1.5 B-parameter LLM that **designs auction mechanisms** robust to a
|
||||||
|
> population of strategic adversaries (colluders, shaders, dropouts,
|
||||||
|
> exploiters). Trained with **GRPO** (TRL) on the
|
||||||
|
> [`kabilesh-c/Daedalus-Env`](https://huggingface.co/spaces/kabilesh-c/Daedalus-Env) OpenEnv environment using
|
||||||
|
> **Unsloth + 4-bit + LoRA**.
|
||||||
|
|
||||||
|
| | |
|
||||||
|
|---|---|
|
||||||
|
| **Live demo (interactive UI)** | [`kabilesh-c/Daedalus-Env`](https://huggingface.co/spaces/kabilesh-c/Daedalus-Env) |
|
||||||
|
| **Base model** | [`Qwen/Qwen2.5-1.5B-Instruct`](https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct) |
|
||||||
|
| **Training Space (image builder)** | [`kabilesh-c/daedalus-training-space`](https://huggingface.co/spaces/kabilesh-c/daedalus-training-space) |
|
||||||
|
| **Long-form blog** | served from the live Space at `/blog.md` |
|
||||||
|
| **Standalone script** | `inference.py` in the live Space repo |
|
||||||
|
| **Author** | Laksh Krish Kabilesh |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. What this model does
|
||||||
|
|
||||||
|
Given a partial observation of an auction market — recent (welfare,
|
||||||
|
fairness, participation) outcomes, round number, episode length — the
|
||||||
|
model emits a **structured JSON mechanism**:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"auction_type": "second_price",
|
||||||
|
"reserve_price": 0.18,
|
||||||
|
"reveal_reserve": false,
|
||||||
|
"reveal_competing_bids": false,
|
||||||
|
"reveal_winner_identity": true,
|
||||||
|
"reveal_clearing_price": true,
|
||||||
|
"reveal_bid_distribution": false,
|
||||||
|
"shill_penalty": 1.2,
|
||||||
|
"withdrawal_penalty": 0.6,
|
||||||
|
"collusion_penalty": 1.9,
|
||||||
|
"coalition_policy": "penalize_suspected"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The mechanism is then *used* — the env runs 5 market rounds against an
|
||||||
|
adaptive adversarial population, and scores the result on the composite
|
||||||
|
reward `R = welfare_ratio · fairness_score · participation_rate · stability_score`.
|
||||||
|
|
||||||
|
This is the **inverse** of the usual RL setup: the model is the
|
||||||
|
*referee*, not the player.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. Model details
|
||||||
|
|
||||||
|
| | |
|
||||||
|
|---|---|
|
||||||
|
| **Architecture** | Qwen2.5-1.5B-Instruct (decoder-only transformer, 28 layers) |
|
||||||
|
| **Total parameters** | 1,562,179,072 |
|
||||||
|
| **Trainable parameters (LoRA)** | 18,464,768 (**1.18 %**) |
|
||||||
|
| **PEFT method** | LoRA, r = 16, applied to all attention + MLP linear layers |
|
||||||
|
| **Quantisation (training)** | 4-bit NF4 via `bitsandbytes` + Unsloth |
|
||||||
|
| **Storage format** | merged 16-bit `bf16` (no separate adapter file required at inference) |
|
||||||
|
| **Context length** | 32,768 tokens (Qwen2.5 default) |
|
||||||
|
| **Output schema** | Pydantic `DaedalusAction` — see live Space for full type definition |
|
||||||
|
| **License** | Apache-2.0 (inherited from Qwen2.5-1.5B-Instruct) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Training details
|
||||||
|
|
||||||
|
### Pipeline
|
||||||
|
|
||||||
|
```
|
||||||
|
Qwen2.5-1.5B-Instruct (4-bit, Unsloth)
|
||||||
|
|
|
||||||
|
| LoRA r=16 on attn + MLP
|
||||||
|
v
|
||||||
|
+--- SFT on synthetic (prompt, valid_mechanism) pairs
|
||||||
|
| (teaches JSON shape only; ~300 steps)
|
||||||
|
v
|
||||||
|
GRPO (TRL) on DAEDALUS env, 50 steps
|
||||||
|
reward = format_reward + welfare + fairness + composite
|
||||||
|
|
|
||||||
|
| merge_and_unload + push_to_hub_merged
|
||||||
|
v
|
||||||
|
kabilesh-c/daedalus-designer-v2 (this checkpoint)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Hyperparameters
|
||||||
|
|
||||||
|
| | |
|
||||||
|
|---|---|
|
||||||
|
| **RL algorithm** | GRPO (Group-Relative PPO, no value head) |
|
||||||
|
| **Generations per state** | 4 |
|
||||||
|
| **Steps** | 50 |
|
||||||
|
| **Batch size** | 4 × 2 grad-accum × 1 GPU = 8 effective |
|
||||||
|
| **Learning rate** | 5e-6 (LoRA) |
|
||||||
|
| **Reward stack** | `format` (JSON parseability) → `welfare` → `fairness` → `composite` |
|
||||||
|
| **Hardware** | 1 × NVIDIA L4 (24 GB) on Hugging Face Jobs |
|
||||||
|
| **Wall-clock** | ~7 minutes per +50-step iteration |
|
||||||
|
| **Cost** | ~\$0.10 per iteration |
|
||||||
|
|
||||||
|
### Training signals (from `training_history.json`)
|
||||||
|
|
||||||
|
| Metric | Range | Mean | What it tells you |
|
||||||
|
|---|---|---|---|
|
||||||
|
| `grad_norm` | 0.46 – 0.84 | 0.71 | healthy gradient flow, no vanish/explode |
|
||||||
|
| `reward_std` (within-group) | 0.53 – 0.86 | 0.69 | GRPO advantage signal stays informative |
|
||||||
|
| `entropy` (policy) | 1.65 – 2.50 nats | 1.95 | narrowed by ~5.5 nats from uniform; still exploring |
|
||||||
|
| `completions/mean_length` | 140 tokens (pinned) | 140 | schema-locked output |
|
||||||
|
|
||||||
|
Plots and per-step CSV are served from the live Space at `/plots/`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. Evaluation
|
||||||
|
|
||||||
|
30-episode baseline boxplot on the env's true composite reward (no
|
||||||
|
training-time shaping):
|
||||||
|
|
||||||
|
| Policy | Mean R | IQR |
|
||||||
|
|---|---|---|
|
||||||
|
| Uniform-random mechanisms | **+0.326** | ≈ 0.27 |
|
||||||
|
| Informed-greedy (hand-engineered "robust") | **+0.434** | ≈ 0.21 |
|
||||||
|
|
||||||
|
The +0.108 gap (≈ +33 % relative) is the structural signal the model is
|
||||||
|
trained to find. The trained model's online behaviour can be inspected
|
||||||
|
directly in the live Space — every `/api/design` call hits this
|
||||||
|
checkpoint.
|
||||||
|
|
||||||
|
A typical stage-3 (mixed shaders + colluders) output:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"auction_type": "second_price",
|
||||||
|
"reserve_price": 0.18,
|
||||||
|
"reveal_competing_bids": false,
|
||||||
|
"reveal_clearing_price": true,
|
||||||
|
"reveal_winner_identity": true,
|
||||||
|
"collusion_penalty": 1.9,
|
||||||
|
"shill_penalty": 1.2,
|
||||||
|
"withdrawal_penalty": 0.6,
|
||||||
|
"coalition_policy": "penalize_suspected"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Three things to read off this:
|
||||||
|
1. Picks **second-price** (truthful in static, robust to non-VCG-aware bidders).
|
||||||
|
2. **Hides bid distribution but reveals clearing price** — gives honest bidders calibration signal while starving cartels of enforcement signal.
|
||||||
|
3. Penalty ranking: `collusion (1.9) > shill (1.2) > withdrawal (0.6)` matches the relative cost of each pathology in this population.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Inference
|
||||||
|
|
||||||
|
### 5.1 Hosted (no setup) — call the live Space
|
||||||
|
|
||||||
|
```python
|
||||||
|
import requests
|
||||||
|
|
||||||
|
BASE = "https://kabilesh-c-daedalus-env.hf.space"
|
||||||
|
|
||||||
|
# Reset and read the initial observation
|
||||||
|
r = requests.post(BASE + "/reset",
|
||||||
|
json={"session_id": "demo", "n_agents": 8, "episode_length": 10})
|
||||||
|
obs = r.json()["observation"]
|
||||||
|
|
||||||
|
# Ask the trained designer for a mechanism
|
||||||
|
r = requests.post(BASE + "/api/design", json={
|
||||||
|
"round_number": obs["round_number"],
|
||||||
|
"episode_length": obs["episode_length"],
|
||||||
|
"market_outcomes": obs.get("market_outcomes", []),
|
||||||
|
})
|
||||||
|
print(r.json()["mechanism"])
|
||||||
|
|
||||||
|
# Apply it and observe the reward
|
||||||
|
r = requests.post(BASE + "/step",
|
||||||
|
json={"session_id": "demo", "action": r.json()["mechanism"]})
|
||||||
|
print("R =", r.json()["reward"])
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5.2 Local — `transformers` + `huggingface_hub`
|
||||||
|
|
||||||
|
> **Important:** this repo was originally pushed via Unsloth's
|
||||||
|
> `save_pretrained_merged()`, which leaves a leftover `adapter_config.json`
|
||||||
|
> whose `base_model_name_or_path` points at `./sft-merged` (a path that
|
||||||
|
> only exists on the training filesystem). Plain `from_pretrained(repo_id)`
|
||||||
|
> will follow that pointer and crash with
|
||||||
|
> `HFValidationError: Repo id must use alphanumeric chars`. Use
|
||||||
|
> `snapshot_download` with `ignore_patterns` to skip the adapter file:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from huggingface_hub import snapshot_download
|
||||||
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||||
|
import torch
|
||||||
|
|
||||||
|
local_dir = snapshot_download(
|
||||||
|
repo_id="kabilesh-c/daedalus-designer-v2",
|
||||||
|
ignore_patterns=["adapter_config.json", "adapter_model.safetensors"],
|
||||||
|
)
|
||||||
|
|
||||||
|
tok = AutoTokenizer.from_pretrained(local_dir)
|
||||||
|
model = AutoModelForCausalLM.from_pretrained(
|
||||||
|
local_dir,
|
||||||
|
torch_dtype=torch.bfloat16, # fp16 if no bf16
|
||||||
|
device_map="auto",
|
||||||
|
)
|
||||||
|
|
||||||
|
system = (
|
||||||
|
"You are an auction mechanism designer. Given a market observation, "
|
||||||
|
"output ONLY a JSON object matching the DaedalusAction schema."
|
||||||
|
)
|
||||||
|
user = (
|
||||||
|
"round_number: 3 / 10\n"
|
||||||
|
"recent_outcomes: [{welfare:0.7, fairness:0.4, participation:1.0}]\n"
|
||||||
|
"Respond with the JSON only."
|
||||||
|
)
|
||||||
|
prompt = tok.apply_chat_template(
|
||||||
|
[{"role": "system", "content": system},
|
||||||
|
{"role": "user", "content": user}],
|
||||||
|
tokenize=False, add_generation_prompt=True,
|
||||||
|
)
|
||||||
|
ids = tok(prompt, return_tensors="pt").to(model.device)
|
||||||
|
out = model.generate(**ids, max_new_tokens=180, do_sample=False, temperature=0.0)
|
||||||
|
print(tok.decode(out[0, ids.input_ids.shape[1]:], skip_special_tokens=True))
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5.3 Local — full env rollouts via `inference.py`
|
||||||
|
|
||||||
|
The repo at [`kabilesh-c/Daedalus-Env`](https://huggingface.co/spaces/kabilesh-c/Daedalus-Env) ships an
|
||||||
|
`inference.py` that reproduces the §4 baseline numbers:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# one-shot mechanism for a fresh env
|
||||||
|
python inference.py
|
||||||
|
|
||||||
|
# 30 episodes trained-vs-random (writes inference_results.json)
|
||||||
|
python inference.py --n-episodes 30 --baseline
|
||||||
|
|
||||||
|
# point at a different checkpoint
|
||||||
|
python inference.py --repo-id kabilesh-c/daedalus-designer-v2
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. Intended use & limitations
|
||||||
|
|
||||||
|
**Intended use:** demonstration / research on LLM-driven mechanism
|
||||||
|
design. The model is trained to output well-formed `DaedalusAction`
|
||||||
|
JSON for the DAEDALUS env; it has no production guarantees.
|
||||||
|
|
||||||
|
**Limitations:**
|
||||||
|
- Trained for only 50 GRPO steps — the +50 step lift over a randomly-
|
||||||
|
initialised LoRA is real but small in absolute terms (composite-reward
|
||||||
|
mean from −0.594 → −0.579).
|
||||||
|
- The "format reward" dominates early steps; malformed JSON is heavily
|
||||||
|
penalised, so the model is **schema-locked but not strategically
|
||||||
|
perfect**. On stage-4 (full-adversarial) populations it occasionally
|
||||||
|
emits `coalition_policy: "allow"`, which craters the run.
|
||||||
|
- Reward is engineered for the DAEDALUS env's specific multiplicative
|
||||||
|
composite. The model is **not** guaranteed to produce sensible
|
||||||
|
mechanisms outside this rubric.
|
||||||
|
- Inherits any biases / failure modes from
|
||||||
|
[`Qwen/Qwen2.5-1.5B-Instruct`](https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. Citation
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@misc{kabilesh2026daedalus,
|
||||||
|
title = {DAEDALUS: Training an LLM to Design Auction Markets via Adversarial RL},
|
||||||
|
author = {Laksh Krish Kabilesh},
|
||||||
|
year = {2026},
|
||||||
|
url = {https://huggingface.co/spaces/kabilesh-c/Daedalus-Env},
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Made by Laksh Krish Kabilesh.*
|
||||||
25
added_tokens.json
Normal file
25
added_tokens.json
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"</tool_call>": 151658,
|
||||||
|
"<tool_call>": 151657,
|
||||||
|
"<|PAD_TOKEN|>": 151665,
|
||||||
|
"<|box_end|>": 151649,
|
||||||
|
"<|box_start|>": 151648,
|
||||||
|
"<|endoftext|>": 151643,
|
||||||
|
"<|file_sep|>": 151664,
|
||||||
|
"<|fim_middle|>": 151660,
|
||||||
|
"<|fim_pad|>": 151662,
|
||||||
|
"<|fim_prefix|>": 151659,
|
||||||
|
"<|fim_suffix|>": 151661,
|
||||||
|
"<|im_end|>": 151645,
|
||||||
|
"<|im_start|>": 151644,
|
||||||
|
"<|image_pad|>": 151655,
|
||||||
|
"<|object_ref_end|>": 151647,
|
||||||
|
"<|object_ref_start|>": 151646,
|
||||||
|
"<|quad_end|>": 151651,
|
||||||
|
"<|quad_start|>": 151650,
|
||||||
|
"<|repo_name|>": 151663,
|
||||||
|
"<|video_pad|>": 151656,
|
||||||
|
"<|vision_end|>": 151653,
|
||||||
|
"<|vision_pad|>": 151654,
|
||||||
|
"<|vision_start|>": 151652
|
||||||
|
}
|
||||||
54
chat_template.jinja
Normal file
54
chat_template.jinja
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
{%- if tools %}
|
||||||
|
{{- '<|im_start|>system\n' }}
|
||||||
|
{%- if messages[0]['role'] == 'system' %}
|
||||||
|
{{- messages[0]['content'] }}
|
||||||
|
{%- else %}
|
||||||
|
{{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- "\n\n# 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>" }}
|
||||||
|
{%- for tool in tools %}
|
||||||
|
{{- "\n" }}
|
||||||
|
{{- tool | tojson }}
|
||||||
|
{%- endfor %}
|
||||||
|
{{- "\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" }}
|
||||||
|
{%- else %}
|
||||||
|
{%- if messages[0]['role'] == 'system' %}
|
||||||
|
{{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
|
||||||
|
{%- else %}
|
||||||
|
{{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- for message in messages %}
|
||||||
|
{%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}
|
||||||
|
{{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
|
||||||
|
{%- elif message.role == "assistant" %}
|
||||||
|
{{- '<|im_start|>' + message.role }}
|
||||||
|
{%- if message.content %}
|
||||||
|
{{- '\n' + message.content }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- for tool_call in message.tool_calls %}
|
||||||
|
{%- if tool_call.function is defined %}
|
||||||
|
{%- set tool_call = tool_call.function %}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '\n<tool_call>\n{"name": "' }}
|
||||||
|
{{- tool_call.name }}
|
||||||
|
{{- '", "arguments": ' }}
|
||||||
|
{{- tool_call.arguments | tojson }}
|
||||||
|
{{- '}\n</tool_call>' }}
|
||||||
|
{%- endfor %}
|
||||||
|
{{- '<|im_end|>\n' }}
|
||||||
|
{%- elif message.role == "tool" %}
|
||||||
|
{%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
|
||||||
|
{{- '<|im_start|>user' }}
|
||||||
|
{%- endif %}
|
||||||
|
{{- '\n<tool_response>\n' }}
|
||||||
|
{{- message.content }}
|
||||||
|
{{- '\n</tool_response>' }}
|
||||||
|
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
||||||
|
{{- '<|im_end|>\n' }}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- if add_generation_prompt %}
|
||||||
|
{{- '<|im_start|>assistant\n' }}
|
||||||
|
{%- endif %}
|
||||||
59
config.json
Normal file
59
config.json
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"architectures": [
|
||||||
|
"Qwen2ForCausalLM"
|
||||||
|
],
|
||||||
|
"attention_dropout": 0.0,
|
||||||
|
"torch_dtype": "bfloat16",
|
||||||
|
"eos_token_id": 151645,
|
||||||
|
"hidden_act": "silu",
|
||||||
|
"hidden_size": 1536,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"intermediate_size": 8960,
|
||||||
|
"layer_types": [
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention",
|
||||||
|
"full_attention"
|
||||||
|
],
|
||||||
|
"max_position_embeddings": 32768,
|
||||||
|
"max_window_layers": 21,
|
||||||
|
"model_type": "qwen2",
|
||||||
|
"num_attention_heads": 12,
|
||||||
|
"num_hidden_layers": 28,
|
||||||
|
"num_key_value_heads": 2,
|
||||||
|
"pad_token_id": 151665,
|
||||||
|
"rms_norm_eps": 1e-06,
|
||||||
|
"rope_scaling": null,
|
||||||
|
"rope_theta": 1000000.0,
|
||||||
|
"sliding_window": null,
|
||||||
|
"tie_word_embeddings": true,
|
||||||
|
"unsloth_fixed": true,
|
||||||
|
"unsloth_version": "2026.4.8",
|
||||||
|
"use_cache": true,
|
||||||
|
"use_sliding_window": false,
|
||||||
|
"vocab_size": 151936
|
||||||
|
}
|
||||||
151388
merges.txt
Normal file
151388
merges.txt
Normal file
File diff suppressed because it is too large
Load Diff
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:63be21806668f52c47878604caf0e8b1f3a55e8bbe1c9df86726961852d5abc7
|
||||||
|
size 3087467144
|
||||||
25
special_tokens_map.json
Normal file
25
special_tokens_map.json
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"additional_special_tokens": [
|
||||||
|
"<|im_start|>",
|
||||||
|
"<|im_end|>",
|
||||||
|
"<|object_ref_start|>",
|
||||||
|
"<|object_ref_end|>",
|
||||||
|
"<|box_start|>",
|
||||||
|
"<|box_end|>",
|
||||||
|
"<|quad_start|>",
|
||||||
|
"<|quad_end|>",
|
||||||
|
"<|vision_start|>",
|
||||||
|
"<|vision_end|>",
|
||||||
|
"<|vision_pad|>",
|
||||||
|
"<|image_pad|>",
|
||||||
|
"<|video_pad|>"
|
||||||
|
],
|
||||||
|
"eos_token": {
|
||||||
|
"content": "<|im_end|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"pad_token": "<|PAD_TOKEN|>"
|
||||||
|
}
|
||||||
3
tokenizer.json
Normal file
3
tokenizer.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:a11add1ccce473bcd467355ba4e231ba727eee54501528658b0d6fa18112957e
|
||||||
|
size 11422253
|
||||||
217
tokenizer_config.json
Normal file
217
tokenizer_config.json
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
{
|
||||||
|
"add_bos_token": false,
|
||||||
|
"add_prefix_space": false,
|
||||||
|
"added_tokens_decoder": {
|
||||||
|
"151643": {
|
||||||
|
"content": "<|endoftext|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151644": {
|
||||||
|
"content": "<|im_start|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151645": {
|
||||||
|
"content": "<|im_end|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151646": {
|
||||||
|
"content": "<|object_ref_start|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151647": {
|
||||||
|
"content": "<|object_ref_end|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151648": {
|
||||||
|
"content": "<|box_start|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151649": {
|
||||||
|
"content": "<|box_end|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151650": {
|
||||||
|
"content": "<|quad_start|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151651": {
|
||||||
|
"content": "<|quad_end|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151652": {
|
||||||
|
"content": "<|vision_start|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151653": {
|
||||||
|
"content": "<|vision_end|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151654": {
|
||||||
|
"content": "<|vision_pad|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151655": {
|
||||||
|
"content": "<|image_pad|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151656": {
|
||||||
|
"content": "<|video_pad|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"151657": {
|
||||||
|
"content": "<tool_call>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": false
|
||||||
|
},
|
||||||
|
"151658": {
|
||||||
|
"content": "</tool_call>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": false
|
||||||
|
},
|
||||||
|
"151659": {
|
||||||
|
"content": "<|fim_prefix|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": false
|
||||||
|
},
|
||||||
|
"151660": {
|
||||||
|
"content": "<|fim_middle|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": false
|
||||||
|
},
|
||||||
|
"151661": {
|
||||||
|
"content": "<|fim_suffix|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": false
|
||||||
|
},
|
||||||
|
"151662": {
|
||||||
|
"content": "<|fim_pad|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": false
|
||||||
|
},
|
||||||
|
"151663": {
|
||||||
|
"content": "<|repo_name|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": false
|
||||||
|
},
|
||||||
|
"151664": {
|
||||||
|
"content": "<|file_sep|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": false
|
||||||
|
},
|
||||||
|
"151665": {
|
||||||
|
"content": "<|PAD_TOKEN|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additional_special_tokens": [
|
||||||
|
"<|im_start|>",
|
||||||
|
"<|im_end|>",
|
||||||
|
"<|object_ref_start|>",
|
||||||
|
"<|object_ref_end|>",
|
||||||
|
"<|box_start|>",
|
||||||
|
"<|box_end|>",
|
||||||
|
"<|quad_start|>",
|
||||||
|
"<|quad_end|>",
|
||||||
|
"<|vision_start|>",
|
||||||
|
"<|vision_end|>",
|
||||||
|
"<|vision_pad|>",
|
||||||
|
"<|image_pad|>",
|
||||||
|
"<|video_pad|>"
|
||||||
|
],
|
||||||
|
"bos_token": null,
|
||||||
|
"clean_up_tokenization_spaces": false,
|
||||||
|
"eos_token": "<|im_end|>",
|
||||||
|
"errors": "replace",
|
||||||
|
"extra_special_tokens": {},
|
||||||
|
"model_max_length": 32768,
|
||||||
|
"pad_token": "<|PAD_TOKEN|>",
|
||||||
|
"padding_side": "left",
|
||||||
|
"split_special_tokens": false,
|
||||||
|
"tokenizer_class": "Qwen2Tokenizer",
|
||||||
|
"unk_token": null,
|
||||||
|
"chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}\n {%- endif %}\n {{- \"\\n\\n# 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>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\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\" }}\n{%- else %}\n {%- if messages[0]['role'] == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0]['content'] + '<|im_end|>\\n' }}\n {%- else %}\n {{- '<|im_start|>system\\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) or (message.role == \"assistant\" and not message.tool_calls) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role }}\n {%- if message.content %}\n {{- '\\n' + message.content }}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\\n<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n"
|
||||||
|
}
|
||||||
1
vocab.json
Normal file
1
vocab.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user