Skip to content
Snippets Groups Projects

Compute/memory requirements scripts

Open Alexandru-Mihai GHERGHESCU requested to merge feature/scripts into main
1 file
+ 7
2
Compare changes
  • Side-by-side
  • Inline
@@ -81,10 +81,15 @@ gradients = 1 * model_params
moms = 2
optimizer = moms * model_params
gigabytes_used = (
# 4 bytes (fp32) used; for 2 bytes activations (fp16), adjust the percent value;
# ideally, it should be 0.5, however that value can realistically not be
# reached; real values could be between 0.2 and 0.3
activations_saved_percent = 0.25
gigabytes_used = 4 * (
model_params +
optimizer +
max(activations, gradients)
(1 - activations_saved_percent) * activations +
gradients
) / bytes_to_gigs
print(f"Model params: {model_params:,} - {model_params * 4 / bytes_to_gigs:,.2f}GB")
Loading