Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrects FLOPs formula as per 1093 #1094

Merged
merged 2 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configs/neox_arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Logging Arguments

- **git_hash**: str

Default = efaee8d
Default = bb1b145

current git hash of repository

Expand Down
6 changes: 2 additions & 4 deletions megatron/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,15 @@ def get_flops(neox_args, iter_time_s) -> float:
hidden_size = neox_args.hidden_size
num_layers = neox_args.num_layers
ckpt_activations_factor = 4 if neox_args.checkpoint_activations else 3
flops_calc1 = (
flops_per_iteration = (
24
* ckpt_activations_factor
* batch_size
* seq_len
* num_layers
* (hidden_size**2)
* (1.0 + (seq_len / (6.0 * hidden_size)))
* (1.0 + (seq_len / (6.0 * hidden_size)) + (vocab_size / (16.0 * num_layers * hidden_size)))
)
flops_calc2 = vocab_size / (16.0 * num_layers * hidden_size)
flops_per_iteration = flops_calc1 + flops_calc2
return flops_per_iteration / (iter_time_s * world_size)


Expand Down