- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2025 08:27 PM
I have train & tested a model in databricks, now I want to register it and host it. But I am unable too do so. Please find attach snapshot of code & error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2025 10:45 PM
Hi @intelliconnectq The above code will fail with AttributeError: 'NoneType' object has no attribute 'info' on the line: model_uri = f"runs:/{mlflow.active_run().info.run_id}/xgboost-model"
This happens because once the with mlflow.start_run(): block ends, the MLflow run is no longer active, so calling mlflow.active_run() returns None. You cannot fetch run info after the run is closed.
with block while the run is still active:with mlflow.start_run() as run:
mlflow.xgboost.log_model(xgb_model, "xgboost-model", signature=signature)
mlflow.log_metric("rmse", rmse)
mlflow.log_metric("mae", mae)
run_id = run.info.run_id # Capture run_id here
model_uri = f"runs:/{run_id}/xgboost-model"
registered_model = mlflow.register_model(model_uri, "catalog.schema.RealEstateValueEstimator")- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2025 08:22 PM
Thank you