CoolFace
Apppublic

george614/gpu-memory-calculator

sourceHugging Facemitupdated 8mo agoView on Hugging Face
0likes
App README

๐ŸŽฎ GPU Memory Calculator for LLM Training & Inference

Instantly calculate GPU memory requirements for training and running Large Language Models. Plan your infrastructure, avoid OOM errors, and optimize costs before you start.

![GitHub Stars](https://github.com/George614/gpu-mem-calculator) ![GitHub Issues](https://github.com/George614/gpu-mem-calculator/issues) ![License: MIT](https://opensource.org/licenses/MIT)

๐Ÿš€ Why Use This Tool?

  • โ€”๐Ÿ’ฐ Save Money - Know exactly what GPUs you need before spending thousands
  • โ€”โšก Avoid OOM - Validate your config fits in memory before training
  • โ€”๐Ÿ“Š Compare Strategies - DeepSpeed vs Megatron vs FSDP at a glance
  • โ€”๐ŸŽฏ Plan Infrastructure - From 7B to 175B+ parameter models
  • โ€”โš™๏ธ Export Configs - Generate working configs for your training framework

โœจ Features

Training Memory Calculation

Calculate memory for all major training frameworks:

  • โ€”PyTorch DDP - Baseline distributed training
  • โ€”DeepSpeed ZeRO (Stages 0-3) with CPU/NVMe offloading
  • โ€”Megatron-LM - Tensor + Pipeline parallelism
  • โ€”PyTorch FSDP - Fully sharded data parallel
  • โ€”Megatron + DeepSpeed - Hybrid approach

Inference Memory Estimation

Optimize your deployment with:

  • โ€”HuggingFace Transformers - Baseline inference
  • โ€”vLLM - PagedAttention optimization
  • โ€”TGI - Text Generation Inference
  • โ€”TensorRT-LLM - Maximum throughput
  • โ€”SGLang - RadixAttention caching

Smart Features

  • โ€”๐ŸŽฏ Model Presets - LLaMA 2, GPT-3, Mixtral, GLM, Qwen, DeepSeek-MoE
  • โ€”๐Ÿ“ฆ Export Configs - Accelerate, Lightning, Axolotl, DeepSpeed, YAML, JSON
  • โ€”๐Ÿ”ข Batch Optimizer - Auto-find max batch size for your hardware
  • โ€”๐ŸŒ Multi-Node - Calculate network overhead for distributed training
  • โ€”๐Ÿ’พ KV Cache - Quantization options (INT4/INT8/FP8/None)

๐ŸŽฏ Supported Models

ModelParametersUse Case
LLaMA 27B, 13B, 70BGeneral purpose
GPT-3175BLarge scale training
Mixtral 8x7B47BMixture of Experts
GLM-49B - 355BChinese/English
Qwen MoE2.7BEfficient inference
DeepSeek-MoE16Bsparse training

๐Ÿ“– How to Use

  1. 1.Select a Model - Choose from presets or enter custom parameters
  2. 2.Pick Your Engine - Training (DeepSpeed/Megatron/FSDP) or Inference (vLLM/TGI/SGLang)
  3. 3.Configure - Adjust batch size, GPUs, precision, offloading
  4. 4.Calculate - Get instant memory breakdown
  5. 5.Export - Generate working configs for your framework

๐Ÿ’ก Example Use Cases

  • โ€”"Can I train a 7B model on 4x A100s?" โ†’ Calculate and find out
  • โ€”"What's the max batch size for DeepSpeed ZeRO-3?" โ†’ Batch optimizer tells you
  • โ€”"vLLM vs TGI - which uses less memory?" โ†’ Compare instantly
  • โ€”"How many GPUs for 175B with Megatron?" โ†’ Plan your cluster

๐Ÿ”— Links & Resources

  • โ€”[GitHub Repository](https://github.com/George614/gpu-mem-calculator) - Star us on GitHub! โญ
  • โ€”[Full Documentation](https://github.com/George614/gpu-mem-calculator#readme) - Complete guide
  • โ€”[Report Issues](https://github.com/George614/gpu-mem-calculator/issues) - Bug reports & feature requests
  • โ€”[Contributing Guide](https://github.com/George614/gpu-mem-calculator/blob/main/CONTRIBUTING.md) - Pull requests welcome!

๐Ÿ“š Technical Details

Built with:

  • โ€”FastAPI - High-performance web framework
  • โ€”Pydantic - Data validation and settings
  • โ€”Python 3.12 - Latest Python for maximum performance

Formulas verified against:

๐Ÿ“Š License

MIT License - Free for commercial and personal use.


Made with โค๏ธ by the AI community

![GitHub stars](https://github.com/George614/gpu-mem-calculator)