104 lines
3.5 KiB
Markdown
104 lines
3.5 KiB
Markdown
|
|
---
|
|||
|
|
library_name: transformers
|
|||
|
|
license: apache-2.0
|
|||
|
|
language:
|
|||
|
|
- en
|
|||
|
|
- zh
|
|||
|
|
base_model: openbmb/MiniCPM5-1B
|
|||
|
|
base_model_relation: finetune
|
|||
|
|
pipeline_tag: text-generation
|
|||
|
|
tags:
|
|||
|
|
- minicpm
|
|||
|
|
- minicpm5
|
|||
|
|
- thinking
|
|||
|
|
- fable5
|
|||
|
|
- coding
|
|||
|
|
- instruction-following
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
<p align="center">
|
|||
|
|
<img src="assets/banner.png" alt="MiniCPM5-1B-Claude-Opus-Fable5-Thinking" width="100%"/>
|
|||
|
|
</p>
|
|||
|
|
|
|||
|
|
# MiniCPM5-1B-Claude-Opus-Fable5-Thinking
|
|||
|
|
|
|||
|
|
GGUF 量化版:**[MiniCPM5-1B-Claude-Opus-Fable5-Thinking-GGUF](https://huggingface.co/GnLOLot/MiniCPM5-1B-Claude-Opus-Fable5-Thinking-GGUF)**
|
|||
|
|
|
|||
|
|
[English README](./README.md)
|
|||
|
|
|
|||
|
|
**MiniCPM5-1B-Claude-Opus-Fable5-Thinking** 是基于 [openbmb/MiniCPM5-1B](https://huggingface.co/openbmb/MiniCPM5-1B) 的 1B **Thinking** 语言模型。该模型使用 **Fable 5** 数据进一步微调,增强了 **Coding(编程)** 与 **指令遵循(Instruction Following)** 能力,同时保留 MiniCPM5 原生的 Thinking 对话模板与工具调用格式。
|
|||
|
|
|
|||
|
|
llama.cpp / Ollama / LM Studio 部署请参阅 **[GGUF 仓库](https://huggingface.co/GnLOLot/MiniCPM5-1B-Claude-Opus-Fable5-Thinking-GGUF)**。
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 模型概述
|
|||
|
|
|
|||
|
|
| 项目 | 说明 |
|
|||
|
|
|---|---|
|
|||
|
|
| **基座模型** | [openbmb/MiniCPM5-1B](https://huggingface.co/openbmb/MiniCPM5-1B)(1B 稠密 Llama 架构) |
|
|||
|
|
| **后训练数据** | Fable 5 traces |
|
|||
|
|
| **主要提升** | 相较基座,Coding 与指令遵循能力更强 |
|
|||
|
|
| **对话格式** | MiniCPM5 原生 Thinking 模板,支持可选的思维链推理块 |
|
|||
|
|
| **上下文长度** | **128K**(`max_position_embeddings = 131072`) |
|
|||
|
|
| **部署特点** | 单卡友好,适合边缘 / 本地场景 |
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 能力
|
|||
|
|
|
|||
|
|
- **Coding** — 代码生成、调试及软件工程类任务
|
|||
|
|
- **Instruction Following** — 更稳定地遵循用户提示与结构化任务约束
|
|||
|
|
- **Thinking 模式** — 通过 MiniCPM5 对话模板进行思维链推理
|
|||
|
|
- **工具调用** — 继承 MiniCPM5 的 XML 工具调用格式
|
|||
|
|
- **长上下文** — 最高 **128K tokens**(`config.json` 中为 131,072)
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 快速开始
|
|||
|
|
|
|||
|
|
```python
|
|||
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|||
|
|
import torch
|
|||
|
|
|
|||
|
|
model_id = "GnLOLot/MiniCPM5-1B-Claude-Opus-Fable5-Thinking"
|
|||
|
|
|
|||
|
|
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
|||
|
|
model = AutoModelForCausalLM.from_pretrained(
|
|||
|
|
model_id, trust_remote_code=True,
|
|||
|
|
torch_dtype=torch.bfloat16, device_map="auto",
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
messages = [{"role": "user", "content": "写一个 Python 函数,合并两个有序链表。"}]
|
|||
|
|
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
|||
|
|
inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
|||
|
|
outputs = model.generate(**inputs, max_new_tokens=512, do_sample=False)
|
|||
|
|
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 采样建议
|
|||
|
|
|
|||
|
|
生成参数继承自 **[MiniCPM5-1B](https://huggingface.co/openbmb/MiniCPM5-1B)**:
|
|||
|
|
|
|||
|
|
| 模式 | 参数 |
|
|||
|
|
|---|---|
|
|||
|
|
| **Think**(默认) | `temperature=0.9, top_p=0.95` |
|
|||
|
|
| **No Think** | `temperature=0.7, top_p=0.95`,`enable_thinking=False` |
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 局限性
|
|||
|
|
|
|||
|
|
- **Thinking 输出** — 模型可能在最终回答前输出推理块;下游应用可在展示前将其剥离
|
|||
|
|
- **1B 体量** — 面向轻量本地部署,非前沿规模通用推理模型
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 许可与致谢
|
|||
|
|
|
|||
|
|
- 许可证:**Apache-2.0**(继承自 MiniCPM5-1B)
|
|||
|
|
- 基座:[OpenBMB / MiniCPM5-1B](https://huggingface.co/openbmb/MiniCPM5-1B)
|
|||
|
|
- GGUF:[llama.cpp](https://github.com/ggml-org/llama.cpp)
|