- 推荐使用 UV 安装依赖
- 创建虚拟环境:
uv venv -p 3.12
- 激活虚拟环境:
source .venv/bin/activate
- 安装
toyllm
:uv pip install toyllm
- 创建虚拟环境:
- 拉取本项目到本地
git clone https://github.com/ai-glimpse/toyllm.git
- 安装 LFS: https://git-lfs.com
git lfs install
- 下载模型文件
- 在
toyllm
的根目录下执行git clone https://huggingface.co/MathewShen/toyllm-gpt2 models
- 或者直接从https://huggingface.co/MathewShen/toyllm-gpt2/tree/main下载模型文件,并放到
toyllm/models
目录下
- 在
-
GPT2:
python toyllm/cli/run_gpt2.py
python toyllm/cli/run_gpt2.py --help
查看参数信息
-
Speculative Sampling GPT2:
python toyllm/cli/run_speculative_sampling.py
python toyllm/cli/run_speculative_sampling.py --help
查看参数信息
The project is highly inspired by the following projects: