-
Notifications
You must be signed in to change notification settings - Fork 252
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
[WIP] Allow benchmark between multiple configs #703
Open
H-Huang
wants to merge
1
commit into
gh/H-Huang/17/base
Choose a base branch
from
gh/H-Huang/17/head
base: gh/H-Huang/17/base
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import os | ||
from typing import Any, Dict, Sequence | ||
|
||
from torchtitan.metrics import MetricRetriever | ||
|
||
metrics: Dict[str, Dict[int, Dict[str, Any]]] = {} | ||
|
||
run_id = 0 | ||
dump_dir = f"test_out/my_example" | ||
log_dir = os.path.join(dump_dir, "tb", str(run_id)) | ||
print(log_dir) | ||
metric_retriever = MetricRetriever(log_dir) | ||
|
||
metrics[f"Run ID {run_id}"] = metric_retriever.get_metrics() | ||
|
||
|
||
def print_metrics( | ||
metrics: Dict[str, Dict[int, Dict[str, Any]]], | ||
filter_keys=[ | ||
"wps", | ||
"mfu(%)", | ||
"memory/max_active(GiB)", | ||
"memory/max_active(%)", | ||
"memory/max_reserved(%)", | ||
"loss_metrics/global_avg_loss", | ||
"loss_metrics/global_max_loss", | ||
], | ||
) -> None: | ||
for run_id, all_step_metrics in metrics.items(): | ||
print("=" * 100) | ||
print(run_id) | ||
print("=" * 100) | ||
if all_step_metrics: | ||
last_step = next(reversed(all_step_metrics)) | ||
last_step_metrics = all_step_metrics[last_step] | ||
# Print the column headers | ||
if filter_keys: | ||
filtered_keys = [key for key in filter_keys if key in last_step_metrics] | ||
else: | ||
filtered_keys = list(last_step_metrics.keys()) | ||
|
||
max_key_length = max(len(key) for key in filtered_keys) | ||
# Add an empty header for the run_id column | ||
header_row = " | ".join( | ||
[" " * 10] + [f"{key.ljust(max_key_length)}" for key in filtered_keys] | ||
) | ||
print(header_row) | ||
print("-" * len(header_row)) | ||
# Print the run_id and the values | ||
value_row = " | ".join( | ||
[f"{run_id:10}"] | ||
+ [ | ||
f"{str(last_step_metrics[key]).ljust(max_key_length)}" | ||
for key in filtered_keys | ||
] | ||
) | ||
print(value_row) | ||
|
||
|
||
print_metrics(metrics) |
Binary file added
BIN
+7.59 KB
..._out/my_example/tb/0/events.out.tfevents.1732658391.devvm2170.rva0.facebook.com.3145570.0
Binary file not shown.
Binary file added
BIN
+7.59 KB
..._out/my_example/tb/1/events.out.tfevents.1732658435.devvm2170.rva0.facebook.com.3159818.0
Binary file not shown.
Binary file added
BIN
+7.59 KB
..._out/my_example/tb/2/events.out.tfevents.1732658475.devvm2170.rva0.facebook.com.3169841.0
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RE the binary files above, not sure if you meant to include those in the PR