Skip to content

About

LLM GPU Toolkit: estimate VRAM, training/inference GPU needs, multi-GPU allocation, and quantization impact. 大模型 GPU 显存与算力估算。by jammyfu / PaintingCoder

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

3 stars

Watchers

1 watching

Forks

Latest commit

 

History

60 Commits

Folders and files

Repository files navigation

LLM GPU Toolkit estimates GPU memory (VRAM) and compute for training and running large language models, including quantization and multi-GPU setups. 估算大语言模型训练与推理所需的显存和算力(含量化、多卡)。

Live demo Python Release

Online / 在线使用: https://jammyfu.github.io/llm_gpu_toolkit/ · Install / 安装: see 安装说明

Project Entry

Standardized Summary

  • Positioning: Mixed Python and web tooling for LLM GPU sizing, model data collection, and resource estimation.
  • Stack: Python scripts plus static web assets.
  • Current goal: Normalize the mixed-tooling repo into a stable planning loop without changing its data model or calculators.

LLM GPU Toolkit

LLM GPU工具包,专注于大语言模型的GPU资源计算和优化,帮助开发者更好地规划和利用GPU资源。

功能特点

  • 计算LLM模型在不同配置下的GPU显存占用
  • 估算模型训练和推理时的GPU算力需求
  • 提供多卡并行训练的资源分配建议
  • 支持主流LLM模型的显存优化方案分析
  • 模型量化对GPU资源影响的评估

安装说明

方法1:使用虚拟环境(推荐)

  1. 创建并配置虚拟环境:
python setup.py setup_venv
  1. 激活虚拟环境:

Windows:

.\venv\Scripts\activate

Linux/Mac:

source venv/bin/activate
  1. 安装包:
pip install -e .

方法2:直接安装

pip install llm-gpu-toolkit

环境要求

  • Python >= 3.8
  • 依赖包会在安装时自动配置:
    • beautifulsoup4 >= 4.12.0
    • requests >= 2.31.0
    • urllib3 >= 2.0.0
    • certifi >= 2023.11.17
    • charset-normalizer >= 3.3.0
    • idna >= 3.6
    • soupsieve >= 2.5

使用方法

获取模型数据 (get_model.py)

get_model.py 可以从 Ollama 库中获取不同模型的信息,包括模型名称、大小、量化方式等数据。

配置文件

在运行 get_model.py 前,请确保配置文件 config.json 已正确设置:

{
    "output_dirs": {
        "cleaned": "modeldata/cleaned"
    },
    "models": [
        {
            "name": "deepseek r1",
            "key": "deepseek",
            "version": "r1",
            "description": "DeepSeek R1: 作为一个由 DeepSeek 公司开发的模型...",
            "base_url": "https://ollama.com/library/deepseek-r1",
            "tags_url": "https://ollama.com/library/deepseek-r1/tags",
            "output_file": "deepseek_r1_models.json"
        },
        // 其他模型配置...
    ]
}

运行模型数据获取

  1. 确保已安装所有依赖
  2. 运行脚本获取模型数据:
python get_model.py
  1. 数据将保存在 modeldata/cleaned/ 目录下,每个模型系列对应一个 JSON 文件

示例输出

脚本运行后会在控制台输出处理进度,并在指定目录生成 JSON 文件,包含模型的详细信息:

许可证

本项目采用 MIT 许可证。详见 LICENSE 文件。

贡献指南

欢迎提交 Issue 和 Pull Request!

作者

更新日志

0.1.0

  • 初始版本发布
  • 基础GPU资源计算功能实现
  • 支持主流LLM模型的显存分析

本地服务器运行

方法1:使用 Python 内置 HTTP 服务器

  1. 进入项目根目录:
cd llm-gpu-toolkit
  1. 启动 HTTP 服务器:
python -m http.server 8000
  1. 在浏览器中访问:
http://localhost:8000/index.html

方法2:使用 Node.js(推荐,支持热重载)

  1. 安装 Node.js 依赖:
npm install -g live-server
  1. 启动服务器:
live-server --port=8000
  1. 浏览器会自动打开 index.html

方法3:使用 VSCode Live Server

  1. 在 VSCode 中安装 "Live Server" 扩展
  2. 右键 index.html,选择 "Open with Live Server"
  3. 浏览器会自动打开页面

About

LLM GPU Toolkit: estimate VRAM, training/inference GPU needs, multi-GPU allocation, and quantization impact. 大模型 GPU 显存与算力估算。by jammyfu / PaintingCoder

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages