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

Instructions for aggregate_file script + constants for hardware metrics #48

Merged
merged 2 commits into from
Aug 11, 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
14 changes: 6 additions & 8 deletions src/autogluon_dashboard/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import os

import panel as pn

from autogluon_dashboard.constants.app_layout_constants import (
Expand Down Expand Up @@ -28,6 +26,7 @@
FRAMEWORK,
LOSS_RESCALED,
RANK,
STATISTIC_VALUE,
TIME_INFER_S,
WINRATE,
)
Expand All @@ -45,7 +44,6 @@
HW_METRICS_WIDGET_NAME,
METRICS_PLOT_TITLE,
PER_DATASET_DOWNLOAD_TITLE,
RANK1_TITLE,
RANK_LABEL,
TOP5_PERFORMERS_TITLE,
YAXIS_LABEL,
Expand Down Expand Up @@ -236,8 +234,8 @@
hware_metrics_idf,
"hvplot",
col_name=yaxis_widget4,
x_axis="framework",
y_axis="statistic_value",
x_axis=FRAMEWORK,
y_axis=STATISTIC_VALUE,
ylabel=yaxis_widget4,
by="mode",
)
Expand All @@ -247,10 +245,10 @@
hware_metrics_idf,
"hvplot",
col_name=yaxis_widget4,
x_axis="framework",
y_axis="statistic_value",
x_axis=FRAMEWORK,
y_axis=STATISTIC_VALUE,
ylabel=yaxis_widget4,
by="dataset",
by=DATASET,
)
create_panel_object(
panel_objs,
Expand Down
2 changes: 2 additions & 0 deletions src/autogluon_dashboard/constants/df_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@

UTC = "utc"
DATETIME = "datetime"

STATISTIC_VALUE = "statistic_value"
4 changes: 3 additions & 1 deletion src/autogluon_dashboard/plotting/hardware_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import pandas
import panel as pn

from autogluon_dashboard.constants.df_constants import FRAMEWORK, METRIC

from .plot import Plot


Expand Down Expand Up @@ -90,7 +92,7 @@ def __init__(

def _preprocess(self, df, col_name_for_metrics, group_by, **kwargs) -> pandas.DataFrame:
df = df[:]
df = df.groupby(["framework", "metric", group_by]).mean(numeric_only=True).reset_index()
df = df.groupby([FRAMEWORK, METRIC, group_by]).mean(numeric_only=True).reset_index()
df.statistic_value = df.statistic_value.apply(lambda x: round(float(x), 2))
df = df[df.metric.isin([col_name_for_metrics])]
return df
13 changes: 13 additions & 0 deletions src/autogluon_dashboard/utils/aggregate_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
import re
from collections import namedtuple

"""
The Aggregate File Script
----------------------------
One issue with panel is that it does not allow relative imports.
The website generated by panel runs in a pyodide web-environment, where it installs the necessary python packages only from the official python index (PyPI).
Therefore, to circumvent this, we created a script to aggregate all the files within the project directory into one big file to convert the web app into WebAssembly (HTML and JavaScript).

NOTE: The order of crawling in the aggregate script is very important!
If the app imports module A before module B, then it is imperative that the script crawls through the folder corresponding to module A first.
Therefore, pay attention to how the dependency of the subdirectories is affected by any changes you make to app.py.
The order of crawling can be found and modified in the "__main__" body of this file.
"""


def get_import_tuples(path: str):
"""Extracts import statements from a Python file by leveraging the ast parser library.
Expand Down