Skip to content
Snippets Groups Projects
Commit 964d495e authored by Alexandru-Mihai GHERGHESCU's avatar Alexandru-Mihai GHERGHESCU Committed by Vlad-Andrei BĂDOIU (78692)
Browse files

Fix memory requiremenst, add fp16 activations

parent 2b57c46e
No related branches found
No related tags found
1 merge request!11Add scripts folder, add memory requirements script
......@@ -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")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment