Skip to content

Commit

Permalink
save config.json as artifact to mlflow
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomarvid committed Apr 16, 2024
1 parent 614f61e commit b846d73
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pipeline_lib/core/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,19 @@ def plot_feature_importance(df: pd.DataFrame) -> None:
self.logger.debug("Plotting feature importance for MLflow")
plot_feature_importance(data.feature_importance)

if self.config:
self.logger.debug("Logging pipeline configuration to MLflow as a JSON file")
# convert model_class to string
fit_step = next(
step
for step in self.config["pipeline"]["steps"]
if step["step_type"] == "FitModelStep"
)
fit_step["parameters"]["model_class"] = fit_step["parameters"][
"model_class"
].__name__
mlflow.log_dict(self.config, "config.json")

def save_run(
self,
data: DataContainer,
Expand Down

0 comments on commit b846d73

Please sign in to comment.