From 7caa3a0d98a3a725b5acc976b541186f9d5fe99b Mon Sep 17 00:00:00 2001 From: Greg Tatum Date: Fri, 1 Nov 2024 14:10:25 -0500 Subject: [PATCH] Add better support for reporting training continuation values --- docs/using-pretrained-models.md | 3 ++- utils/trigger_training.py | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/using-pretrained-models.md b/docs/using-pretrained-models.md index 25e000447..61c80859d 100644 --- a/docs/using-pretrained-models.md +++ b/docs/using-pretrained-models.md @@ -19,7 +19,8 @@ experiment: # Continue training a teacher model. train-teacher: urls: - - https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/task-id/artifacts/public/build + # Replace the following {task_id} with the "train-teacher" task id. + - https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/{task_id}/artifacts/public/build mode: continue type: default diff --git a/utils/trigger_training.py b/utils/trigger_training.py index 7ad4e0831..840904a09 100644 --- a/utils/trigger_training.py +++ b/utils/trigger_training.py @@ -8,6 +8,7 @@ import argparse import datetime +import json from pathlib import Path import subprocess import sys @@ -156,13 +157,19 @@ def log_config_info(config_path: Path, config: dict): pretrained_models: Optional[dict] = experiment.get("pretrained-models") if pretrained_models: for key, value in pretrained_models.items(): - config_details.append((key, value)) + config_details.append((key, json.dumps(value, indent=2))) key_len = 0 for key, _ in config_details: key_len = max(key_len, len(key)) for key, value in config_details: + if "\n" in value: + # Nicely indent any multiline value. + padding = " " * (key_len + 6) + lines = [padding + n for n in value.split("\n")] + value = "\n".join(lines).strip() # noqa: PLW2901 + print(f"{key.rjust(key_len + 4, " ")}: {value}")