From cb7b80ca6aa629a1b0e5fbe8e850668d2e736451 Mon Sep 17 00:00:00 2001 From: Alexis Bruneteau Date: Wed, 1 Oct 2025 20:01:05 +0200 Subject: [PATCH] Fix MLflow model logging warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added input_example parameter to auto-infer model signature and explicitly set artifact_path parameter to remove deprecation warnings. This improves MLflow tracking by: - Auto-generating model signature from training data - Using correct parameter names for MLflow 3.x - Enabling better model serving and inference validation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/models/train.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/models/train.py b/src/models/train.py index 0cd2331..dc11bba 100644 --- a/src/models/train.py +++ b/src/models/train.py @@ -137,7 +137,13 @@ def main(): # Try to log model to MLflow (if permissions allow) try: - mlflow.sklearn.log_model(model, "model") + # Create input example for model signature + input_example = X_train.head(1) + mlflow.sklearn.log_model( + model, + artifact_path="model", + input_example=input_example + ) print("\nModel logged to MLflow successfully!") except Exception as e: print(f"\nWarning: Could not log model to MLflow: {e}")