Skip to content

Commit

Permalink
trycatch
Browse files Browse the repository at this point in the history
Signed-off-by: Prithvi Kannan <prithvi.kannan@databricks.com>
  • Loading branch information
prithvikannan committed May 2, 2024
1 parent 8b22353 commit 5c4b72b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions mlflow/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,15 +694,18 @@ def log(
mlflow.tracking.fluent.log_artifacts(local_path, mlflow_model.artifact_path, run_id)

# if the model_config kwarg is passed in, then log the model config as an params
try:
if "model_config" in kwargs:
model_config = kwargs["model_config"]
if isinstance(model_config, str):
if "model_config" in kwargs:
model_config = kwargs["model_config"]
if isinstance(model_config, str):
try:
with open(model_config) as f:
model_config = json.load(f)
except Exception as e:
_logger.warning("Failed to load model config from %s: %s", model_config, e)
try:
mlflow.tracking.fluent.log_params(model_config)
except Exception as e:
_logger.warning("Failed to log model config as params: %s", str(e))
except Exception as e:
_logger.warning("Failed to log model config as params: %s", str(e))

try:
mlflow.tracking.fluent._record_logged_model(mlflow_model, run_id)
Expand Down

0 comments on commit 5c4b72b

Please sign in to comment.