minimind
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "minimind":https://skillpi.com/zh/skills/deepskill-57a7b84a3b3cae57dc8ac807b3f53b39c1856e38091b16be954058118bd7ba97。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
在两小时内从零开始训练一个小型 GPT 模型,通过构建模型来理解大型语言模型架构。适用于学习 LLM 内部工作原理、训练自定义小型语言模型、教育类 AI 项目和微调实验的场景。
介绍来源: third_party · TerminalSkills · 1.0.0 参考来源
SkillPi 解读
- 实测状态
- 未测试
文件浏览
Frontmatter
name: minimind
description: >-
Train a small GPT model from scratch in 2 hours — understand LLM architecture by building
one. Use when: learning how LLMs work internally, training custom small language models,
educational AI projects, fine-tuning experiments.
license: Apache-2.0
compatibility: "Python 3.10+, CUDA GPU recommended"
metadata:
author: terminal-skills
version: "1.0.0"
category: data-ai
tags:
- llm-training
- gpt
- from-scratch
- education
- machine-learningMiniMind
Overview
Train a 64M parameter GPT language model from scratch in ~2 hours on a single GPU. Understand every component of LLM architecture by building one yourself — from tokenizer training to RLHF alignment. The architecture tracks Qwen3/Qwen3-MoE, so patterns you learn here apply directly to full-scale models.
Source: jingyaogong/minimind (45k+ stars)
Instructions
1. Clone and install
git clone https://github.com/jingyaogong/minimind.git
cd minimind
pip install -r requirements.txt
python download_data.py
2. Pretrain on raw text
python train_pretrain.py \
--data_path ./data/pretrain_data.jsonl \
--model_config ./config/minimind-3.yaml \
--epochs 2 \
--batch_size 32 \
--learning_rate 5e-4
3. Supervised fine-tuning (SFT)
python train_sft.py \
--pretrained_model ./checkpoints/pretrain/best.pt \
--data_path ./data/sft_data.jsonl \
--epochs 3 \
--batch_size 16 \
--learning_rate 1e-5
4. RLHF alignment (optional)
python train_dpo.py \
--model_path ./checkpoints/sft/best.pt \
--preference_data ./data/dpo_pairs.jsonl
Multiple alignment methods: DPO (simplest), PPO (classic), GRPO (DeepSeek-style).
5. Run inference
python inference.py --model_path ./checkpoints/dpo/best.pt
Or start an OpenAI-compatible API server:
python api_server.py --model_path ./checkpoints/sft/best.pt --port 8000
Examples
Example 1: Full training pipeline on a single GPU
Train a 64M parameter model from scratch on an NVIDIA RTX 3090:
git clone https://github.com/jingyaogong/minimind.git && cd minimind
pip install -r requirements.txt
python download_data.py
python train_pretrain.py # ~1h — learns language patterns
python train_sft.py # ~30min — learns to follow instructions
python train_dpo.py # ~20min — aligns with human preferences
python inference.py --model_path ./checkpoints/dpo/best.pt
# > What is machine learning?
# Machine learning is a subset of artificial intelligence where systems
# learn patterns from data rather than being explicitly programmed...
Total cost: ~$3 in GPU rental or ~2 hours on your own hardware.
Example 2: LoRA fine-tuning for a specific domain
Fine-tune the base model on medical Q&A data using LoRA (parameter-efficient):
python train_lora.py \
--base_model ./checkpoints/sft/best.pt \
--data_path ./data/medical_qa.jsonl \
--lora_rank 8 \
--lora_alpha 16
SFT data format:
{
"conversations": [
{"role": "user", "content": "What are the symptoms of Type 2 diabetes?"},
{"role": "assistant", "content": "Common symptoms include increased thirst, frequent urination, blurred vision, slow-healing wounds, and unexplained weight loss..."}
]
}
Example 3: Python API for programmatic inference
from model import MiniMindModel
from tokenizer import MiniMindTokenizer
model = MiniMindModel.from_pretrained("./checkpoints/sft/best.pt")
tokenizer = MiniMindTokenizer("./tokenizer/tokenizer.model")
prompt = "Explain how attention works in transformers"
input_ids = tokenizer.encode(prompt)
output = model.generate(input_ids, max_new_tokens=256, temperature=0.7)
print(tokenizer.decode(output))
Guidelines
- GPU requirements: 64M model needs ~4GB VRAM (RTX 3090 recommended); even a GTX 1660 works (slower)
- MoE variant available at 198M total / 64M active parameters — needs ~8GB VRAM
- Pre-built datasets on HuggingFace: pretrain corpus, SFT pairs, DPO preference pairs, tool-use examples
- Multi-GPU supported via DDP and DeepSpeed for larger variants
- Not production-grade — MiniMind is an educational tool. It won't match GPT-4, but teaches you every component: tokenizer, embeddings, attention, FFN, training dynamics, RLHF
- Architecture uses GQA attention, SwiGLU FFN, RMSNorm, and RoPE with YaRN — matching production model patterns
References
当前收录版本
1.0.0
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 高价值教育工具,帮助用户理解LLM架构
- 具有明确的学习价值和实用场景
- 适合学习LLM内部工作原理、训练自定义小型语言模型、教育类AI项目、微调实验
亮点
- 触发词精准完整,覆盖多种变体
- 边界清晰
- description位置正确且内容完整
亮点
- Phase/步骤清晰,有出口条件
- 含端到端示例
- frontmatter完整
- 单文件长度合理
亮点
- 工具来源明确(GitHub项目)
- 参数正确
- 覆盖主要异常
- 不可逆操作有确认机制
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
-
安装或获取外部依赖
使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。
主文档提及 · 第 36, 92 行
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- github.com
- huggingface.co
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。