Skip to content

Commit 5107c50

Browse files
authored
fix:When use_spark = True and mlflow_logging = True are set, an error is reported when logging the best model: 'NoneType' object has no attribute 'save' bug Something isn't working (#1432)
1 parent 9e219ef commit 5107c50

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

flaml/fabric/mlflow.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,11 @@ def log_automl(self, automl):
492492
mlflow.log_metric("best_validation_loss", automl._state.best_loss)
493493
mlflow.log_metric("best_iteration", automl._best_iteration)
494494
mlflow.log_metric("num_child_runs", len(self.infos))
495-
if automl._trained_estimator is not None and not self.has_model:
495+
if (
496+
automl._trained_estimator is not None
497+
and not self.has_model
498+
and automl._trained_estimator._model is not None
499+
):
496500
self.log_model(
497501
automl._trained_estimator._model, automl.best_estimator, signature=automl.estimator_signature
498502
)
@@ -521,7 +525,11 @@ def log_automl(self, automl):
521525
logger.info(f"logging best model {automl.best_estimator}")
522526
self.copy_mlflow_run(best_mlflow_run_id, self.parent_run_id)
523527
self.has_summary = True
524-
if automl._trained_estimator is not None and not self.has_model:
528+
if (
529+
automl._trained_estimator is not None
530+
and not self.has_model
531+
and automl._trained_estimator._model is not None
532+
):
525533
self.log_model(
526534
automl._trained_estimator._model,
527535
automl.best_estimator,

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"psutil==5.8.0",
7474
"dataclasses",
7575
"transformers[torch]==4.26",
76-
"datasets",
76+
"datasets<=3.5.0",
7777
"nltk<=3.8.1", # 3.8.2 doesn't work with mlflow
7878
"rouge_score",
7979
"hcrystalball==0.1.10",

0 commit comments

Comments
 (0)