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
| 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 | |
| > **📢 V2.0 已发布** — 我们已发布增强 **工具调用** 能力的新版本,欢迎通过以下链接下载体验: | |
| > - Transformers:[MiniCPM5-1B-Claude-Opus-Fable5-V2-Thinking](https://huggingface.co/GnLOLot/MiniCPM5-1B-Claude-Opus-Fable5-V2-Thinking) | |
| > - GGUF:[MiniCPM5-1B-Claude-Opus-Fable5-V2-Thinking-GGUF](https://huggingface.co/GnLOLot/MiniCPM5-1B-Claude-Opus-Fable5-V2-Thinking-GGUF) | |
| 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) | |