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

Script to compute step duration #70

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

tengyifei
Copy link
Collaborator

Precursor to solving #67.

Imports https://github.com/AI-Hypercomputer/tpu-recipes/blob/main/utils/profile_convert.py and improves it.

Specifically, I noticed sometimes there is an empty gap between two step markers in the profile. So if we averaged event durations, that would overestimate the MFU. Instead, this now averages the delta between the starting time offset of neighboring events.

Now that we can print step time from the profile, I removed the step time from the training loop. That added a bunch of delays and is actually pretty inaccurate (1.7s vs 1.85s in local testing).

Tested:

XLA_IR_DEBUG=1 XLA_HLO_DEBUG=1 python3 torchprime/torch_xla_models/train.py mesh.fsdp=8 profile_step=4 model=llama-3-8b
XLA_IR_DEBUG=1 XLA_HLO_DEBUG=1 python3 torchprime/torch_xla_models/train.py mesh.fsdp=8 profile_step=4 model=mixtral-8x7b

Precursor to #67.

Imports https://github.com/AI-Hypercomputer/tpu-recipes/blob/main/utils/profile_convert.py
and improves it.

Specifically, I noticed sometimes there is an empty gap between two step
markers in the profile. So if we averaged event durations, that would
overestimate the MFU. Instead, this now averages the delta between the
starting time offset of neighboring events.

Now that we can print step time from the profile, I removed the step
time from the training loop. That added a bunch of delays and is
actually pretty inaccurate (1.7s vs 1.85s in local testing).

Tested:

  XLA_IR_DEBUG=1 XLA_HLO_DEBUG=1 python3 torchprime/torch_xla_models/train.py mesh.fsdp=8 profile_step=4 model=llama-3-8b
  XLA_IR_DEBUG=1 XLA_HLO_DEBUG=1 python3 torchprime/torch_xla_models/train.py mesh.fsdp=8 profile_step=4 model=mixtral-8x7b
@tengyifei tengyifei marked this pull request as ready for review January 31, 2025 20:02
@tengyifei tengyifei requested a review from bhavya01 January 31, 2025 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant