Spaces:
Running
Running
Download index.html from everxcloud/gpu-vram-calculator: direct link, hf CLI and curl.
- Browser
- Download file 8.68 kB
-
https://huggingface.co/spaces/everxcloud/gpu-vram-calculator/resolve/main/index.html
- Command line
-
hf download hf://spaces/everxcloud/gpu-vram-calculator/index.html
-
curl -L -o index.html https://huggingface.co/spaces/everxcloud/gpu-vram-calculator/resolve/main/index.html
8.68 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>LLM VRAM Calculator</title> | |
| <style> | |
| :root{--bg:#04070f;--panel:#0b1120;--line:#1e293b;--text:#e5e7eb;--muted:#94a3b8;--a:#8b5cf6;--b:#22d3ee} | |
| *{box-sizing:border-box} | |
| body{margin:0;background:var(--bg);color:var(--text);font:15px/1.5 Inter,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif} | |
| main{max-width:960px;margin:0 auto;padding:32px 16px} | |
| h1{font-size:28px;margin:0 0 6px} | |
| p.lead{color:var(--muted);margin:0 0 24px} | |
| .grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px} | |
| label{display:block;font-size:13px;color:var(--muted);margin-bottom:4px} | |
| input,select{width:100%;padding:9px 10px;border-radius:8px;border:1px solid var(--line);background:var(--panel);color:var(--text);font:inherit} | |
| .card{background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:16px;margin-top:16px;overflow-x:auto} | |
| .totals{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px} | |
| .totals b{display:block;font-size:22px} | |
| .totals span{color:var(--muted);font-size:13px} | |
| table{width:100%;border-collapse:collapse;font-size:14px} | |
| th,td{text-align:left;padding:7px 8px;border-bottom:1px solid var(--line)} | |
| th{color:var(--muted);font-weight:500} | |
| code{font-family:"JetBrains Mono",ui-monospace,monospace;font-size:13px;color:#cbd5e1} | |
| a.cta{display:inline-block;margin-top:8px;padding:10px 16px;border-radius:8px;color:#04070f;font-weight:600;text-decoration:none;background:linear-gradient(90deg,var(--a),var(--b))} | |
| footer{color:var(--muted);font-size:13px;margin-top:24px} | |
| footer a{color:var(--b)} | |
| </style> | |
| </head> | |
| <body> | |
| <main> | |
| <h1>LLM VRAM Calculator</h1> | |
| <p class="lead">Estimate how much GPU memory a large language model needs for inference (weights, KV cache and runtime overhead) and which GPUs can hold it alone or in 2, 4 or 8 cards.</p> | |
| <div class="grid"> | |
| <div><label for="preset">Model size</label><select id="preset"><option>7B</option><option>8B</option><option>13B</option><option>34B</option><option selected>70B</option><option>405B</option><option value="custom">Custom</option></select></div> | |
| <div><label for="billions">Parameters (billions)</label><input id="billions" type="number" min="0.1" step="0.1" value="70"></div> | |
| <div><label for="precision">Precision</label><select id="precision"><option value="fp32">FP32</option><option value="bf16" selected>BF16 / FP16</option><option value="fp8">FP8</option><option value="int8">INT8</option><option value="int4">INT4</option></select></div> | |
| <div><label for="layers">Layers</label><input id="layers" type="number" min="1" value="80"></div> | |
| <div><label for="kvdim">KV dimension per layer</label><input id="kvdim" type="number" min="1" value="1024"></div> | |
| <div><label for="ctx">Context (tokens)</label><input id="ctx" type="number" min="0" step="1024" value="8192"></div> | |
| <div><label for="batch">Batch</label><input id="batch" type="number" min="1" value="1"></div> | |
| <div><label for="overhead">Overhead (%)</label><input id="overhead" type="number" min="0" max="100" value="10"></div> | |
| </div> | |
| <div class="card"><div class="totals"> | |
| <div><span>Weights</span><b id="w">-</b></div><div><span>KV cache</span><b id="kv">-</b></div><div><span>Overhead</span><b id="o">-</b></div><div><span>Total</span><b id="t">-</b></div> | |
| </div></div> | |
| <div class="card"><table><thead><tr><th>GPU</th><th>Memory per GPU</th><th>GPUs needed</th></tr></thead><tbody id="fits"></tbody></table></div> | |
| <div class="card"> | |
| <p><b>Formulas</b></p> | |
| <p><code>Weights (GB) = billions of parameters × bytes per parameter</code> (4 in FP32, 2 in BF16/FP16, 1 in FP8/INT8, 0.5 in INT4)<br> | |
| <code>KV cache (GB) = 2 × layers × KV dimension × context tokens × batch × 2 bytes / 10^9</code><br> | |
| <code>Total = (weights + KV cache) × (1 + overhead %)</code></p> | |
| <p>Presets assume a typical architecture for each size. Multi-GPU totals do not include the cost of splitting the model across cards.</p> | |
| <a class="cta" href="https://everxcloud.ai/en/tools/llm-vram-calculator?utm_source=huggingface&utm_medium=space&utm_campaign=vram-calculator" target="_blank" rel="noopener">Full calculator with GPU recommendations on EverXCloud</a> | |
| </div> | |
| <footer>Made by <a href="https://everxcloud.ai/en/tools/llm-vram-calculator?utm_source=huggingface&utm_medium=space&utm_campaign=vram-calculator" target="_blank" rel="noopener">EverXCloud</a>, a US GPU marketplace to rent cloud GPUs by the hour or sell GPU capacity. Source: <a href="https://github.com/everxcloud/gpu-vram-calculator" target="_blank" rel="noopener">github.com/everxcloud/gpu-vram-calculator</a> (MIT).</footer> | |
| </main> | |
| <script> | |
| const BYTES = { fp32: 4, bf16: 2, fp8: 1, int8: 1, int4: 0.5 }; | |
| const PRESETS = { "7B": [7, 32, 4096], "8B": [8, 32, 1024], "13B": [13, 40, 5120], "34B": [34, 48, 1024], "70B": [70, 80, 1024], "405B": [405, 126, 1024] }; | |
| const GPUS = [["NVIDIA RTX A2000 6GB", 6], ["NVIDIA RTX A2000 12GB", 12], ["NVIDIA A16 16GB", 16], ["NVIDIA A2 16GB", 16], ["NVIDIA RTX 2000 Ada 16GB", 16], ["NVIDIA RTX A4000 16GB", 16], ["NVIDIA RTX PRO 2000 Blackwell 16GB", 16], ["NVIDIA Tesla P100 16GB", 16], ["NVIDIA Tesla T4 16GB", 16], ["NVIDIA Tesla V100 16GB", 16], ["NVIDIA RTX 4000 Ada 20GB", 20], ["NVIDIA RTX 4000 SFF Ada 20GB", 20], ["NVIDIA RTX A4500 20GB", 20], ["NVIDIA A10 24GB", 24], ["NVIDIA A30 24GB", 24], ["NVIDIA GeForce RTX 3090 24GB", 24], ["NVIDIA GeForce RTX 3090 Ti 24GB", 24], ["NVIDIA GeForce RTX 4090 24GB", 24], ["NVIDIA GeForce RTX 4090 D 24GB", 24], ["NVIDIA L4 24GB", 24], ["NVIDIA Quadro RTX 6000 24GB", 24], ["NVIDIA RTX 4500 Ada 24GB", 24], ["NVIDIA RTX A5000 24GB", 24], ["NVIDIA RTX A5500 24GB", 24], ["NVIDIA RTX PRO 4000 Blackwell 24GB", 24], ["NVIDIA RTX PRO 4000 Blackwell SFF 24GB", 24], ["NVIDIA Tesla P40 24GB", 24], ["NVIDIA TITAN RTX 24GB", 24], ["NVIDIA GeForce RTX 5090 32GB", 32], ["NVIDIA RTX 5000 Ada 32GB", 32], ["NVIDIA RTX PRO 4500 Blackwell 32GB", 32], ["NVIDIA Tesla V100 32GB", 32], ["NVIDIA A100 PCIe 40GB", 40], ["NVIDIA A100 SXM 40GB", 40], ["NVIDIA A40 48GB", 48], ["NVIDIA L40 48GB", 48], ["NVIDIA L40S 48GB", 48], ["NVIDIA Quadro RTX 8000 48GB", 48], ["NVIDIA RTX 5880 Ada 48GB", 48], ["NVIDIA RTX 6000 Ada 48GB", 48], ["NVIDIA RTX A6000 48GB", 48], ["NVIDIA RTX PRO 5000 Blackwell 48GB", 48], ["NVIDIA RTX PRO 5000 Blackwell 72GB", 72], ["NVIDIA A100 PCIe 80GB", 80], ["NVIDIA A100 SXM 80GB", 80], ["NVIDIA A800 PCIe 80GB", 80], ["NVIDIA H100 PCIe 80GB", 80], ["NVIDIA H100 SXM 80GB", 80], ["NVIDIA H100 NVL 94GB", 94], ["Google TPU v5p", 95], ["NVIDIA GH200", 96], ["NVIDIA RTX PRO 6000 Blackwell 96GB", 96], ["NVIDIA RTX PRO 6000 Blackwell Max-Q 96GB", 96], ["NVIDIA H200 141GB", 141], ["NVIDIA H200 NVL 141GB", 141], ["NVIDIA B200 180GB", 180], ["NVIDIA GB200 NVL", 186], ["AMD Instinct MI300X 192GB", 192], ["AMD Instinct MI325X 256GB", 256], ["NVIDIA B300 288GB", 288], ["NVIDIA GB300 NVL", 288]]; | |
| const $ = (id) => document.getElementById(id); | |
| const fmt = (x) => x.toFixed(1) + " GB"; | |
| function applyPreset() { | |
| const p = PRESETS[$("preset").value]; | |
| if (p) { $("billions").value = p[0]; $("layers").value = p[1]; $("kvdim").value = p[2]; } | |
| update(); | |
| } | |
| function update() { | |
| const b = +$("billions").value, l = +$("layers").value, k = +$("kvdim").value; | |
| const c = +$("ctx").value, n = +$("batch").value, ov = +$("overhead").value; | |
| if (!(b > 0 && l >= 1 && k >= 1 && c >= 0 && n >= 1 && ov >= 0 && ov <= 100)) { $("t").textContent = "invalid input"; return; } | |
| const w = b * BYTES[$("precision").value]; | |
| const kv = (2 * l * k * c * n * 2) / 1e9; | |
| const o = ((w + kv) * ov) / 100; | |
| const t = w + kv + o; | |
| $("w").textContent = fmt(w); $("kv").textContent = fmt(kv); $("o").textContent = fmt(o); $("t").textContent = fmt(t); | |
| const fits = []; | |
| for (const [name, v] of GPUS) { const cnt = [1, 2, 4, 8].find((x) => x * v >= t); if (cnt) fits.push([name, v, cnt]); } | |
| fits.sort((a, z) => a[2] - z[2] || a[1] - z[1] || a[0].localeCompare(z[0])); | |
| $("fits").innerHTML = fits.length | |
| ? fits.map((f) => "<tr><td>" + f[0] + "</td><td>" + f[1] + " GB</td><td>" + f[2] + "</td></tr>").join("") | |
| : '<tr><td colspan="3">No single node of up to 8 GPUs holds this model.</td></tr>'; | |
| } | |
| $("preset").addEventListener("change", applyPreset); | |
| for (const id of ["billions", "precision", "layers", "kvdim", "ctx", "batch", "overhead"]) { | |
| $(id).addEventListener("input", () => { | |
| if (id === "billions" || id === "layers" || id === "kvdim") $("preset").value = "custom"; | |
| update(); | |
| }); | |
| } | |
| update(); | |
| </script> | |
| </body> | |
| </html> | |