From fbf424d56d6a98ec6f8ed7f8f877169261d26fc0 Mon Sep 17 00:00:00 2001 From: hexiang-x <54394892+hexiang-x@users.noreply.github.com> Date: Wed, 14 May 2025 03:27:27 +0000 Subject: [PATCH 1/3] hx-issue1431-bugfix:When logging best model, first determine whether the best model has been trained and is not None --- flaml/fabric/mlflow.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/flaml/fabric/mlflow.py b/flaml/fabric/mlflow.py index 4cfb0e2cd2..a7195ba709 100644 --- a/flaml/fabric/mlflow.py +++ b/flaml/fabric/mlflow.py @@ -492,7 +492,11 @@ def log_automl(self, automl): mlflow.log_metric("best_validation_loss", automl._state.best_loss) mlflow.log_metric("best_iteration", automl._best_iteration) mlflow.log_metric("num_child_runs", len(self.infos)) - if automl._trained_estimator is not None and not self.has_model: + if ( + automl._trained_estimator is not None + and not self.has_model + and self._trained_estimator._model is not None + ): self.log_model( automl._trained_estimator._model, automl.best_estimator, signature=automl.estimator_signature ) @@ -521,7 +525,11 @@ def log_automl(self, automl): logger.info(f"logging best model {automl.best_estimator}") self.copy_mlflow_run(best_mlflow_run_id, self.parent_run_id) self.has_summary = True - if automl._trained_estimator is not None and not self.has_model: + if ( + automl._trained_estimator is not None + and not self.has_model + and self._trained_estimator._model is not None + ): self.log_model( automl._trained_estimator._model, automl.best_estimator, From 1dc9e2923e09b117081e182541042d45bae010d8 Mon Sep 17 00:00:00 2001 From: hexiang-x <54394892+hexiang-x@users.noreply.github.com> Date: Wed, 14 May 2025 06:59:55 +0000 Subject: [PATCH 2/3] fix: self change to automl, it's my error. --- flaml/fabric/mlflow.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flaml/fabric/mlflow.py b/flaml/fabric/mlflow.py index a7195ba709..442c3709b8 100644 --- a/flaml/fabric/mlflow.py +++ b/flaml/fabric/mlflow.py @@ -495,7 +495,7 @@ def log_automl(self, automl): if ( automl._trained_estimator is not None and not self.has_model - and self._trained_estimator._model is not None + and automl._trained_estimator._model is not None ): self.log_model( automl._trained_estimator._model, automl.best_estimator, signature=automl.estimator_signature @@ -528,7 +528,7 @@ def log_automl(self, automl): if ( automl._trained_estimator is not None and not self.has_model - and self._trained_estimator._model is not None + and automl._trained_estimator._model is not None ): self.log_model( automl._trained_estimator._model, From 402a4862162a34cca9d19c4966bd38189ac00d04 Mon Sep 17 00:00:00 2001 From: hexiang-x <54394892+hexiang-x@users.noreply.github.com> Date: Wed, 14 May 2025 07:08:05 +0000 Subject: [PATCH 3/3] fix: change datasets version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 5783e99de0..e30db68a20 100644 --- a/setup.py +++ b/setup.py @@ -73,7 +73,7 @@ "psutil==5.8.0", "dataclasses", "transformers[torch]==4.26", - "datasets", + "datasets<=3.5.0", "nltk<=3.8.1", # 3.8.2 doesn't work with mlflow "rouge_score", "hcrystalball==0.1.10",