Skip to content

ai-glimpse/toyllm

Repository files navigation

ToyLLM: Learning LLM from Scratch

快速开始

环境配置

  • 推荐使用 UV 安装依赖
    • 创建虚拟环境:uv venv -p 3.12
    • 激活虚拟环境:source .venv/bin/activate
    • 安装toyllmuv pip install toyllm

拉取项目 & 下载模型文件

  • 拉取本项目到本地
    • git clone https://github.com/ai-glimpse/toyllm.git
  • 安装 LFS: https://git-lfs.com
  • git lfs install
  • 下载模型文件

运行示例

  • 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 查看参数信息

Acknowledgements

The project is highly inspired by the following projects: