Skip to content

Commit

Permalink
adjust dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
SebChw committed Dec 1, 2023
1 parent 522c858 commit a221c60
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions art/dashboard/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ def prepare_steps_info(logs_path: Path) -> Dict[str, Dict]:
step_name = step_info["name"]
step_model = step_info["model"]
for run in step_info["runs"]:
if "regularize" in run["parameters"]:
run["parameters"]["regularize"] = stringify_regularize(
run["parameters"]["regularize"]
)

new_sample = {
"model": step_model,
**run["scores"],
Expand All @@ -53,6 +58,30 @@ def prepare_steps_info(logs_path: Path) -> Dict[str, Dict]:
return steps_info


def stringify_regularize(regularize: Dict) -> str:
"""Since regularize field contain list we must handle them with special care .
Args:
regularize (Dict): regularize field from results.json
Returns:
str: stringified version of regularize field
"""
parameters = []
for key, value in regularize.items():
if key in ["model_modifiers", "datamodule_modifiers"]:
continue
parameters.append(f"{key}={value}")
representation = ""
if parameters:
representation += f"model-kwargs={' '.join(parameters)} |"
if regularize["model_modifiers"]:
representation += f"model-modifiers={regularize['model_modifiers']} |"
if regularize["datamodule_modifiers"]:
representation += f"datamodule-modifiers={regularize['datamodule_modifiers']}"
return representation


def prepare_steps():
return [
"Data analysis",
Expand Down

0 comments on commit a221c60

Please sign in to comment.