Skip to content

Commit

Permalink
Merge 'upstream/main' into hzeng-data-fix
Browse files Browse the repository at this point in the history
Pull in changes from

[6acc370](6acc370)

to

[`megatron/utils.py`](https://github.com/argonne-lcf/Megatron-DeepSpeed)
  • Loading branch information
saforem2 committed Oct 18, 2024
2 parents ed21bd9 + 6acc370 commit 467279b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion megatron/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ def throughput_calculator(model, args, iteration_time, total_iterations):
num_layers = args.num_layers
vocab_size = args.padded_vocab_size
gqa = args.num_attention_heads // args.num_key_value_heads
num_experts_routed_to = args.topk
ffn_multiplier = 3 if args.swiglu else 2
macs_per_flops = 2

Expand All @@ -478,7 +479,7 @@ def throughput_calculator(model, args, iteration_time, total_iterations):
# correction has been made to TFLOPs formula due to incorrect behavior
# observed with selective recompute when GQA not used and for all with GQA
seq_len = args.seq_length
if hasattr(args, "actual_seq_length"):
if hasattr(args, 'actual_seq_length'):
seq_len = args.actual_seq_length
pre_and_post_mha_gemm_macs = (
batch_size * num_layers * (1 + (2 // gqa) + 1) * (hidden_size**2) * seq_len
Expand All @@ -493,6 +494,7 @@ def throughput_calculator(model, args, iteration_time, total_iterations):
* ffn_hidden_size
* hidden_size
* seq_len
* num_experts_routed_to
)
logit_lmhead_gemm_macs = batch_size * vocab_size * hidden_size * seq_len

Expand Down

0 comments on commit 467279b

Please sign in to comment.