本页面将帮助你快速上手 MiniMind 项目。
!!! tip "硬件配置参考"
- CPU: Intel i9-10980XE @ 3.00GHz
- RAM: 128 GB
- GPU: NVIDIA GeForce RTX 3090 (24GB)
git clone https://github.com/jingyaogong/minimind.git
cd minimind
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
!!! warning "Torch CUDA 检查"
安装后请测试 Torch 是否可用 CUDA:
```python
import torch
print(torch.cuda.is_available())
```
从 HuggingFace 或 ModelScope 下载预训练模型:
# 从 HuggingFace 下载
git clone https://huggingface.co/jingyaogong/MiniMind2
# 或从 ModelScope 下载
git clone https://www.modelscope.cn/models/gongjy/MiniMind2.git
# load=0: 加载 PyTorch 模型, load=1: 加载 Transformers 模型
python eval_model.py --load 1 --model_mode 2
# 需要 Python >= 3.10
pip install streamlit
cd scripts
streamlit run web_demo.py
访问 http://localhost:8501 即可使用 Web 界面。
MiniMind 支持多种主流推理框架:
ollama run jingyaogong/minimind2
vllm serve ./MiniMind2/ --served-model-name "minimind"
# 转换模型
python convert_hf_to_gguf.py ./MiniMind2/
# 量化模型
./build/bin/llama-quantize ./MiniMind2/MiniMind2-109M-F16.gguf ./Q4-MiniMind2.gguf Q4_K_M
# 推理
./build/bin/llama-cli -m ./Q4-MiniMind2.gguf --chat-template chatml
👶: 你好,请介绍一下自己。
🤖️: 你好!我是 MiniMind,一个由 Jingyao Gong 开发的人工智能助手。
我通过自然语言处理和算法训练来与用户进行交互。
👶: 世界上最高的山峰是什么?
🤖️: 珠穆朗玛峰是世界上最高的山峰,位于喜马拉雅山脉,
海拔 8,848.86 米(29,031.7 英尺)。