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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>ML Model Memory Calculator</title>
|
| 7 |
+
<style>
|
| 8 |
+
:root {
|
| 9 |
+
--primary-color: #4a6fa5;
|
| 10 |
+
--secondary-color: #166088;
|
| 11 |
+
--accent-color: #4fc3a1;
|
| 12 |
+
--background-color: #f8f9fa;
|
| 13 |
+
--card-color: #ffffff;
|
| 14 |
+
--text-color: #333333;
|
| 15 |
+
--light-gray: #f0f0f0;
|
| 16 |
+
--border-color: #dee2e6;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
body {
|
| 20 |
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
| 21 |
+
line-height: 1.6;
|
| 22 |
+
color: var(--text-color);
|
| 23 |
+
background-color: var(--background-color);
|
| 24 |
+
margin: 0;
|
| 25 |
+
padding: 20px;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
.container {
|
| 29 |
+
max-width: 900px;
|
| 30 |
+
margin: 0 auto;
|
| 31 |
+
padding: 20px;
|
| 32 |
+
background-color: var(--card-color);
|
| 33 |
+
border-radius: 8px;
|
| 34 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
h1 {
|
| 38 |
+
color: var(--primary-color);
|
| 39 |
+
text-align: center;
|
| 40 |
+
margin-bottom: 20px;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
.input-section {
|
| 44 |
+
display: flex;
|
| 45 |
+
flex-direction: column;
|
| 46 |
+
gap: 10px;
|
| 47 |
+
margin-bottom: 30px;
|
| 48 |
+
background-color: var(--light-gray);
|
| 49 |
+
padding: 20px;
|
| 50 |
+
border-radius: 8px;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
.input-group {
|
| 54 |
+
display: flex;
|
| 55 |
+
flex-wrap: wrap;
|
| 56 |
+
gap: 15px;
|
| 57 |
+
align-items: center;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
label {
|
| 61 |
+
font-weight: 600;
|
| 62 |
+
min-width: 180px;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
input {
|
| 66 |
+
flex: 1;
|
| 67 |
+
padding: 10px;
|
| 68 |
+
border: 1px solid var(--border-color);
|
| 69 |
+
border-radius: 4px;
|
| 70 |
+
font-size: 16px;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
.buttons {
|
| 74 |
+
display: flex;
|
| 75 |
+
gap: 10px;
|
| 76 |
+
margin-top: 10px;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
button {
|
| 80 |
+
padding: 10px 20px;
|
| 81 |
+
background-color: var(--primary-color);
|
| 82 |
+
color: white;
|
| 83 |
+
border: none;
|
| 84 |
+
border-radius: 4px;
|
| 85 |
+
cursor: pointer;
|
| 86 |
+
font-size: 16px;
|
| 87 |
+
transition: background-color 0.2s;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
button:hover {
|
| 91 |
+
background-color: var(--secondary-color);
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
.preset-buttons {
|
| 95 |
+
display: flex;
|
| 96 |
+
flex-wrap: wrap;
|
| 97 |
+
gap: 10px;
|
| 98 |
+
margin-top: 15px;
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
.preset-button {
|
| 102 |
+
background-color: var(--accent-color);
|
| 103 |
+
padding: 8px 12px;
|
| 104 |
+
font-size: 14px;
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
.preset-button:hover {
|
| 108 |
+
background-color: #3da58a;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
#results-container {
|
| 112 |
+
margin-top: 20px;
|
| 113 |
+
overflow-x: auto;
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
table {
|
| 117 |
+
width: 100%;
|
| 118 |
+
border-collapse: collapse;
|
| 119 |
+
margin-top: 10px;
|
| 120 |
+
table-layout: fixed;
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
th, td {
|
| 124 |
+
padding: 12px 15px;
|
| 125 |
+
text-align: left;
|
| 126 |
+
border-bottom: 1px solid var(--border-color);
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
th {
|
| 130 |
+
background-color: var(--primary-color);
|
| 131 |
+
color: white;
|
| 132 |
+
position: sticky;
|
| 133 |
+
top: 0;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
tr:nth-child(even) {
|
| 137 |
+
background-color: var(--light-gray);
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
.tooltip {
|
| 141 |
+
position: relative;
|
| 142 |
+
display: inline-block;
|
| 143 |
+
cursor: help;
|
| 144 |
+
margin-left: 5px;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
.tooltip .tooltiptext {
|
| 148 |
+
visibility: hidden;
|
| 149 |
+
width: 280px;
|
| 150 |
+
background-color: #555;
|
| 151 |
+
color: #fff;
|
| 152 |
+
text-align: left;
|
| 153 |
+
border-radius: 6px;
|
| 154 |
+
padding: 8px;
|
| 155 |
+
position: absolute;
|
| 156 |
+
z-index: 1;
|
| 157 |
+
bottom: 125%;
|
| 158 |
+
left: 50%;
|
| 159 |
+
transform: translateX(-50%);
|
| 160 |
+
opacity: 0;
|
| 161 |
+
transition: opacity 0.3s;
|
| 162 |
+
font-size: 14px;
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
.tooltip:hover .tooltiptext {
|
| 166 |
+
visibility: visible;
|
| 167 |
+
opacity: 1;
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
.model-size {
|
| 171 |
+
font-size: 18px;
|
| 172 |
+
font-weight: bold;
|
| 173 |
+
text-align: center;
|
| 174 |
+
margin: 15px 0;
|
| 175 |
+
color: var(--secondary-color);
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
@media (max-width: 768px) {
|
| 179 |
+
.input-group {
|
| 180 |
+
flex-direction: column;
|
| 181 |
+
align-items: flex-start;
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
input {
|
| 185 |
+
width: 100%;
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
.buttons {
|
| 189 |
+
flex-direction: column;
|
| 190 |
+
}
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
footer {
|
| 194 |
+
text-align: center;
|
| 195 |
+
margin-top: 30px;
|
| 196 |
+
font-size: 14px;
|
| 197 |
+
color: #6c757d;
|
| 198 |
+
}
|
| 199 |
+
</style>
|
| 200 |
+
</head>
|
| 201 |
+
<body>
|
| 202 |
+
<div class="container">
|
| 203 |
+
<h1>ML Model Memory Calculator</h1>
|
| 204 |
+
|
| 205 |
+
<div class="input-section">
|
| 206 |
+
<div class="input-group">
|
| 207 |
+
<label for="parameters">Number of Parameters:</label>
|
| 208 |
+
<input type="text" id="parameters" placeholder="e.g., 7000000000 for 7B">
|
| 209 |
+
<div class="tooltip">ⓘ
|
| 210 |
+
<span class="tooltiptext">Enter the total number of parameters in your model. For example, use 7000000000 for a 7B parameter model.</span>
|
| 211 |
+
</div>
|
| 212 |
+
</div>
|
| 213 |
+
|
| 214 |
+
<div class="buttons">
|
| 215 |
+
<button id="calculate-btn">Calculate</button>
|
| 216 |
+
<button id="clear-btn">Clear</button>
|
| 217 |
+
</div>
|
| 218 |
+
|
| 219 |
+
<div class="preset-buttons">
|
| 220 |
+
<span>Presets: </span>
|
| 221 |
+
<button class="preset-button" data-value="200000000">200M</button>
|
| 222 |
+
<button class="preset-button" data-value="500000000">500M</button>
|
| 223 |
+
<button class="preset-button" data-value="1000000000">1B</button>
|
| 224 |
+
<button class="preset-button" data-value="2000000000">2B</button>
|
| 225 |
+
<button class="preset-button" data-value="7000000000">7B</button>
|
| 226 |
+
<button class="preset-button" data-value="13000000000">13B</button>
|
| 227 |
+
<button class="preset-button" data-value="34000000000">34B</button>
|
| 228 |
+
<button class="preset-button" data-value="70000000000">70B</button>
|
| 229 |
+
<button class="preset-button" data-value="175000000000">175B</button>
|
| 230 |
+
</div>
|
| 231 |
+
</div>
|
| 232 |
+
|
| 233 |
+
<div id="model-size" class="model-size"></div>
|
| 234 |
+
|
| 235 |
+
<div id="results-container">
|
| 236 |
+
<table id="results-table">
|
| 237 |
+
<thead>
|
| 238 |
+
<tr>
|
| 239 |
+
<th>Precision</th>
|
| 240 |
+
<th>Bytes/Param</th>
|
| 241 |
+
<th>Memory</th>
|
| 242 |
+
<th>MB</th>
|
| 243 |
+
<th>GB</th>
|
| 244 |
+
<th>TB</th>
|
| 245 |
+
</tr>
|
| 246 |
+
</thead>
|
| 247 |
+
<tbody id="results-body">
|
| 248 |
+
<!-- Results will be populated here -->
|
| 249 |
+
</tbody>
|
| 250 |
+
</table>
|
| 251 |
+
</div>
|
| 252 |
+
|
| 253 |
+
<footer>
|
| 254 |
+
<p>A simple tool to estimate the memory requirements for ML models of different sizes and precision types.</p>
|
| 255 |
+
</footer>
|
| 256 |
+
</div>
|
| 257 |
+
|
| 258 |
+
<script>
|
| 259 |
+
// Model memory calculation function
|
| 260 |
+
function calculateModelMemory(numParameters) {
|
| 261 |
+
// Define bytes per parameter for each precision type
|
| 262 |
+
const precisionTypes = {
|
| 263 |
+
"float32": 4,
|
| 264 |
+
"float16": 2,
|
| 265 |
+
"bfloat16": 2,
|
| 266 |
+
"int8": 1,
|
| 267 |
+
"int4": 0.5,
|
| 268 |
+
"int2": 0.25,
|
| 269 |
+
"int1": 0.125
|
| 270 |
+
};
|
| 271 |
+
|
| 272 |
+
const results = {};
|
| 273 |
+
|
| 274 |
+
// Calculate memory for each precision type
|
| 275 |
+
for (const [precision, bytesPerParam] of Object.entries(precisionTypes)) {
|
| 276 |
+
const totalBytes = numParameters * bytesPerParam;
|
| 277 |
+
|
| 278 |
+
results[precision] = {
|
| 279 |
+
"bytesPerParam": bytesPerParam,
|
| 280 |
+
"bytes": totalBytes,
|
| 281 |
+
"KB": totalBytes / 1024,
|
| 282 |
+
"MB": totalBytes / (1024**2),
|
| 283 |
+
"GB": totalBytes / (1024**3),
|
| 284 |
+
"TB": totalBytes / (1024**4)
|
| 285 |
+
};
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
// Add human-readable summary for each precision type
|
| 289 |
+
for (const precision in precisionTypes) {
|
| 290 |
+
const memoryValues = results[precision];
|
| 291 |
+
|
| 292 |
+
let summary;
|
| 293 |
+
if (memoryValues.TB >= 1) {
|
| 294 |
+
summary = `${memoryValues.TB.toFixed(2)} TB (${memoryValues.GB.toFixed(2)} GB)`;
|
| 295 |
+
} else if (memoryValues.GB >= 1) {
|
| 296 |
+
summary = `${memoryValues.GB.toFixed(2)} GB (${memoryValues.MB.toFixed(2)} MB)`;
|
| 297 |
+
} else if (memoryValues.MB >= 1) {
|
| 298 |
+
summary = `${memoryValues.MB.toFixed(2)} MB (${memoryValues.KB.toFixed(2)} KB)`;
|
| 299 |
+
} else {
|
| 300 |
+
summary = `${memoryValues.KB.toFixed(2)} KB (${memoryValues.bytes.toFixed(2)} bytes)`;
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
results[precision].summary = summary;
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
// Add model size in billions for reference
|
| 307 |
+
results.modelSize = `${(numParameters/1e9).toFixed(2)}B parameters`;
|
| 308 |
+
|
| 309 |
+
return results;
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
// Format numbers with commas
|
| 313 |
+
function formatNumber(num) {
|
| 314 |
+
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
// Calculate and display results
|
| 318 |
+
function calculateAndDisplay() {
|
| 319 |
+
const parametersInput = document.getElementById('parameters').value.trim();
|
| 320 |
+
const modelSizeElement = document.getElementById('model-size');
|
| 321 |
+
const resultsBody = document.getElementById('results-body');
|
| 322 |
+
|
| 323 |
+
// Clear previous results
|
| 324 |
+
resultsBody.innerHTML = '';
|
| 325 |
+
modelSizeElement.innerHTML = '';
|
| 326 |
+
|
| 327 |
+
// Validate input
|
| 328 |
+
if (!parametersInput) {
|
| 329 |
+
alert('Please enter the number of parameters.');
|
| 330 |
+
return;
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
+
// Parse and normalize input (remove commas)
|
| 334 |
+
const numParameters = parseFloat(parametersInput.replace(/,/g, ''));
|
| 335 |
+
|
| 336 |
+
if (isNaN(numParameters) || numParameters <= 0) {
|
| 337 |
+
alert('Please enter a valid positive number for parameters.');
|
| 338 |
+
return;
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
// Calculate memory requirements
|
| 342 |
+
const results = calculateModelMemory(numParameters);
|
| 343 |
+
|
| 344 |
+
// Display model size with both millions and billions
|
| 345 |
+
const sizeInBillions = numParameters / 1e9;
|
| 346 |
+
const sizeInMillions = numParameters / 1e6;
|
| 347 |
+
modelSizeElement.textContent = `Showing requirements for a ${sizeInBillions.toFixed(2)}B (${sizeInMillions.toFixed(2)}M) parameter model`;
|
| 348 |
+
|
| 349 |
+
// Sort precision types by size (largest first)
|
| 350 |
+
const precisionOrder = [
|
| 351 |
+
'float32', 'float16', 'bfloat16', 'int8', 'int4', 'int2', 'int1'
|
| 352 |
+
];
|
| 353 |
+
|
| 354 |
+
// Populate results table
|
| 355 |
+
precisionOrder.forEach(precision => {
|
| 356 |
+
const data = results[precision];
|
| 357 |
+
const row = document.createElement('tr');
|
| 358 |
+
|
| 359 |
+
row.innerHTML = `
|
| 360 |
+
<td>${precision}</td>
|
| 361 |
+
<td>${data.bytesPerParam} bytes</td>
|
| 362 |
+
<td>${data.summary}</td>
|
| 363 |
+
<td>${data.MB.toFixed(2)}</td>
|
| 364 |
+
<td>${data.GB.toFixed(2)}</td>
|
| 365 |
+
<td>${data.TB.toFixed(2)}</td>
|
| 366 |
+
`;
|
| 367 |
+
|
| 368 |
+
resultsBody.appendChild(row);
|
| 369 |
+
});
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
// Event listeners
|
| 373 |
+
document.getElementById('calculate-btn').addEventListener('click', calculateAndDisplay);
|
| 374 |
+
|
| 375 |
+
document.getElementById('clear-btn').addEventListener('click', () => {
|
| 376 |
+
document.getElementById('parameters').value = '';
|
| 377 |
+
document.getElementById('results-body').innerHTML = '';
|
| 378 |
+
document.getElementById('model-size').innerHTML = '';
|
| 379 |
+
});
|
| 380 |
+
|
| 381 |
+
// Add event listeners to preset buttons
|
| 382 |
+
document.querySelectorAll('.preset-button').forEach(button => {
|
| 383 |
+
button.addEventListener('click', () => {
|
| 384 |
+
document.getElementById('parameters').value = button.dataset.value;
|
| 385 |
+
calculateAndDisplay();
|
| 386 |
+
});
|
| 387 |
+
});
|
| 388 |
+
|
| 389 |
+
// Allow Enter key to trigger calculation
|
| 390 |
+
document.getElementById('parameters').addEventListener('keypress', (e) => {
|
| 391 |
+
if (e.key === 'Enter') {
|
| 392 |
+
calculateAndDisplay();
|
| 393 |
+
}
|
| 394 |
+
});
|
| 395 |
+
|
| 396 |
+
// Prevent non-numeric input (but allow some special characters)
|
| 397 |
+
document.getElementById('parameters').addEventListener('input', (e) => {
|
| 398 |
+
const input = e.target;
|
| 399 |
+
input.value = input.value.replace(/[^0-9.,eE+-]/g, '');
|
| 400 |
+
});
|
| 401 |
+
</script>
|
| 402 |
+
</body>
|
| 403 |
+
</html>
|