Upload encoder v0 LoRA adapter (Qwen2.5-0.5B + LoRA rank=16) — Stage 5 final
Browse files- .gitattributes +1 -0
- README.md +251 -0
- adapter_config.json +45 -0
- adapter_model.safetensors +3 -0
- added_tokens.json +24 -0
- chat_template.jinja +54 -0
- merges.txt +0 -0
- special_tokens_map.json +31 -0
- tokenizer.json +3 -0
- tokenizer_config.json +207 -0
- vocab.json +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ 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
|
README.md
CHANGED
|
@@ -1,3 +1,254 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
base_model: Qwen/Qwen2.5-0.5B-Instruct
|
| 4 |
+
library_name: peft
|
| 5 |
+
tags:
|
| 6 |
+
- memory-encoder
|
| 7 |
+
- lora
|
| 8 |
+
- structured-extraction
|
| 9 |
+
- lycheemem
|
| 10 |
+
language:
|
| 11 |
+
- en
|
| 12 |
+
pipeline_tag: text-generation
|
| 13 |
---
|
| 14 |
+
|
| 15 |
+
# Encoder v0 — Memory Encoder for LycheeMem
|
| 16 |
+
|
| 17 |
+
A LoRA adapter on top of **Qwen2.5-0.5B-Instruct** that turns conversation turns into structured `MemoryRecord` JSON (typed, atomic, with entities / temporal / evidence span / source_role). Trained by distilling DeepSeek V4 Flash and selecting high-quality candidates via a 4-dim verifier.
|
| 18 |
+
|
| 19 |
+
Designed as a drop-in encoder for [LycheeMem](https://github.com/LycheeMem/lycheemem)'s write-side memory pipeline, with **physical JSON schema guarantee via constrained decoding** (outlines + Pydantic).
|
| 20 |
+
|
| 21 |
+
## Highlights
|
| 22 |
+
|
| 23 |
+
- **8.7 MB LoRA adapter** on a 0.5B base — runs locally on a single RTX 4060 Ti 8GB, zero API cost
|
| 24 |
+
- **+125% weighted_score** over the runtime Qwen2.5-7B baseline on a 519-sample held set
|
| 25 |
+
- **100% JSON schema compliance** with constrained decoding (vs 74% for runtime baseline, 96-98% for SOTA prompt-only)
|
| 26 |
+
- **4× faster** than the runtime baseline (3.4s vs 20s p50 latency)
|
| 27 |
+
- On LongMemEval-style task dialogs, **outperforms even Qwen2.5-72B and V4 Flash teacher** on weighted_score (3.749 vs 3.666 / 3.700)
|
| 28 |
+
|
| 29 |
+
## Evaluation
|
| 30 |
+
|
| 31 |
+
Evaluated on 519 held-out conversation segments (LongMemEval-S + MSC-MemFuse-MC10, English personal dialogs). The **weighted_score** is a 4-dim LLM-as-judge metric (V4 Flash) on `atomicity / self_containedness / entity_coverage / evidence_alignment`, weighted 0.25 / 0.30 / 0.20 / 0.25, with failures scored 0 (out of 5.0).
|
| 32 |
+
|
| 33 |
+
### 7-Model Leaderboard
|
| 34 |
+
|
| 35 |
+
| rank | model | size | weighted_score | schema_ok | latency p50 |
|
| 36 |
+
|---|---|---|---|---|---|
|
| 37 |
+
| 1 | DeepSeek-V3 | 671B (MoE) | 4.057 | 96.9% | 44s |
|
| 38 |
+
| 2 | Qwen2.5-72B-Instruct | 72B | 3.951 | 98.8% | 33s |
|
| 39 |
+
| 3 | DeepSeek V4 Flash (teacher) | — | 3.833 | 95.8% | 14s |
|
| 40 |
+
| **4** | **encoder_v0 (this model)** | **0.5B + LoRA** | **3.775** | **100.0%** | **3.4s** |
|
| 41 |
+
| 5 | Qwen3-32B | 32B | 3.476 | 97.7% | 67s |
|
| 42 |
+
| 6 | Qwen2.5-14B-Instruct | 14B | 1.946 | 80.5% | 19s |
|
| 43 |
+
| 7 | Qwen2.5-7B-Instruct (runtime baseline) | 7B | 1.679 | 74.0% | 20s |
|
| 44 |
+
|
| 45 |
+
### 4-Dim Quality Breakdown
|
| 46 |
+
|
| 47 |
+
| model | atomicity | self_cont | entity_cov | evidence |
|
| 48 |
+
|---|---|---|---|---|
|
| 49 |
+
| DeepSeek-V3 | 4.61 | 4.90 | 4.27 | 3.60 |
|
| 50 |
+
| Qwen2.5-72B | 4.89 | 4.85 | 4.14 | 3.54 |
|
| 51 |
+
| V4 Flash (teacher) | 4.48 | 4.88 | 4.21 | 3.94 |
|
| 52 |
+
| **encoder_v0** | **4.53** | **4.51** | **2.93** ⚠️ | **3.30** |
|
| 53 |
+
| Qwen3-32B | 4.38 | 4.74 | 4.13 | 3.18 |
|
| 54 |
+
| Qwen2.5-7B | 4.20 | 4.47 | 3.27 | 2.98 |
|
| 55 |
+
|
| 56 |
+
`entity_coverage` is the model's main known weakness (1.0-1.3 points below SOTA), planned to be addressed in v2.
|
| 57 |
+
|
| 58 |
+
### Per-Source Breakdown
|
| 59 |
+
|
| 60 |
+
| model | LongMemEval | MSC |
|
| 61 |
+
|---|---|---|
|
| 62 |
+
| DeepSeek-V3 | 3.871 | 4.357 |
|
| 63 |
+
| Qwen2.5-72B | 3.666 | 4.408 |
|
| 64 |
+
| V4 Flash (teacher) | 3.700 | 4.047 |
|
| 65 |
+
| **encoder_v0** | **3.749** | **3.817** |
|
| 66 |
+
| Qwen2.5-7B (baseline) | 1.330 | 2.241 |
|
| 67 |
+
|
| 68 |
+
On task-oriented dialogs (LongMemEval), encoder_v0 actually **surpasses both Qwen2.5-72B and the V4 Flash teacher**.
|
| 69 |
+
|
| 70 |
+
## Training
|
| 71 |
+
|
| 72 |
+
```text
|
| 73 |
+
Pipeline:
|
| 74 |
+
Stage 1: 5000 conversation segments from LongMemEval-S + MSC-MemFuse-MC10
|
| 75 |
+
Stage 2a: V4 Flash distillation → 4769 candidate record sets
|
| 76 |
+
Stage 2b: Rule + V4 Flash verifier (4-dim ≥ 4.0) → 2590 pseudo-gold
|
| 77 |
+
Stage 2c: +394 synthetic advice-class samples (gold = empty records)
|
| 78 |
+
Stage 3: LoRA SFT on Qwen2.5-0.5B-Instruct
|
| 79 |
+
rank=16, alpha=32, dropout=0.05
|
| 80 |
+
target_modules = q_proj, k_proj, v_proj, o_proj
|
| 81 |
+
3 epochs, batch=1*accum16, lr=2e-4, bf16
|
| 82 |
+
28.5 min on RTX 4060 Ti 8GB
|
| 83 |
+
|
| 84 |
+
Trainable params: 2.16M / 496M = 0.44%
|
| 85 |
+
Final eval loss: 0.293
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
Total training cost: ~¥24 (API for distillation + verifier) + 28 min local GPU.
|
| 89 |
+
|
| 90 |
+
## Intended Use
|
| 91 |
+
|
| 92 |
+
**Primary use**: Drop-in write-side encoder for LycheeMem (or similar long-term memory systems) that takes a conversation segment and outputs `MemoryRecord` JSON suitable for storage and downstream retrieval.
|
| 93 |
+
|
| 94 |
+
**Input format**:
|
| 95 |
+
|
| 96 |
+
```python
|
| 97 |
+
{
|
| 98 |
+
"previous_turns": [{"role": "user", "content": "..."}, ...], # optional
|
| 99 |
+
"current_turns": [{"role": "user", "content": "..."}, ...], # required
|
| 100 |
+
"session_date": "2026-05-12" # optional, ISO or freeform
|
| 101 |
+
}
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
**Output format** (strict JSON, guaranteed by constrained decoding):
|
| 105 |
+
|
| 106 |
+
```python
|
| 107 |
+
{
|
| 108 |
+
"records": [
|
| 109 |
+
{
|
| 110 |
+
"memory_type": "fact|preference|event|constraint|procedure|failure_pattern|tool_affordance",
|
| 111 |
+
"semantic_text": "User plans to visit Beijing on 2026-05-20 to meet Li Hua.",
|
| 112 |
+
"entities": ["Beijing", "Li Hua"],
|
| 113 |
+
"temporal": {"t_ref": "2026-05-12", "t_valid_from": "2026-05-20", "t_valid_to": ""},
|
| 114 |
+
"tags": ["travel", "meeting"],
|
| 115 |
+
"evidence_turns": [0],
|
| 116 |
+
"source_role": "user"
|
| 117 |
+
}
|
| 118 |
+
]
|
| 119 |
+
}
|
| 120 |
+
```
|
| 121 |
+
|
| 122 |
+
## How to Use
|
| 123 |
+
|
| 124 |
+
### Install dependencies
|
| 125 |
+
|
| 126 |
+
```bash
|
| 127 |
+
pip install transformers peft outlines pydantic torch
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
### Inference (with constrained decoding — recommended)
|
| 131 |
+
|
| 132 |
+
```python
|
| 133 |
+
import torch
|
| 134 |
+
import outlines
|
| 135 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 136 |
+
from peft import PeftModel
|
| 137 |
+
from pydantic import BaseModel
|
| 138 |
+
from typing import Literal
|
| 139 |
+
|
| 140 |
+
# 1. Load base + LoRA adapter
|
| 141 |
+
BASE = "Qwen/Qwen2.5-0.5B-Instruct"
|
| 142 |
+
ADAPTER = "fuhao23/encoder_v0"
|
| 143 |
+
|
| 144 |
+
tok = AutoTokenizer.from_pretrained(BASE, trust_remote_code=True)
|
| 145 |
+
base = AutoModelForCausalLM.from_pretrained(
|
| 146 |
+
BASE, torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True
|
| 147 |
+
)
|
| 148 |
+
model_hf = PeftModel.from_pretrained(base, ADAPTER).eval()
|
| 149 |
+
|
| 150 |
+
# 2. Define output schema (must match the schema used in training)
|
| 151 |
+
class Temporal(BaseModel):
|
| 152 |
+
t_ref: str = ""
|
| 153 |
+
t_valid_from: str = ""
|
| 154 |
+
t_valid_to: str = ""
|
| 155 |
+
|
| 156 |
+
class MemoryRecord(BaseModel):
|
| 157 |
+
memory_type: Literal["fact", "preference", "event", "constraint",
|
| 158 |
+
"procedure", "failure_pattern", "tool_affordance"]
|
| 159 |
+
semantic_text: str
|
| 160 |
+
entities: list[str]
|
| 161 |
+
temporal: Temporal
|
| 162 |
+
tags: list[str]
|
| 163 |
+
evidence_turns: list[int]
|
| 164 |
+
source_role: Literal["user", "assistant", "both", ""]
|
| 165 |
+
|
| 166 |
+
class MemoryRecordList(BaseModel):
|
| 167 |
+
records: list[MemoryRecord]
|
| 168 |
+
|
| 169 |
+
model = outlines.from_transformers(model_hf, tok)
|
| 170 |
+
generator = outlines.Generator(model, MemoryRecordList)
|
| 171 |
+
|
| 172 |
+
# 3. The system prompt this adapter was trained on (use COMPACT_ENCODING_SYSTEM
|
| 173 |
+
# from LycheeMem: src/memory/semantic/prompts.py:13-85). Must use as-is.
|
| 174 |
+
SYSTEM_PROMPT = """You are a memory extractor for a personal AI assistant's
|
| 175 |
+
long-term memory system. ... (full prompt in LycheeMem repo)"""
|
| 176 |
+
|
| 177 |
+
# 4. Build user content + encode
|
| 178 |
+
user_content = """\
|
| 179 |
+
<PREVIOUS_TURNS>
|
| 180 |
+
(no previous turns)
|
| 181 |
+
</PREVIOUS_TURNS>
|
| 182 |
+
|
| 183 |
+
<CURRENT_TURNS>
|
| 184 |
+
user: I want to try out my new slow cooker from Bed Bath & Beyond.
|
| 185 |
+
assistant: Congratulations! Slow cookers are great for ...
|
| 186 |
+
user: Thanks for the cleaning tips.
|
| 187 |
+
</CURRENT_TURNS>"""
|
| 188 |
+
|
| 189 |
+
prompt = tok.apply_chat_template(
|
| 190 |
+
[{"role": "system", "content": SYSTEM_PROMPT},
|
| 191 |
+
{"role": "user", "content": user_content}],
|
| 192 |
+
tokenize=False, add_generation_prompt=True,
|
| 193 |
+
)
|
| 194 |
+
output = generator(prompt, max_new_tokens=1024)
|
| 195 |
+
print(output)
|
| 196 |
+
# Output: strict JSON of {"records": [...]}
|
| 197 |
+
```
|
| 198 |
+
|
| 199 |
+
### Inference (without constrained decoding — not recommended)
|
| 200 |
+
|
| 201 |
+
The model **CAN** be used without `outlines`, but **schema compliance drops from 100% to ~64%** due to base Qwen2.5-0.5B's tendency to regress to conversation-continuation mode on assistant-advice-heavy inputs. Always use constrained decoding for production.
|
| 202 |
+
|
| 203 |
+
## Limitations
|
| 204 |
+
|
| 205 |
+
This is a v0 research release. **Read carefully before deployment**:
|
| 206 |
+
|
| 207 |
+
1. **LLM-as-judge bias in evaluation**. The `weighted_score` is computed using V4 Flash as judge — the same model family as the teacher. Comparisons against models stronger than V4 Flash (Qwen2.5-72B, DeepSeek-V3) may have ceiling effects; the precise SOTA ranking around rank 1-4 is not fully reliable.
|
| 208 |
+
|
| 209 |
+
2. **No human ground truth**. No human annotator has labeled records as "good / bad" — judge consistency with humans is unverified. Recommended next step: 50-sample human annotation + Cohen's kappa.
|
| 210 |
+
|
| 211 |
+
3. **No downstream retrieval evaluation**. The original training plan included an `evidence retrieval hit@10` benchmark on LongMemEval — this is not yet completed. The current metrics measure **encoder output quality in isolation**, not the end-to-end impact on memory retrieval accuracy.
|
| 212 |
+
|
| 213 |
+
4. **Narrow evaluation distribution**. The 519-sample held set is entirely English personal-dialog (LongMemEval + MSC). Chinese, technical, code, and long-context dialogs are not evaluated. OOD deployment may degrade.
|
| 214 |
+
|
| 215 |
+
5. **Entity coverage weakness**. `entity_coverage` 4-dim score is 2.93 vs SOTA 4.1-4.3 — the encoder under-extracts named entities. Planned fix in v2 with entity-rich training data.
|
| 216 |
+
|
| 217 |
+
6. **Constrained decoding is required for the headline 100% schema_ok**. Without `outlines`, schema compliance drops to ~64%.
|
| 218 |
+
|
| 219 |
+
7. **Not yet integrated into LycheeMem runtime**. No real-traffic data — quality on actual user dialogs vs the eval set is untested.
|
| 220 |
+
|
| 221 |
+
## Method Background
|
| 222 |
+
|
| 223 |
+
Pipeline and evaluation methodology documented in detail at the [LycheeMem repository](https://github.com/LycheeMem/lycheemem):
|
| 224 |
+
|
| 225 |
+
- `docs/encoder_v0.md` — full evaluation report with case studies
|
| 226 |
+
- `docs/encoder_eval_framework.md` — evaluation framework
|
| 227 |
+
- `examples/encoder_v0_try.py` — interactive try-it tool
|
| 228 |
+
|
| 229 |
+
Inspired by [MemReranker](https://arxiv.org/abs/2605.06132)'s small-model distillation methodology for memory systems.
|
| 230 |
+
|
| 231 |
+
## Citation
|
| 232 |
+
|
| 233 |
+
```bibtex
|
| 234 |
+
@misc{lycheemem_encoder_v0,
|
| 235 |
+
title = {Encoder v0: A Distilled Memory Encoder for Long-Term Conversation Memory},
|
| 236 |
+
author = {LycheeMem},
|
| 237 |
+
year = {2026},
|
| 238 |
+
url = {https://huggingface.co/fuhao23/encoder_v0}
|
| 239 |
+
}
|
| 240 |
+
```
|
| 241 |
+
|
| 242 |
+
Base model:
|
| 243 |
+
|
| 244 |
+
```bibtex
|
| 245 |
+
@misc{qwen2.5,
|
| 246 |
+
title = {Qwen2.5: A Party of Foundation Models},
|
| 247 |
+
author = {Qwen Team},
|
| 248 |
+
year = {2024}
|
| 249 |
+
}
|
| 250 |
+
```
|
| 251 |
+
|
| 252 |
+
## License
|
| 253 |
+
|
| 254 |
+
Apache 2.0 (matches base Qwen2.5-0.5B-Instruct license).
|
adapter_config.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alora_invocation_tokens": null,
|
| 3 |
+
"alpha_pattern": {},
|
| 4 |
+
"arrow_config": null,
|
| 5 |
+
"auto_mapping": null,
|
| 6 |
+
"base_model_name_or_path": "Qwen/Qwen2.5-0.5B-Instruct",
|
| 7 |
+
"bias": "none",
|
| 8 |
+
"corda_config": null,
|
| 9 |
+
"ensure_weight_tying": false,
|
| 10 |
+
"eva_config": null,
|
| 11 |
+
"exclude_modules": null,
|
| 12 |
+
"fan_in_fan_out": false,
|
| 13 |
+
"inference_mode": true,
|
| 14 |
+
"init_lora_weights": true,
|
| 15 |
+
"layer_replication": null,
|
| 16 |
+
"layers_pattern": null,
|
| 17 |
+
"layers_to_transform": null,
|
| 18 |
+
"loftq_config": {},
|
| 19 |
+
"lora_alpha": 32,
|
| 20 |
+
"lora_bias": false,
|
| 21 |
+
"lora_dropout": 0.05,
|
| 22 |
+
"lora_ga_config": null,
|
| 23 |
+
"megatron_config": null,
|
| 24 |
+
"megatron_core": "megatron.core",
|
| 25 |
+
"modules_to_save": null,
|
| 26 |
+
"peft_type": "LORA",
|
| 27 |
+
"peft_version": "0.19.1",
|
| 28 |
+
"qalora_group_size": 16,
|
| 29 |
+
"r": 16,
|
| 30 |
+
"rank_pattern": {},
|
| 31 |
+
"revision": null,
|
| 32 |
+
"target_modules": [
|
| 33 |
+
"q_proj",
|
| 34 |
+
"k_proj",
|
| 35 |
+
"v_proj",
|
| 36 |
+
"o_proj"
|
| 37 |
+
],
|
| 38 |
+
"target_parameters": null,
|
| 39 |
+
"task_type": "CAUSAL_LM",
|
| 40 |
+
"trainable_token_indices": null,
|
| 41 |
+
"use_bdlora": null,
|
| 42 |
+
"use_dora": false,
|
| 43 |
+
"use_qalora": false,
|
| 44 |
+
"use_rslora": false
|
| 45 |
+
}
|
adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:463f96e537f695e81a8d830fd501a4b9e93fbab192b67481df6733d97b21efed
|
| 3 |
+
size 8676008
|
added_tokens.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"</tool_call>": 151658,
|
| 3 |
+
"<tool_call>": 151657,
|
| 4 |
+
"<|box_end|>": 151649,
|
| 5 |
+
"<|box_start|>": 151648,
|
| 6 |
+
"<|endoftext|>": 151643,
|
| 7 |
+
"<|file_sep|>": 151664,
|
| 8 |
+
"<|fim_middle|>": 151660,
|
| 9 |
+
"<|fim_pad|>": 151662,
|
| 10 |
+
"<|fim_prefix|>": 151659,
|
| 11 |
+
"<|fim_suffix|>": 151661,
|
| 12 |
+
"<|im_end|>": 151645,
|
| 13 |
+
"<|im_start|>": 151644,
|
| 14 |
+
"<|image_pad|>": 151655,
|
| 15 |
+
"<|object_ref_end|>": 151647,
|
| 16 |
+
"<|object_ref_start|>": 151646,
|
| 17 |
+
"<|quad_end|>": 151651,
|
| 18 |
+
"<|quad_start|>": 151650,
|
| 19 |
+
"<|repo_name|>": 151663,
|
| 20 |
+
"<|video_pad|>": 151656,
|
| 21 |
+
"<|vision_end|>": 151653,
|
| 22 |
+
"<|vision_pad|>": 151654,
|
| 23 |
+
"<|vision_start|>": 151652
|
| 24 |
+
}
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- if tools %}
|
| 2 |
+
{{- '<|im_start|>system\n' }}
|
| 3 |
+
{%- if messages[0]['role'] == 'system' %}
|
| 4 |
+
{{- messages[0]['content'] }}
|
| 5 |
+
{%- else %}
|
| 6 |
+
{{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}
|
| 7 |
+
{%- endif %}
|
| 8 |
+
{{- "\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>" }}
|
| 9 |
+
{%- for tool in tools %}
|
| 10 |
+
{{- "\n" }}
|
| 11 |
+
{{- tool | tojson }}
|
| 12 |
+
{%- endfor %}
|
| 13 |
+
{{- "\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" }}
|
| 14 |
+
{%- else %}
|
| 15 |
+
{%- if messages[0]['role'] == 'system' %}
|
| 16 |
+
{{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
|
| 17 |
+
{%- else %}
|
| 18 |
+
{{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }}
|
| 19 |
+
{%- endif %}
|
| 20 |
+
{%- endif %}
|
| 21 |
+
{%- for message in messages %}
|
| 22 |
+
{%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}
|
| 23 |
+
{{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
|
| 24 |
+
{%- elif message.role == "assistant" %}
|
| 25 |
+
{{- '<|im_start|>' + message.role }}
|
| 26 |
+
{%- if message.content %}
|
| 27 |
+
{{- '\n' + message.content }}
|
| 28 |
+
{%- endif %}
|
| 29 |
+
{%- for tool_call in message.tool_calls %}
|
| 30 |
+
{%- if tool_call.function is defined %}
|
| 31 |
+
{%- set tool_call = tool_call.function %}
|
| 32 |
+
{%- endif %}
|
| 33 |
+
{{- '\n<tool_call>\n{"name": "' }}
|
| 34 |
+
{{- tool_call.name }}
|
| 35 |
+
{{- '", "arguments": ' }}
|
| 36 |
+
{{- tool_call.arguments | tojson }}
|
| 37 |
+
{{- '}\n</tool_call>' }}
|
| 38 |
+
{%- endfor %}
|
| 39 |
+
{{- '<|im_end|>\n' }}
|
| 40 |
+
{%- elif message.role == "tool" %}
|
| 41 |
+
{%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
|
| 42 |
+
{{- '<|im_start|>user' }}
|
| 43 |
+
{%- endif %}
|
| 44 |
+
{{- '\n<tool_response>\n' }}
|
| 45 |
+
{{- message.content }}
|
| 46 |
+
{{- '\n</tool_response>' }}
|
| 47 |
+
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
| 48 |
+
{{- '<|im_end|>\n' }}
|
| 49 |
+
{%- endif %}
|
| 50 |
+
{%- endif %}
|
| 51 |
+
{%- endfor %}
|
| 52 |
+
{%- if add_generation_prompt %}
|
| 53 |
+
{{- '<|im_start|>assistant\n' }}
|
| 54 |
+
{%- endif %}
|
merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additional_special_tokens": [
|
| 3 |
+
"<|im_start|>",
|
| 4 |
+
"<|im_end|>",
|
| 5 |
+
"<|object_ref_start|>",
|
| 6 |
+
"<|object_ref_end|>",
|
| 7 |
+
"<|box_start|>",
|
| 8 |
+
"<|box_end|>",
|
| 9 |
+
"<|quad_start|>",
|
| 10 |
+
"<|quad_end|>",
|
| 11 |
+
"<|vision_start|>",
|
| 12 |
+
"<|vision_end|>",
|
| 13 |
+
"<|vision_pad|>",
|
| 14 |
+
"<|image_pad|>",
|
| 15 |
+
"<|video_pad|>"
|
| 16 |
+
],
|
| 17 |
+
"eos_token": {
|
| 18 |
+
"content": "<|im_end|>",
|
| 19 |
+
"lstrip": false,
|
| 20 |
+
"normalized": false,
|
| 21 |
+
"rstrip": false,
|
| 22 |
+
"single_word": false
|
| 23 |
+
},
|
| 24 |
+
"pad_token": {
|
| 25 |
+
"content": "<|endoftext|>",
|
| 26 |
+
"lstrip": false,
|
| 27 |
+
"normalized": false,
|
| 28 |
+
"rstrip": false,
|
| 29 |
+
"single_word": false
|
| 30 |
+
}
|
| 31 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9c5ae00e602b8860cbd784ba82a8aa14e8feecec692e7076590d014d7b7fdafa
|
| 3 |
+
size 11421896
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": false,
|
| 3 |
+
"add_prefix_space": false,
|
| 4 |
+
"added_tokens_decoder": {
|
| 5 |
+
"151643": {
|
| 6 |
+
"content": "<|endoftext|>",
|
| 7 |
+
"lstrip": false,
|
| 8 |
+
"normalized": false,
|
| 9 |
+
"rstrip": false,
|
| 10 |
+
"single_word": false,
|
| 11 |
+
"special": true
|
| 12 |
+
},
|
| 13 |
+
"151644": {
|
| 14 |
+
"content": "<|im_start|>",
|
| 15 |
+
"lstrip": false,
|
| 16 |
+
"normalized": false,
|
| 17 |
+
"rstrip": false,
|
| 18 |
+
"single_word": false,
|
| 19 |
+
"special": true
|
| 20 |
+
},
|
| 21 |
+
"151645": {
|
| 22 |
+
"content": "<|im_end|>",
|
| 23 |
+
"lstrip": false,
|
| 24 |
+
"normalized": false,
|
| 25 |
+
"rstrip": false,
|
| 26 |
+
"single_word": false,
|
| 27 |
+
"special": true
|
| 28 |
+
},
|
| 29 |
+
"151646": {
|
| 30 |
+
"content": "<|object_ref_start|>",
|
| 31 |
+
"lstrip": false,
|
| 32 |
+
"normalized": false,
|
| 33 |
+
"rstrip": false,
|
| 34 |
+
"single_word": false,
|
| 35 |
+
"special": true
|
| 36 |
+
},
|
| 37 |
+
"151647": {
|
| 38 |
+
"content": "<|object_ref_end|>",
|
| 39 |
+
"lstrip": false,
|
| 40 |
+
"normalized": false,
|
| 41 |
+
"rstrip": false,
|
| 42 |
+
"single_word": false,
|
| 43 |
+
"special": true
|
| 44 |
+
},
|
| 45 |
+
"151648": {
|
| 46 |
+
"content": "<|box_start|>",
|
| 47 |
+
"lstrip": false,
|
| 48 |
+
"normalized": false,
|
| 49 |
+
"rstrip": false,
|
| 50 |
+
"single_word": false,
|
| 51 |
+
"special": true
|
| 52 |
+
},
|
| 53 |
+
"151649": {
|
| 54 |
+
"content": "<|box_end|>",
|
| 55 |
+
"lstrip": false,
|
| 56 |
+
"normalized": false,
|
| 57 |
+
"rstrip": false,
|
| 58 |
+
"single_word": false,
|
| 59 |
+
"special": true
|
| 60 |
+
},
|
| 61 |
+
"151650": {
|
| 62 |
+
"content": "<|quad_start|>",
|
| 63 |
+
"lstrip": false,
|
| 64 |
+
"normalized": false,
|
| 65 |
+
"rstrip": false,
|
| 66 |
+
"single_word": false,
|
| 67 |
+
"special": true
|
| 68 |
+
},
|
| 69 |
+
"151651": {
|
| 70 |
+
"content": "<|quad_end|>",
|
| 71 |
+
"lstrip": false,
|
| 72 |
+
"normalized": false,
|
| 73 |
+
"rstrip": false,
|
| 74 |
+
"single_word": false,
|
| 75 |
+
"special": true
|
| 76 |
+
},
|
| 77 |
+
"151652": {
|
| 78 |
+
"content": "<|vision_start|>",
|
| 79 |
+
"lstrip": false,
|
| 80 |
+
"normalized": false,
|
| 81 |
+
"rstrip": false,
|
| 82 |
+
"single_word": false,
|
| 83 |
+
"special": true
|
| 84 |
+
},
|
| 85 |
+
"151653": {
|
| 86 |
+
"content": "<|vision_end|>",
|
| 87 |
+
"lstrip": false,
|
| 88 |
+
"normalized": false,
|
| 89 |
+
"rstrip": false,
|
| 90 |
+
"single_word": false,
|
| 91 |
+
"special": true
|
| 92 |
+
},
|
| 93 |
+
"151654": {
|
| 94 |
+
"content": "<|vision_pad|>",
|
| 95 |
+
"lstrip": false,
|
| 96 |
+
"normalized": false,
|
| 97 |
+
"rstrip": false,
|
| 98 |
+
"single_word": false,
|
| 99 |
+
"special": true
|
| 100 |
+
},
|
| 101 |
+
"151655": {
|
| 102 |
+
"content": "<|image_pad|>",
|
| 103 |
+
"lstrip": false,
|
| 104 |
+
"normalized": false,
|
| 105 |
+
"rstrip": false,
|
| 106 |
+
"single_word": false,
|
| 107 |
+
"special": true
|
| 108 |
+
},
|
| 109 |
+
"151656": {
|
| 110 |
+
"content": "<|video_pad|>",
|
| 111 |
+
"lstrip": false,
|
| 112 |
+
"normalized": false,
|
| 113 |
+
"rstrip": false,
|
| 114 |
+
"single_word": false,
|
| 115 |
+
"special": true
|
| 116 |
+
},
|
| 117 |
+
"151657": {
|
| 118 |
+
"content": "<tool_call>",
|
| 119 |
+
"lstrip": false,
|
| 120 |
+
"normalized": false,
|
| 121 |
+
"rstrip": false,
|
| 122 |
+
"single_word": false,
|
| 123 |
+
"special": false
|
| 124 |
+
},
|
| 125 |
+
"151658": {
|
| 126 |
+
"content": "</tool_call>",
|
| 127 |
+
"lstrip": false,
|
| 128 |
+
"normalized": false,
|
| 129 |
+
"rstrip": false,
|
| 130 |
+
"single_word": false,
|
| 131 |
+
"special": false
|
| 132 |
+
},
|
| 133 |
+
"151659": {
|
| 134 |
+
"content": "<|fim_prefix|>",
|
| 135 |
+
"lstrip": false,
|
| 136 |
+
"normalized": false,
|
| 137 |
+
"rstrip": false,
|
| 138 |
+
"single_word": false,
|
| 139 |
+
"special": false
|
| 140 |
+
},
|
| 141 |
+
"151660": {
|
| 142 |
+
"content": "<|fim_middle|>",
|
| 143 |
+
"lstrip": false,
|
| 144 |
+
"normalized": false,
|
| 145 |
+
"rstrip": false,
|
| 146 |
+
"single_word": false,
|
| 147 |
+
"special": false
|
| 148 |
+
},
|
| 149 |
+
"151661": {
|
| 150 |
+
"content": "<|fim_suffix|>",
|
| 151 |
+
"lstrip": false,
|
| 152 |
+
"normalized": false,
|
| 153 |
+
"rstrip": false,
|
| 154 |
+
"single_word": false,
|
| 155 |
+
"special": false
|
| 156 |
+
},
|
| 157 |
+
"151662": {
|
| 158 |
+
"content": "<|fim_pad|>",
|
| 159 |
+
"lstrip": false,
|
| 160 |
+
"normalized": false,
|
| 161 |
+
"rstrip": false,
|
| 162 |
+
"single_word": false,
|
| 163 |
+
"special": false
|
| 164 |
+
},
|
| 165 |
+
"151663": {
|
| 166 |
+
"content": "<|repo_name|>",
|
| 167 |
+
"lstrip": false,
|
| 168 |
+
"normalized": false,
|
| 169 |
+
"rstrip": false,
|
| 170 |
+
"single_word": false,
|
| 171 |
+
"special": false
|
| 172 |
+
},
|
| 173 |
+
"151664": {
|
| 174 |
+
"content": "<|file_sep|>",
|
| 175 |
+
"lstrip": false,
|
| 176 |
+
"normalized": false,
|
| 177 |
+
"rstrip": false,
|
| 178 |
+
"single_word": false,
|
| 179 |
+
"special": false
|
| 180 |
+
}
|
| 181 |
+
},
|
| 182 |
+
"additional_special_tokens": [
|
| 183 |
+
"<|im_start|>",
|
| 184 |
+
"<|im_end|>",
|
| 185 |
+
"<|object_ref_start|>",
|
| 186 |
+
"<|object_ref_end|>",
|
| 187 |
+
"<|box_start|>",
|
| 188 |
+
"<|box_end|>",
|
| 189 |
+
"<|quad_start|>",
|
| 190 |
+
"<|quad_end|>",
|
| 191 |
+
"<|vision_start|>",
|
| 192 |
+
"<|vision_end|>",
|
| 193 |
+
"<|vision_pad|>",
|
| 194 |
+
"<|image_pad|>",
|
| 195 |
+
"<|video_pad|>"
|
| 196 |
+
],
|
| 197 |
+
"bos_token": null,
|
| 198 |
+
"clean_up_tokenization_spaces": false,
|
| 199 |
+
"eos_token": "<|im_end|>",
|
| 200 |
+
"errors": "replace",
|
| 201 |
+
"extra_special_tokens": {},
|
| 202 |
+
"model_max_length": 131072,
|
| 203 |
+
"pad_token": "<|endoftext|>",
|
| 204 |
+
"split_special_tokens": false,
|
| 205 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 206 |
+
"unk_token": null
|
| 207 |
+
}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|