minicpm5-deploy-transformers
하는 일
이 스킬은 하나의 Python 스크립트에서 Hugging Face Transformers 라이브러리로 MiniCPM5를 실행하도록 AI를 안내합니다. 서버를 설정하지 않고 빠르게 테스트하려는 사람을 위한 스킬입니다.
사용하는 경우
- ✓MiniCPM5로 텍스트를 생성하는 짧은 Python 스크립트가 필요할 때.
- ✓GPU 한 개가 있고 bfloat16으로 모델을 실행하고 싶을 때.
- ✓GPU가 없어서 CPU에서 모델을 실행해야 하는 경우.
스킬 링크
https://github.com/OpenBMB/MiniCPM/blob/main/skills/minicpm5-deploy-transformers/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“서버 없이 MiniCPM5를 실행해서 질문 하나에 답하는 짧은 Python 스크립트를 작성해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
이 스킬은 라이브러리를 설치하고, 모델과 토크나이저를 불러오고, 채팅 프롬프트를 만든 뒤, 하나의 스크립트에서 답변을 생성합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Deploy MiniCPM5-1B and MiniCPM5-2B with HF Transformers
One-shot Python generation. No server. Works on a single GPU (bfloat16) or CPU only (fp32).
Required input
| Var | Example | Default |
|---|---|---|
MODEL_PATH |
openbmb/MiniCPM5-2B or local dir |
required; openbmb/MiniCPM5-1B also works |
MODE |
think or nothink (nothink is 1B-only) |
think |
Steps
1. Install (once)
pip install -U "transformers>=5.6,<6" "torch>=2.11" accelerate # latest (CUDA 13.x driver hosts)
# pip install -U "transformers==4.57.3" "torch==2.7.1" accelerate # fallback for CUDA 12.x driver hosts
2. Run
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_path = "${MODEL_PATH}" # ← replace
tok = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(
model_path,
torch_dtype=torch.bfloat16, # CPU users: torch.float32 + device_map="cpu"
device_map="auto",
).eval()
messages = [{"role": "user", "content": "用一句话解释什么是 GQA。"}]
inputs = tok.apply_chat_template(
messages,
add_generation_prompt=True,
enable_thinking=True,
return_tensors="pt",
return_dict=True,
).to(model.device)
with torch.no_grad():
out = model.generate(
**inputs,
max_new_tokens=1024,
do_sample=True,
temperature=1.0,
top_p=0.95,
)
prompt_len = inputs["input_ids"].shape[-1]
print(tok.decode(out[0][prompt_len:], skip_special_tokens=True))
For CPU only: change torch_dtype=torch.float32, device_map="cpu". Keep enable_thinking=True and temperature=1.0 for MiniCPM5-2B; use enable_thinking=False and temperature=0.7 only for MiniCPM5-1B No-think mode.
Sampling defaults
| Mode | enable_thinking |
temperature |
top_p |
|---|---|---|---|
| MiniCPM5-2B Think | True |
1.0 | 0.95 |
| MiniCPM5-1B Think | True |
0.9 | 0.95 |
| MiniCPM5-1B No-think | False |
0.7 | 0.95 |
Validate
A coherent answer to 1+1=? (e.g. "2" or "答案是 2").
LoRA inference
from peft import PeftModel
base = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype=torch.bfloat16, device_map="auto")
model = PeftModel.from_pretrained(base, "/path/to/adapter").eval()
Adapters from any of the minicpm5-finetune-* skills load directly with no surgery.
When NOT to use
- Need an OpenAI-compatible HTTP server →
minicpm5-deploy-vllmorminicpm5-deploy-sglang - Apple Silicon →
minicpm5-deploy-mlxis faster - CPU-only or low-VRAM laptop →
minicpm5-deploy-llama-cppwith Q4_K_M is faster
Reference
자주 묻는 질문
GPU 없이도 실행할 수 있나요?
네. CPU에서는 float32를 쓰고 장치를 cpu로 설정하라고 이 스킬은 말합니다.
thinking 모드를 지원하나요?
네. enable_thinking 설정이 포함되어 있으며, nothink 모드는 1B 모델에만 해당한다고 설명합니다.
어떤 버전이 필요한가요?
transformers는 5.6 이상 6 미만, torch는 2.11 이상이 필요하다고 이 스킬은 요구합니다.
상세 정보
작성자의 원본 설명
Run MiniCPM5-1B or MiniCPM5-2B with Hugging Face Transformers for one-shot Python generation on GPU (bfloat16) or CPU (float32). Use when the user wants a quick Python script, no server, no extra deps, or asks for "Transformers", "AutoModelForCausalLM", "model.generate" with MiniCPM5.
repo: OpenBMB/MiniCPM
인기도
- GitHub 스타
- 12k
- 순위
- #11536
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 9. 21.
댓글
- …
이 저장소의 다른 스킬
minicpm5-deploy-litert
12k에이전트가 Google의 LiteRT-LM 런타임과 하나의 모델 파일로 컴퓨터나 Android 휴대폰에서 MiniCPM5 모델을 실행하도록 돕습니다.
minicpm5-deploy-llama-cpp
12k에이전트에게 llama.cpp와 미리 만들어진 GGUF 파일로 CPU나 가정용 그래픽 카드에서 MiniCPM5 모델을 실행하는 방법을 보여 줍니다.
minicpm5-deploy-lmstudio
12k에이전트가 채팅 창이 있는 데스크톱 앱 LM Studio에서 MiniCPM5 모델을 실행하고, OpenAI 방식의 로컬 서버를 시작하도록 돕습니다.
minicpm5-deploy-mlx
12k에이전트가 Apple의 MLX 프레임워크로 Apple Silicon Mac에서 MiniCPM5 모델을 직접 실행해, 빠른 로컬 채팅과 텍스트 생성을 하도록 돕습니다.
비슷한 스킬
openclaw-update
394k에이전트가 설치 방식에 맞는 방법을 골라 기존 OpenClaw Gateway를 업데이트하고, 세션이 계속 작동하도록 돕습니다.
diagnose-gateway
394k에이전트가 설정, 채널, 포트를 확인해 OpenClaw Gateway가 왜 실패하는지 찾되, 아무것도 바꾸지 않도록 돕습니다.
crabbox-apps
394k에이전트가 임시 클라우드 머신에서 앱을 열고 실행한 뒤, 그 화면을 채팅의 측면 패널에 보여 주도록 돕습니다.