Open-weight model
LycheeAI-coder-2b-II-pro-MLX-bf16
by Hwc whcl412/LycheeAI-coder-2b-II-pro-MLX-bf16
LoRA adapter 已融合进基座,权重是 bf16 全精度,没有经过任何量化。 MLX 和 transformers 都能直接加载——它是标准 safetensors 格式,所以一套权重两种用法。 一句话:要在它身上"再加工",就必须用这个版本;只是想用它,4bit 更省。 命令行也行(mlxlm.generate 自己会套模板): 和 4bit 版完全一致——模型输出裸 JSON: 完整接入代码(含多步循环、JSON 兜底解析)见主仓库的 1.
Runs On
What it takes to serve LycheeAI-coder-2b-II-pro-MLX-bf16 (2.5B parameters): the memory its weights need at each precision, and the cheapest way to rent enough data-center GPUs to hold them.
| Precision | Weights | Memory needed | Cheapest setup | Per hour | Also fits |
|---|---|---|---|---|---|
| 16-bit | 5.0 GB | 6.0 GB | 1x MI300X (192 GB) Vultr |
$1.85 | 1x H100 $1.99 · 1x MI325X $2.00 |
| 8-bit | 2.5 GB | 3.0 GB | 1x MI300X (192 GB) Vultr |
$1.85 | 1x H100 $1.99 · 1x MI325X $2.00 |
| 4-bit | 1.3 GB | 1.5 GB | 1x MI300X (192 GB) Vultr |
$1.85 | 1x H100 $1.99 · 1x MI325X $2.00 |
Memory is the weights at that precision plus 20% for the runtime and a short context; a long context needs more. Prices are the lowest on-demand hourly rates in the SAVRN Index, read Sep 18, 2026.
Model Card
By Hwc, published under apache-2.0, revision 61d3eff819c4.
LoRA adapter 已融合进基座,权重是 bf16 全精度,没有经过任何量化。 MLX 和 transformers 都能直接加载——它是标准 safetensors 格式,所以一套权重两种用法。 一句话:要在它身上"再加工",就必须用这个版本;只是想用它,4bit 更省。 命令行也行(mlxlm.generate 自己会套模板): 和 4bit 版完全一致——模型输出裸 JSON: 完整接入代码(含多步循环、JSON 兜底解析)见主仓库的 1. 不套 chat template 会复读。 直接 generate(model, tok, prompt="递归是什么?") 会得到类似这样的东西: 这不是模型坏了,是你喂的是裸补全而不是对话。用 tok.applychattemplate(...), 或者干脆用 mlxlm.generate 命令行。 2. enablethinking 记得显式传 False。 模板里有 开关,不传的话没有默认值,输出可能带游离的 。 想要思考内容就传 True,它会单独出现(不混在回答里)。 3. 加载比 4bit 慢、占内存多——这是正常的。 实测对比(MacBook Pro M4 / 16GB): ① 无工具时算术会算错 → 在 system 里要求"一律调 calculate"; ② 通用 system 下身份可能答错 → system 里写清身份; - 基座:MiniCPM5-2B(面壁智能 OpenBMB) - 许可:Apache 2.0 个人项目,欢迎提 issue。有用的话 Bilibili 关注一下
Read Hwc's full model card
无损版本(bfloat16) · v7 · 基于 MiniCPM5-2B · Apache 2.0 · 5.03 GB
这是 LycheeAI-coder-2b-II-pro 的未量化版本: LoRA adapter 已融合进基座,权重是 bf16 全精度,没有经过任何量化。
MLX 和 transformers 都能直接加载——它是标准 safetensors 格式,所以一套权重两种用法。
和
-f16仓库的关系:同一份权重。两个仓库名只是为了让不同用户都能找到它—— 想在 MLX 上找无损版的人,看到-f16这个名字不会意识到"这个 MLX 也能用"。 如果你只想要一份,用哪个都行,字节完全相同。国内用户推荐 ModelScope:modelscope.cn/models/whcl412/LycheeAI-coder-2b-II-pro-MLX-bf16
什么时候该用这个(而不是 4bit)
| 你的目的 | 用哪个 |
|---|---|
| 就想跑起来用,越省事越好 | MLX 4bit(1.42 GB) |
| 质量基准 / 要"没有量化误差"的结果 | Yes本仓库 |
| 在无损基础上做自己的量化(q4/q8/custom) | Yes本仓库 |
| 继续微调(续训 LoRA) | Yes本仓库(4bit 不能训) |
| 转 GGUF | 本仓库,或直接用现成的GGUF 仓库 |
| CUDA 卡上跑 | 本仓库 |
一句话:要在它身上"再加工",就必须用这个版本;只是想用它,4bit 更省。
快速开始
MLX
pip install mlx-lm
from mlx_lm import load, generate
model, tok = load("whcl412/LycheeAI-coder-2b-II-pro-MLX-bf16")
msgs = [
{"role": "system", "content": "你是 LycheeAI-coder-2b-II-pro,由 MiniCPM5-2B 通过 LoRA 微调而来的编程助手。回答简洁、直接,不谄媚;做不到的事直接说明,不要编造。"},
{"role": "user", "content": "递归是什么?一句话。"},
]
# 必须套 chat template,否则会复读乱码(见下文"踩坑")
prompt = tok.apply_chat_template(msgs, tokenize=False,
add_generation_prompt=True,
enable_thinking=False)
print(generate(model, tok, prompt=prompt, max_tokens=256, verbose=False))
实测输出:
递归是**函数自己调用自己**。
命令行也行(mlx_lm.generate 自己会套模板):
python -m mlx_lm.generate \
--model whcl412/LycheeAI-coder-2b-II-pro-MLX-bf16 \
--prompt "用 Python 写一个二分查找,带注释。" \
--max-tokens 256 --temp 0.4
transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
mid = "whcl412/LycheeAI-coder-2b-II-pro-MLX-bf16"
tok = AutoTokenizer.from_pretrained(mid, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
mid, torch_dtype="bfloat16", device_map="auto", trust_remote_code=True)
工具的用法
和 4bit 版完全一致——模型输出裸 JSON:
{"name": "calculate", "arguments": {"expression": "789*123"}}
完整接入代码(含多步循环、JSON 兜底解析)见主仓库的 宿主接入章节。
踩过的坑
1. 不套 chat template 会复读。
直接 generate(model, tok, prompt="递归是什么?") 会得到类似这样的东西:
还是说:递归是函数自己调用自己。区别很大,对吧。还是说:递归是**把问题缩小到更小的问题**。还是说:…
这不是模型坏了,是你喂的是裸补全而不是对话。用 tok.apply_chat_template(...),
或者干脆用 mlx_lm.generate 命令行。
2. enable_thinking 记得显式传 False。
模板里有 <think> 开关,不传的话没有默认值,输出可能带游离的 </think>。
想要思考内容就传 True,它会单独出现(不混在回答里)。
3. 加载比 4bit 慢、占内存多——这是正常的。
实测对比(MacBook Pro M4 / 16GB):
| MLX 4bit | 本仓库(bf16) | |
|---|---|---|
| 磁盘 | 1.42 GB | 5.03 GB |
| 峰值内存 | 1.52 GB | ~5.5 GB |
| 冷启动 | 3.4 s | ~10 s |
差的是文件大小,不是模型质量——两者输出质量的区别只来自量化误差。
关于这个版本
| 项 | 值 |
|---|---|
| 基座 | MiniCPM5-2B(面壁智能 OpenBMB,Apache 2.0) |
| 精度 | bfloat16(无量化) |
| 微调 | LoRA(rank 8,16 层),已融合进基座 |
| 训练数据 | 精选 980 条 × 1 epoch(490 步) |
| 验收 | 26 / 27(上一版 25/27) |
| 许可 | Apache 2.0(可商用) |
完整能力说明、局限、训练方法论见主仓库: whcl412/LycheeAI-coder-2b-II-pro
已知问题(简版):
① 无工具时算术会算错 → 在 system 里要求"一律调 calculate";
② 通用 system 下身份可能答错 → system 里写清身份;
③ 偶发控制字符 \x08 → 输出前过滤;
④ 偶发工具名幻觉 → 宿主必须查注册表。
文件说明
| 文件 | 大小 | 说明 |
|---|---|---|
model.safetensors |
5,033,556,906 B | bf16 全精度权重(已融合 LoRA) |
model.safetensors.index.json |
— | 分片索引 |
config.json |
— | 无 quantization 字段(= 未量化) |
chat_template.jinja |
— | 含 tools 支持的完整对话模板 |
tokenizer.json / tokenizer_config.json |
— | 分词器 |
generation_config.json |
— | 生成默认参数 |
致谢
- 基座:MiniCPM5-2B(面壁智能 OpenBMB)
- 许可:Apache 2.0
个人项目,欢迎提 issue。有用的话 Bilibili 关注一下
Configuration
- Architecture
- LlamaForCausalLM
- Context length (tokens)
- 131,072
- Layers
- 42
- Hidden size
- 2,048
- Feed-forward size
- 6,144
- Attention heads
- 16
- Key/value heads
- 2
- Head dimension
- 128
- Vocabulary size
- 130,560
- RoPE base
- 5,000,000
- Stored precision
- bfloat16
- Model type
- llama
Identity and Version
- Repository
- whcl412/LycheeAI-coder-2b-II-pro-MLX-bf16
- Publisher
- Hwc
- Task
- Not stated by the source
- Modality
- Other
- Library
- mlx
- Parameters
- 2.5B parameters
- Languages
- zh, en
- Revision
- 61d3eff819c4e6b32b758b3f3e154419cb840fa3
- First published
- 2026-09-13
- Last updated
- 2026-09-18
Files and Weights
9 files, 5.0 GB in total. The weights are 1 file totalling 5.0 GB in safetensors.
Every file
| File | Type | Size | SHA-256 |
|---|---|---|---|
| model.safetensors | Weights | 5.0 GB | c19d3f2e41a0 |
| config.json | Configuration | 681 B | — |
| generation_config.json | Configuration | 213 B | — |
| model.safetensors.index.json | Configuration | 27.2 KB | — |
| README.md | Documentation | 6.3 KB | — |
| chat_template.jinja | Other | 9.1 KB | — |
| .gitattributes | Repository | 1.5 KB | — |
| tokenizer.json | Tokenizer | 9.9 MB | — |
| tokenizer_config.json | Tokenizer | 435 B | — |
License and Download
- License
- apache-2.0
- Access
- Open weights, no gate
- Download size
- 5.0 GB
Released by Hwc through its official repository on Hugging Face. Read the license.
Built From
- Derived from openbmb/MiniCPM5-2B
Memory Requirements
| Precision | Weights in memory |
|---|---|
| As published | 5.0 GB |
| 16-bit | 5.0 GB |
| 8-bit | 2.5 GB |
| 4-bit | 1.3 GB |
Weights only, from the published parameter count; the key-value cache and runtime add to this.
Questions About LycheeAI-coder-2b-II-pro-MLX-bf16
How much GPU memory does LycheeAI-coder-2b-II-pro-MLX-bf16 need?
About 6 GB at 16-bit and 1.5 GB at 4-bit: the weights (2.5B parameters) plus a working margin. A long context needs more.
What is the cheapest GPU to run LycheeAI-coder-2b-II-pro-MLX-bf16 on?
At 16-bit, 1x MI300X from $1.85 an hour; at 4-bit, 1x MI300X from $1.85 an hour, at the lowest on-demand prices the SAVRN Index lists.
Can I use LycheeAI-coder-2b-II-pro-MLX-bf16 commercially?
Yes. LycheeAI-coder-2b-II-pro-MLX-bf16 is released under Apache License 2.0. The Apache License 2.0 is a permissive open-source license. It permits commercial use, modification and redistribution. It requires keeping the license and copyright notices and any NOTICE file, stating significant changes, and it includes an express patent grant from contributors.
What is LycheeAI-coder-2b-II-pro-MLX-bf16's context length?
131,072 tokens, from the maximum position embeddings in its published configuration.