-
Notifications
You must be signed in to change notification settings - Fork 12
Add proper support for multiple_columns #51
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3c9f0d8
wip; add initial support for extra keys
Rohan138 f5e4403
Merge branch 'main' into multiple_columns
Rohan138 6805dff
fix unit test
Rohan138 56392d5
Merge branch 'main' into multiple_columns
Rohan138 2673755
Merge branch 'main' into multiple_columns
Rohan138 42e2bc1
Remove restriction on perf csv columns
Rohan138 1492a53
fix order of columns
Rohan138 f58d28f
Merge branch 'main' into multiple_columns
Rohan138 abbd847
fix check
Rohan138 28de7f1
Merge branch 'multiple_columns' of https://github.com/ROCm/madengine …
Rohan138 2a19039
revert to using performance and metric columns
Rohan138 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -6,7 +6,6 @@ | |
| """ | ||
|
|
||
| # build-in imports | ||
| import os | ||
| import json | ||
| import argparse | ||
| import typing | ||
|
|
@@ -98,16 +97,15 @@ def handle_multiple_results( | |
| Raises: | ||
| AssertionError: If the number of columns in the performance csv DataFrame is not equal to the length of the row. | ||
| """ | ||
| # Check that the multiple results CSV has three columns and has the following format: | ||
| # model, performance, metric | ||
| multiple_results_df = df_strip_columns(pd.read_csv(multiple_results)) | ||
| multiple_results_header = multiple_results_df.columns.tolist() | ||
| # if (len(multiple_results_header) != 3): | ||
| # raise RuntimeError("Multiple Results CSV file must have three columns: model, performance, metric") | ||
|
|
||
| # Check that the multiple results CSV has the following required columns: | ||
| # model, performance, metric | ||
| headings = ['model', 'performance', 'metric'] | ||
| for heading in headings: | ||
| if not(heading in multiple_results_header): | ||
| raise RuntimeError("Multiple Results CSV file is missing the " + heading + " column") | ||
| raise RuntimeError(multiple_results + " file is missing the " + heading + " column") | ||
|
|
||
| common_info_json = read_json(common_info) | ||
| flatten_tags(common_info_json) | ||
|
|
@@ -116,21 +114,24 @@ def handle_multiple_results( | |
| # add results to perf.csv | ||
| for r in multiple_results_df.to_dict(orient="records"): | ||
| row = common_info_json.copy() | ||
| row["model"] = model_name + "_" + str(r["model"]) | ||
| row["performance"] = r["performance"] | ||
| row["metric"] = r["metric"] | ||
| model = r.pop("model") | ||
| row["model"] = model_name + "_" + str(model) | ||
| row.update(r) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This allows us to add additional columns to the perf csv; this is really the major change from this PR, the other changes just support this e.g. reordering the columns in the final_multiple_results_df to put any additional columns at the end. |
||
|
|
||
| if r["performance"] is not None and pd.notna(r["performance"]): | ||
| if row["performance"] is not None and pd.notna(row["performance"]): | ||
| row["status"] = "SUCCESS" | ||
| else: | ||
| row["status"] = "FAILURE" | ||
|
|
||
| assert perf_csv_df.columns.size == len(row), f"Column count mismatch: CSV has {perf_csv_df.columns.size} columns but row has {len(row)} keys. CSV columns: {list(perf_csv_df.columns)}, Row keys: {list(row.keys())}" | ||
| final_multiple_results_df = pd.concat( | ||
| [final_multiple_results_df, pd.DataFrame(row, index=[0])], ignore_index=True | ||
| ) | ||
| # Reorder columns according to existing perf csv | ||
| columns = perf_csv_df.columns.tolist() | ||
| # Add any additional columns to the end | ||
| columns = columns + [col for col in final_multiple_results_df.columns if col not in columns] | ||
| final_multiple_results_df = final_multiple_results_df[columns] | ||
|
|
||
| final_multiple_results_df = final_multiple_results_df[perf_csv_df.columns] | ||
| perf_entry_df_to_csv(final_multiple_results_df) | ||
| if perf_csv_df.empty: | ||
| perf_csv_df = final_multiple_results_df | ||
|
|
||
This file contains hidden or 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 hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.