微信扫码
添加专属顾问
我要投稿
面壁一直都在做端侧大模型,之前有文本系列MiniCPM-2B模型,还有多模态系列的MiniCPM-V系列模型,今天又开源了MiniCPM3-4B模型,真是端侧一路走到低。
这次MiniCPM3-4B也是在效果上有了巨大的提升,超过Phi-3.5-mini-Instruct模型,肩比Llama3.1-8B-Instruct、GLM-4-9B-Chat、Qwen2-7B-Instruct等一众模型,堪称小模型之王。
之前的MiniCPM-2B模型报告也是干活满满,详见:https://shengdinghu.notion.site/MiniCPM-c805a17c5c8046398914e47f0542095a
这里说一下哈,MiniCPM-2B是1.0版本模型,MiniCPM-1B是2.0版本模型,现在是3.0版本4B。
下面是3个版本的模型结构(1->2->3)的区别:
同时,还发布了RAG套件MiniCPM-Embedding模型和MiniCPM-Reranker模型,针对 RAG场景还发布了微调版MiniCPM3-RAG-LoRA模型。
MiniCPM3-4B模型在中文英文遵循、数据推理、代码能力、工具调用上表现均很不错的效果。
其中,工具调用能力尤为突出,在Berkeley Function Calling Leaderboard上优于Llama3.1-8B-Instruct、GLM-4-9B-Chat、Qwen2-7B-Instruct等更大模型。
长文档的大海捞针也是全绿。
PS:模型下载有困难的同学,详见我之前写的一篇文章《大模型下载使我痛苦》。
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# 模型加载
path = "openbmb/MiniCPM3-4B"
tokenizer = AutoTokenizer.from_pretrained(path, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(path, torch_dtype=torch.bfloat16, device_map="cuda", trust_remote_code=True)
# 输入构造
messages = [
{"role": "user", "content": "你知道刘聪NLP是谁吗?"},
]
model_inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to("cuda")
# 模型生成
model_outputs = model.generate(
model_inputs,
max_new_tokens=1024,
top_p=0.8,
temperature=0.9,
repetition_penalty=1.1
)
# 模型解码
output_token_ids = [
model_outputs[i][len(model_inputs[i]):] for i in range(len(model_inputs))
]
responses = tokenizer.batch_decode(output_token_ids, skip_special_tokens=True)[0]
print(responses)
53AI,企业落地大模型首选服务商
产品:场景落地咨询+大模型应用平台+行业解决方案
承诺:免费场景POC验证,效果验证后签署服务协议。零风险落地应用大模型,已交付160+中大型企业
2025-03-13
谷歌Gemma 3震撼发布:单GPU/TPU秒杀Llama-405B,最强轻量AI来了!
2025-03-13
谷歌突然开源Gemma 3!128K长上下文+多模态,碾压Llama 405B?
2025-03-13
单卡跑出27B性能!谷歌Gemma 3开源模型如何重新定义AI开发边界?
2025-03-13
刚刚,谷歌Gemma 3上线!单GPU最强多模态手机可跑,27B完胜o3-mini
2025-03-13
AI Agent 爆火,MCP 到底是啥
2025-03-13
Gemma 3 27B版本超越DeepSeek V3:技术要点分析!
2025-03-13
谷歌开源模型Gemma 3,部署效率完胜DeepSeek-V3/R1
2025-03-13
「三小时复刻 Manus,GitHub 2 万星」:OpenManus 多智能体框架的技术拆解
2025-01-01
2024-07-25
2024-05-06
2025-01-21
2024-09-20
2024-07-20
2024-06-12
2024-08-13
2024-07-11
2024-12-26
2025-03-13
2025-03-13
2025-03-08
2025-03-03
2025-03-02
2025-03-01
2025-02-26
2025-02-23