Text Generation
Transformers
Safetensors
English
Chinese
llama
minicpm
minicpm5
thinking
fable5
coding
instruction-following
conversational
text-generation-inference
Instructions to use nvcky/MiniFABLECPM5-Thinking with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nvcky/MiniFABLECPM5-Thinking with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nvcky/MiniFABLECPM5-Thinking") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("nvcky/MiniFABLECPM5-Thinking") model = AutoModelForCausalLM.from_pretrained("nvcky/MiniFABLECPM5-Thinking") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nvcky/MiniFABLECPM5-Thinking with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nvcky/MiniFABLECPM5-Thinking" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nvcky/MiniFABLECPM5-Thinking", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/nvcky/MiniFABLECPM5-Thinking
- SGLang
How to use nvcky/MiniFABLECPM5-Thinking 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 "nvcky/MiniFABLECPM5-Thinking" \ --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": "nvcky/MiniFABLECPM5-Thinking", "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 "nvcky/MiniFABLECPM5-Thinking" \ --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": "nvcky/MiniFABLECPM5-Thinking", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use nvcky/MiniFABLECPM5-Thinking with Docker Model Runner:
docker model run hf.co/nvcky/MiniFABLECPM5-Thinking
Duplicate from GnLOLot/MiniCPM5-1B-Claude-Opus-Fable5-Thinking
Browse filesCo-authored-by: LOL <GnLOLot@users.noreply.huggingface.co>
- .gitattributes +35 -0
- README-cn.md +107 -0
- README.md +114 -0
- assets/banner.png +0 -0
- chat_template.jinja +179 -0
- config.json +35 -0
- generation_config.json +13 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +22 -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-cn.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
- zh
|
| 7 |
+
base_model: openbmb/MiniCPM5-1B
|
| 8 |
+
base_model_relation: finetune
|
| 9 |
+
pipeline_tag: text-generation
|
| 10 |
+
tags:
|
| 11 |
+
- minicpm
|
| 12 |
+
- minicpm5
|
| 13 |
+
- thinking
|
| 14 |
+
- fable5
|
| 15 |
+
- coding
|
| 16 |
+
- instruction-following
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
<p align="center">
|
| 20 |
+
<img src="assets/banner.png" alt="MiniCPM5-1B-Claude-Opus-Fable5-Thinking" width="100%"/>
|
| 21 |
+
</p>
|
| 22 |
+
|
| 23 |
+
# MiniCPM5-1B-Claude-Opus-Fable5-Thinking
|
| 24 |
+
|
| 25 |
+
> **📢 V2.0 已发布** — 我们已发布增强 **工具调用** 能力的新版本,欢迎通过以下链接下载体验:
|
| 26 |
+
> - Transformers:[MiniCPM5-1B-Claude-Opus-Fable5-V2-Thinking](https://huggingface.co/GnLOLot/MiniCPM5-1B-Claude-Opus-Fable5-V2-Thinking)
|
| 27 |
+
> - GGUF:[MiniCPM5-1B-Claude-Opus-Fable5-V2-Thinking-GGUF](https://huggingface.co/GnLOLot/MiniCPM5-1B-Claude-Opus-Fable5-V2-Thinking-GGUF)
|
| 28 |
+
|
| 29 |
+
GGUF 量化版:**[MiniCPM5-1B-Claude-Opus-Fable5-Thinking-GGUF](https://huggingface.co/GnLOLot/MiniCPM5-1B-Claude-Opus-Fable5-Thinking-GGUF)**
|
| 30 |
+
|
| 31 |
+
[English README](./README.md)
|
| 32 |
+
|
| 33 |
+
**MiniCPM5-1B-Claude-Opus-Fable5-Thinking** 是基于 [openbmb/MiniCPM5-1B](https://huggingface.co/openbmb/MiniCPM5-1B) 的 1B **Thinking** 语言模型。该模型使用 **Fable 5** 数据进一步微调,增强了 **Coding(编程)** 与 **指令遵循(Instruction Following)** 能力,同时保留 MiniCPM5 原生的 Thinking 对话模板与工具调用格式。
|
| 34 |
+
|
| 35 |
+
llama.cpp / Ollama / LM Studio 部署请参阅 **[GGUF 仓库](https://huggingface.co/GnLOLot/MiniCPM5-1B-Claude-Opus-Fable5-Thinking-GGUF)**。
|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
## 模型概述
|
| 40 |
+
|
| 41 |
+
| 项目 | 说明 |
|
| 42 |
+
|---|---|
|
| 43 |
+
| **基座模型** | [openbmb/MiniCPM5-1B](https://huggingface.co/openbmb/MiniCPM5-1B)(1B 稠密 Llama 架构) |
|
| 44 |
+
| **后训练数据** | Fable 5 traces |
|
| 45 |
+
| **主要提升** | 相较基座,Coding 与指令遵循能力更强 |
|
| 46 |
+
| **对话格式** | MiniCPM5 原生 Thinking 模板,支持可选的思维链推理块 |
|
| 47 |
+
| **上下文长度** | **128K**(`max_position_embeddings = 131072`) |
|
| 48 |
+
| **部署特点** | 单卡友好,适合边缘 / 本地场景 |
|
| 49 |
+
|
| 50 |
+
---
|
| 51 |
+
|
| 52 |
+
## 能力
|
| 53 |
+
|
| 54 |
+
- **Coding** — 代码生成、调试及软件工程类任务
|
| 55 |
+
- **Instruction Following** — 更稳定地遵循用户提示与结构化任务约束
|
| 56 |
+
- **Thinking 模式** — 通过 MiniCPM5 对话模板进行思维链推理
|
| 57 |
+
- **工具调用** — 继承 MiniCPM5 的 XML 工具调用格式
|
| 58 |
+
- **长上下文** — 最高 **128K tokens**(`config.json` 中为 131,072)
|
| 59 |
+
|
| 60 |
+
---
|
| 61 |
+
|
| 62 |
+
## 快速开始
|
| 63 |
+
|
| 64 |
+
```python
|
| 65 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 66 |
+
import torch
|
| 67 |
+
|
| 68 |
+
model_id = "GnLOLot/MiniCPM5-1B-Claude-Opus-Fable5-Thinking"
|
| 69 |
+
|
| 70 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
| 71 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 72 |
+
model_id, trust_remote_code=True,
|
| 73 |
+
torch_dtype=torch.bfloat16, device_map="auto",
|
| 74 |
+
)
|
| 75 |
+
|
| 76 |
+
messages = [{"role": "user", "content": "写一个 Python 函数,合并两个有序链表。"}]
|
| 77 |
+
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 78 |
+
inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
| 79 |
+
outputs = model.generate(**inputs, max_new_tokens=512, do_sample=False)
|
| 80 |
+
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
---
|
| 84 |
+
|
| 85 |
+
## 采样建议
|
| 86 |
+
|
| 87 |
+
生成参数继承自 **[MiniCPM5-1B](https://huggingface.co/openbmb/MiniCPM5-1B)**:
|
| 88 |
+
|
| 89 |
+
| 模式 | 参数 |
|
| 90 |
+
|---|---|
|
| 91 |
+
| **Think**(默认) | `temperature=0.9, top_p=0.95` |
|
| 92 |
+
| **No Think** | `temperature=0.7, top_p=0.95`,`enable_thinking=False` |
|
| 93 |
+
|
| 94 |
+
---
|
| 95 |
+
|
| 96 |
+
## 局限性
|
| 97 |
+
|
| 98 |
+
- **Thinking 输出** — 模型可能在最终回答前输出推理块;下游应用可在展示前将其剥离
|
| 99 |
+
- **1B 体量** — 面向轻量本地部署,非前沿规模通用推理模型
|
| 100 |
+
|
| 101 |
+
---
|
| 102 |
+
|
| 103 |
+
## 许可与致谢
|
| 104 |
+
|
| 105 |
+
- 许可证:**Apache-2.0**(继承自 MiniCPM5-1B)
|
| 106 |
+
- 基座:[OpenBMB / MiniCPM5-1B](https://huggingface.co/openbmb/MiniCPM5-1B)
|
| 107 |
+
- GGUF:[llama.cpp](https://github.com/ggml-org/llama.cpp)
|
README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
- zh
|
| 7 |
+
base_model: openbmb/MiniCPM5-1B
|
| 8 |
+
base_model_relation: finetune
|
| 9 |
+
pipeline_tag: text-generation
|
| 10 |
+
tags:
|
| 11 |
+
- minicpm
|
| 12 |
+
- minicpm5
|
| 13 |
+
- llama
|
| 14 |
+
- text-generation
|
| 15 |
+
- thinking
|
| 16 |
+
- fable5
|
| 17 |
+
- coding
|
| 18 |
+
- instruction-following
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
<p align="center">
|
| 22 |
+
<img src="assets/banner.png" alt="MiniCPM5-1B-Claude-Opus-Fable5-Thinking" width="100%"/>
|
| 23 |
+
</p>
|
| 24 |
+
|
| 25 |
+
# MiniCPM5-1B-Claude-Opus-Fable5-Thinking
|
| 26 |
+
|
| 27 |
+
> **📢 V2.0 is available** — We have released an updated model with **enhanced tool-calling** capabilities. Welcome to try the new version:
|
| 28 |
+
> - Transformers: [MiniCPM5-1B-Claude-Opus-Fable5-V2-Thinking](https://huggingface.co/GnLOLot/MiniCPM5-1B-Claude-Opus-Fable5-V2-Thinking)
|
| 29 |
+
> - GGUF: [MiniCPM5-1B-Claude-Opus-Fable5-V2-Thinking-GGUF](https://huggingface.co/GnLOLot/MiniCPM5-1B-Claude-Opus-Fable5-V2-Thinking-GGUF)
|
| 30 |
+
|
| 31 |
+
GGUF quantizations for local deployment: **[MiniCPM5-1B-Claude-Opus-Fable5-Thinking-GGUF](https://huggingface.co/GnLOLot/MiniCPM5-1B-Claude-Opus-Fable5-Thinking-GGUF)**
|
| 32 |
+
|
| 33 |
+
[中文说明](./README-cn.md)
|
| 34 |
+
|
| 35 |
+
**MiniCPM5-1B-Claude-Opus-Fable5-Thinking** is a compact 1B **Thinking** language model built on [openbmb/MiniCPM5-1B](https://huggingface.co/openbmb/MiniCPM5-1B). It is further fine-tuned on **Fable 5** data to improve **coding** and **instruction-following** while keeping MiniCPM5's native Thinking chat template and tool-call format.
|
| 36 |
+
|
| 37 |
+
For llama.cpp / Ollama / LM Studio deployment, see the **[GGUF repository](https://huggingface.co/GnLOLot/MiniCPM5-1B-Claude-Opus-Fable5-Thinking-GGUF)**.
|
| 38 |
+
|
| 39 |
+
---
|
| 40 |
+
|
| 41 |
+
## Overview
|
| 42 |
+
|
| 43 |
+
| Item | Detail |
|
| 44 |
+
|---|---|
|
| 45 |
+
| **Base model** | [openbmb/MiniCPM5-1B](https://huggingface.co/openbmb/MiniCPM5-1B) (1B dense Llama architecture) |
|
| 46 |
+
| **Post-training** | Fable 5 traces |
|
| 47 |
+
| **Key gains** | Stronger coding and instruction following vs. the base checkpoint |
|
| 48 |
+
| **Chat format** | MiniCPM5 native Thinking template with optional chain-of-thought blocks |
|
| 49 |
+
| **Context length** | **128K** (`max_position_embeddings = 131072`) |
|
| 50 |
+
| **Deployment** | Single-GPU friendly; suitable for edge / local use |
|
| 51 |
+
|
| 52 |
+
---
|
| 53 |
+
|
| 54 |
+
## Capabilities
|
| 55 |
+
|
| 56 |
+
- **Coding** — code generation, debugging, and software-engineering-style tasks
|
| 57 |
+
- **Instruction following** — more reliable adherence to user prompts and structured constraints
|
| 58 |
+
- **Thinking mode** — chain-of-thought reasoning via the MiniCPM5 chat template
|
| 59 |
+
- **Tool calling** — inherits MiniCPM5's XML tool-call format
|
| 60 |
+
- **Long context** — up to **128K tokens** (131,072 tokens per `config.json`)
|
| 61 |
+
|
| 62 |
+
---
|
| 63 |
+
|
| 64 |
+
## Quick start
|
| 65 |
+
|
| 66 |
+
```python
|
| 67 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 68 |
+
import torch
|
| 69 |
+
|
| 70 |
+
model_id = "GnLOLot/MiniCPM5-1B-Claude-Opus-Fable5-Thinking"
|
| 71 |
+
|
| 72 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
| 73 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 74 |
+
model_id,
|
| 75 |
+
trust_remote_code=True,
|
| 76 |
+
torch_dtype=torch.bfloat16,
|
| 77 |
+
device_map="auto",
|
| 78 |
+
)
|
| 79 |
+
|
| 80 |
+
messages = [{"role": "user", "content": "Write a Python function to merge two sorted lists."}]
|
| 81 |
+
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 82 |
+
inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
| 83 |
+
outputs = model.generate(**inputs, max_new_tokens=512, do_sample=False)
|
| 84 |
+
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
---
|
| 88 |
+
|
| 89 |
+
## Sampling recommendations
|
| 90 |
+
|
| 91 |
+
Generation defaults are inherited from **[MiniCPM5-1B](https://huggingface.co/openbmb/MiniCPM5-1B)**:
|
| 92 |
+
|
| 93 |
+
| Mode | Params |
|
| 94 |
+
|---|---|
|
| 95 |
+
| **Think** (default) | `temperature=0.9, top_p=0.95` |
|
| 96 |
+
| **No Think** | `temperature=0.7, top_p=0.95`, `enable_thinking=False` |
|
| 97 |
+
|
| 98 |
+
---
|
| 99 |
+
|
| 100 |
+
## Limitations
|
| 101 |
+
|
| 102 |
+
- **Thinking outputs** — the model may emit reasoning blocks before the final answer; downstream apps can strip them before display
|
| 103 |
+
- **1B scale** — optimized for lightweight local deployment, not frontier-scale general reasoning
|
| 104 |
+
|
| 105 |
+
---
|
| 106 |
+
|
| 107 |
+
## Provenance & licensing
|
| 108 |
+
|
| 109 |
+
Released under **Apache-2.0**, inherited from [MiniCPM5-1B](https://huggingface.co/openbmb/MiniCPM5-1B).
|
| 110 |
+
|
| 111 |
+
## Acknowledgements
|
| 112 |
+
|
| 113 |
+
- Base model: [OpenBMB / MiniCPM5-1B](https://huggingface.co/openbmb/MiniCPM5-1B)
|
| 114 |
+
- GGUF conversion: [llama.cpp](https://github.com/ggml-org/llama.cpp)
|
assets/banner.png
ADDED
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{- bos_token }}{%- if tools %}
|
| 2 |
+
{%- set tool_definitions %}
|
| 3 |
+
{{- "# Tools\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
| 4 |
+
{%- for tool in tools %}
|
| 5 |
+
{{- "\n" }}
|
| 6 |
+
{{- tool | tojson(ensure_ascii=False) }}
|
| 7 |
+
{%- endfor %}
|
| 8 |
+
{{- '\n</tools>\n\nTool usage guidelines:\n- You may call zero or more functions. If no function calls are needed, just answer normally and do not include any <function ... </function>.\n- When calling a function, return an XML object within <function ... </function> using:\n<function name="function-name"><param name="param-name">param-value</param></function>\n- param-value may be multi-line. If it contains <, & or newline characters, wrap it in a CDATA block: <param name="param-name"><![CDATA[...multi-line value...]]></param>' }}
|
| 9 |
+
{%- endset %}
|
| 10 |
+
|
| 11 |
+
{{- '<|im_start|>system\n' }}
|
| 12 |
+
{%- if messages[0].role == 'system' %}
|
| 13 |
+
{%- if '<tool_def_sep>' in messages[0].content %}
|
| 14 |
+
{{- messages[0].content.replace('<tool_def_sep>', tool_definitions) }}
|
| 15 |
+
{%- else %}
|
| 16 |
+
{{- messages[0].content + '\n\n' + tool_definitions }}
|
| 17 |
+
{%- endif %}
|
| 18 |
+
{%- else %}
|
| 19 |
+
{{- tool_definitions.lstrip() }}
|
| 20 |
+
{%- endif %}
|
| 21 |
+
{{- '<|im_end|>\n' }}
|
| 22 |
+
{%- else %}
|
| 23 |
+
{%- if messages[0].role == 'system' %}
|
| 24 |
+
{{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
|
| 25 |
+
{%- endif %}
|
| 26 |
+
{%- endif %}
|
| 27 |
+
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
| 28 |
+
{%- for message in messages[::-1] %}
|
| 29 |
+
{%- set index = (messages|length - 1) - loop.index0 %}
|
| 30 |
+
{%- 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>')) %}
|
| 31 |
+
{%- set ns.multi_step_tool = false %}
|
| 32 |
+
{%- set ns.last_query_index = index %}
|
| 33 |
+
{%- endif %}
|
| 34 |
+
{%- endfor %}
|
| 35 |
+
{%- for message in messages %}
|
| 36 |
+
{%- if message.content is string %}
|
| 37 |
+
{%- set content = message.content %}
|
| 38 |
+
{%- else %}
|
| 39 |
+
{%- set content = '' %}
|
| 40 |
+
{%- endif %}
|
| 41 |
+
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
|
| 42 |
+
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
| 43 |
+
{%- elif message.role == "assistant" %}
|
| 44 |
+
{%- set reasoning_content = '' %}
|
| 45 |
+
{%- if message.reasoning_content is string %}
|
| 46 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 47 |
+
{%- else %}
|
| 48 |
+
{%- if '</think>' in content %}
|
| 49 |
+
{%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
|
| 50 |
+
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
| 51 |
+
{%- endif %}
|
| 52 |
+
{%- endif %}
|
| 53 |
+
|
| 54 |
+
{%- if message.tool_calls %}
|
| 55 |
+
{%- set content_parts = content.split('<tool_sep>') %}
|
| 56 |
+
{%- set processed_content = content_parts[0] %}
|
| 57 |
+
{%- set tool_calls_count = message.tool_calls|length %}
|
| 58 |
+
{%- set tool_sep_count = content_parts|length - 1 %}
|
| 59 |
+
{%- set min_count = [tool_calls_count, tool_sep_count]|min %}
|
| 60 |
+
|
| 61 |
+
{%- for i in range(1, content_parts|length) %}
|
| 62 |
+
{%- set tool_index = i - 1 %}
|
| 63 |
+
{%- if tool_index < tool_calls_count %}
|
| 64 |
+
{%- set tool_call = message.tool_calls[tool_index] %}
|
| 65 |
+
{%- if tool_call.function %}
|
| 66 |
+
{%- set tool_call = tool_call.function %}
|
| 67 |
+
{%- endif %}
|
| 68 |
+
{%- set single_tool_xml %}
|
| 69 |
+
{{- '<function name="' ~ tool_call.name ~ '">' }}
|
| 70 |
+
{%- if tool_call.arguments %}
|
| 71 |
+
{%- set args_dict = tool_call.arguments %}
|
| 72 |
+
{%- for param_name, param_value in args_dict.items() %}
|
| 73 |
+
{{- '<param name="' ~ param_name ~ '">' }}
|
| 74 |
+
{%- if param_value is string and ('<' in param_value or '&' in param_value or '\n' in param_value) %}
|
| 75 |
+
{{- '<![CDATA[' + param_value + ']]>' }}
|
| 76 |
+
{%- else %}
|
| 77 |
+
{{- param_value }}
|
| 78 |
+
{%- endif %}
|
| 79 |
+
{{- '</param>' }}
|
| 80 |
+
{%- endfor %}
|
| 81 |
+
{%- endif %}
|
| 82 |
+
{{- '</function>' }}
|
| 83 |
+
{%- endset %}
|
| 84 |
+
{%- set processed_content = processed_content + single_tool_xml + content_parts[i] %}
|
| 85 |
+
{%- else %}
|
| 86 |
+
{%- set processed_content = processed_content + content_parts[i] %}
|
| 87 |
+
{%- endif %}
|
| 88 |
+
{%- endfor %}
|
| 89 |
+
|
| 90 |
+
{%- if tool_calls_count > tool_sep_count %}
|
| 91 |
+
{%- for remaining_index in range(tool_sep_count, tool_calls_count) %}
|
| 92 |
+
{%- set tool_call = message.tool_calls[remaining_index] %}
|
| 93 |
+
{%- if tool_call.function %}
|
| 94 |
+
{%- set tool_call = tool_call.function %}
|
| 95 |
+
{%- endif %}
|
| 96 |
+
{%- set remaining_tool_xml %}
|
| 97 |
+
{{- '<function name="' ~ tool_call.name ~ '">' }}
|
| 98 |
+
{%- if tool_call.arguments %}
|
| 99 |
+
{%- set args_dict = tool_call.arguments %}
|
| 100 |
+
{%- for param_name, param_value in args_dict.items() %}
|
| 101 |
+
{{- '<param name="' ~ param_name ~ '">' }}
|
| 102 |
+
{%- if param_value is string and ('<' in param_value or '&' in param_value or '\n' in param_value) %}
|
| 103 |
+
{{- '<![CDATA[' + param_value + ']]>' }}
|
| 104 |
+
{%- else %}
|
| 105 |
+
{{- param_value }}
|
| 106 |
+
{%- endif %}
|
| 107 |
+
{{- '</param>' }}
|
| 108 |
+
{%- endfor %}
|
| 109 |
+
{%- endif %}
|
| 110 |
+
{{- '</function>' }}
|
| 111 |
+
{%- endset %}
|
| 112 |
+
{%- set processed_content = processed_content + remaining_tool_xml %}
|
| 113 |
+
{%- endfor %}
|
| 114 |
+
{%- endif %}
|
| 115 |
+
|
| 116 |
+
{%- set content = processed_content %}
|
| 117 |
+
{%- endif %}
|
| 118 |
+
|
| 119 |
+
{%- if loop.index0 > ns.last_query_index %}
|
| 120 |
+
{%- if reasoning_content %}
|
| 121 |
+
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
|
| 122 |
+
{%- else %}
|
| 123 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 124 |
+
{%- endif %}
|
| 125 |
+
{%- else %}
|
| 126 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 127 |
+
{%- endif %}
|
| 128 |
+
|
| 129 |
+
{%- if message.tool_calls and not has_tool_sep %}
|
| 130 |
+
{%- for tool_call in message.tool_calls %}
|
| 131 |
+
{%- if (loop.first and content) or (not loop.first) %}
|
| 132 |
+
{{- '\n' }}
|
| 133 |
+
{%- endif %}
|
| 134 |
+
{%- if tool_call.function %}
|
| 135 |
+
{%- set tool_call = tool_call.function %}
|
| 136 |
+
{%- endif %}
|
| 137 |
+
{{- '<function name="' ~ tool_call.name ~ '">' }}
|
| 138 |
+
{%- if tool_call.arguments %}
|
| 139 |
+
{%- set args_dict = tool_call.arguments %}
|
| 140 |
+
{%- for param_name, param_value in args_dict.items() %}
|
| 141 |
+
{{- '<param name="' ~ param_name ~ '">' }}
|
| 142 |
+
{%- if param_value is string and ('<' in param_value or '&' in param_value or '\n' in param_value) %}
|
| 143 |
+
{{- '<![CDATA[' + param_value + ']]>' }}
|
| 144 |
+
{%- else %}
|
| 145 |
+
{{- param_value }}
|
| 146 |
+
{%- endif %}
|
| 147 |
+
{{- '</param>' }}
|
| 148 |
+
{%- endfor %}
|
| 149 |
+
{%- endif %}
|
| 150 |
+
{{- '</function>' }}
|
| 151 |
+
{%- endfor %}
|
| 152 |
+
{%- endif %}
|
| 153 |
+
{{- '<|im_end|>\n' }}
|
| 154 |
+
{%- elif message.role == "tool" %}
|
| 155 |
+
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
|
| 156 |
+
{{- '<|im_start|>user' }}
|
| 157 |
+
{%- endif %}
|
| 158 |
+
{{- '\n<tool_response>\n' }}
|
| 159 |
+
{%- if message.content is string %}
|
| 160 |
+
{{- content }}
|
| 161 |
+
{%- else %}
|
| 162 |
+
{{- message.content | tojson(ensure_ascii=False) }}
|
| 163 |
+
{%- endif %}
|
| 164 |
+
{{- '\n</tool_response>' }}
|
| 165 |
+
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
| 166 |
+
{{- '<|im_end|>\n' }}
|
| 167 |
+
{%- endif %}
|
| 168 |
+
{%- endif %}
|
| 169 |
+
{%- endfor %}
|
| 170 |
+
{%- if add_generation_prompt %}
|
| 171 |
+
{{- '<|im_start|>assistant\n' }}
|
| 172 |
+
{%- if enable_thinking is defined %}
|
| 173 |
+
{%- if enable_thinking is false %}
|
| 174 |
+
{{- '<think>\n\n</think>\n\n' }}
|
| 175 |
+
{%- elif enable_thinking is true %}
|
| 176 |
+
{{- '<think>\n' }}
|
| 177 |
+
{%- endif %}
|
| 178 |
+
{%- endif %}
|
| 179 |
+
{%- endif %}
|
config.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"LlamaForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 0,
|
| 8 |
+
"dtype": "bfloat16",
|
| 9 |
+
"eos_token_id": [
|
| 10 |
+
1,
|
| 11 |
+
130073
|
| 12 |
+
],
|
| 13 |
+
"head_dim": 128,
|
| 14 |
+
"hidden_act": "silu",
|
| 15 |
+
"hidden_size": 1536,
|
| 16 |
+
"initializer_range": 0.02,
|
| 17 |
+
"intermediate_size": 4608,
|
| 18 |
+
"max_position_embeddings": 131072,
|
| 19 |
+
"mlp_bias": false,
|
| 20 |
+
"model_type": "llama",
|
| 21 |
+
"num_attention_heads": 16,
|
| 22 |
+
"num_hidden_layers": 24,
|
| 23 |
+
"num_key_value_heads": 2,
|
| 24 |
+
"pad_token_id": 1,
|
| 25 |
+
"pretraining_tp": 1,
|
| 26 |
+
"rms_norm_eps": 1e-06,
|
| 27 |
+
"rope_parameters": {
|
| 28 |
+
"rope_theta": 5000000,
|
| 29 |
+
"rope_type": "default"
|
| 30 |
+
},
|
| 31 |
+
"tie_word_embeddings": false,
|
| 32 |
+
"transformers_version": "5.6.0",
|
| 33 |
+
"use_cache": true,
|
| 34 |
+
"vocab_size": 130560
|
| 35 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 0,
|
| 4 |
+
"do_sample": true,
|
| 5 |
+
"eos_token_id": [
|
| 6 |
+
1,
|
| 7 |
+
130073
|
| 8 |
+
],
|
| 9 |
+
"pad_token_id": 1,
|
| 10 |
+
"temperature": 0.9,
|
| 11 |
+
"top_p": 0.95,
|
| 12 |
+
"transformers_version": "5.6.0"
|
| 13 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:689e9f7eb54a22c91b02e57bb2af884693184db963845cffcae373df47f9b178
|
| 3 |
+
size 2161290944
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": null,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<s>",
|
| 5 |
+
"clean_up_tokenization_spaces": false,
|
| 6 |
+
"eos_token": "</s>",
|
| 7 |
+
"extra_special_tokens": [
|
| 8 |
+
"<|im_end|>"
|
| 9 |
+
],
|
| 10 |
+
"is_local": true,
|
| 11 |
+
"legacy": true,
|
| 12 |
+
"local_files_only": false,
|
| 13 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 14 |
+
"pad_token": "</s>",
|
| 15 |
+
"padding_side": "left",
|
| 16 |
+
"sp_model_kwargs": {},
|
| 17 |
+
"spaces_between_special_tokens": false,
|
| 18 |
+
"split_special_tokens": false,
|
| 19 |
+
"tokenizer_class": "TokenizersBackend",
|
| 20 |
+
"unk_token": "<unk>",
|
| 21 |
+
"use_default_system_prompt": false
|
| 22 |
+
}
|