From baeecf1a3e2843df0026e081b360155f9189fe68 Mon Sep 17 00:00:00 2001 From: Dushyant Behl Date: Wed, 7 Aug 2024 17:18:14 +0530 Subject: [PATCH] Ensure additional metadata to trackers don't throw error in happy case. (#290) Signed-off-by: Dushyant Behl --- tuning/sft_trainer.py | 1 + tuning/trackers/aimstack_tracker.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tuning/sft_trainer.py b/tuning/sft_trainer.py index bd00c5099..88c639d40 100644 --- a/tuning/sft_trainer.py +++ b/tuning/sft_trainer.py @@ -337,6 +337,7 @@ def train( try: for k, v in additional_metrics.items(): tracker.track(metric=v, name=k, stage="additional_metrics") + if exp_metadata: tracker.set_params(params=exp_metadata, name="experiment_metadata") except ValueError as e: logger.error( diff --git a/tuning/trackers/aimstack_tracker.py b/tuning/trackers/aimstack_tracker.py index bc2f8364d..deecb4480 100644 --- a/tuning/trackers/aimstack_tracker.py +++ b/tuning/trackers/aimstack_tracker.py @@ -172,7 +172,9 @@ def set_params(self, params, name="extra_params"): Raises: ValueError: the params passed is None or not of type dict """ - if params is None or (not isinstance(params, dict)): + if params is None: + return + if not isinstance(params, dict): raise ValueError( "set_params passed to aimstack should be called with a dict of params" )