Broken print method for xgboost when loaded as python function #3550
Labels
area/models
MLmodel format, model serialization/deserialization, flavors
bug
Something isn't working
Thank you for submitting an issue. Please refer to our issue policy for additional information about bug reports. For help with debugging your code, please refer to Stack Overflow.
Please fill in this bug report template to ensure a timely and thorough response.
Willingness to contribute
The MLflow Community encourages bug fix contributions. Would you or another member of your organization be willing to contribute a fix for this bug to the MLflow code base?
System information
mlflow --version
): 1.11.0Describe the problem
When loaded with pyfunc, the xgboost model can't be printed because the attribute
run_id
is missing from the meta data. It seems as when initiated,PyFuncModel
expectsrun_id
to be inmodel_meta
(but it does not look like it's asserted).With
mlflow.xgboost.log_model()
, therun_id
is correctly logged toMLmodel
, but not withmlflow.xgboost.save_model()
.Hence, a quick fix would be to check if
run_id
is inmodel_meta
before the existent check formodel_meta.run is None
in the pyfunc print method. Other way would be to writerun_id: None
when saving a model outside a run withmlflow.xgboost.save_model()
.Probably we best aim for consistency with other flavours. I did not have time to check if they write
run_id: None
or simply don't write the key.Code to reproduce issue
Other info / logs
@harupy probably a quick fix for you since you implemented most of the python xgboost features here.
What component(s), interfaces, languages, and integrations does this bug affect?
Components
area/artifacts
: Artifact stores and artifact loggingarea/build
: Build and test infrastructure for MLflowarea/docs
: MLflow documentation pagesarea/examples
: Example codearea/model-registry
: Model Registry service, APIs, and the fluent client calls for Model Registryarea/models
: MLmodel format, model serialization/deserialization, flavorsarea/projects
: MLproject format, project running backendsarea/scoring
: Local serving, model deployment tools, spark UDFsarea/server-infra
: MLflow server, JavaScript dev serverarea/tracking
: Tracking Service, tracking client APIs, autologgingInterface
area/uiux
: Front-end, user experience, JavaScript, plottingarea/docker
: Docker use across MLflow's components, such as MLflow Projects and MLflow Modelsarea/sqlalchemy
: Use of SQLAlchemy in the Tracking Service or Model Registryarea/windows
: Windows supportLanguage
language/r
: R APIs and clientslanguage/java
: Java APIs and clientslanguage/new
: Proposals for new client languagesIntegrations
integrations/azure
: Azure and Azure ML integrationsintegrations/sagemaker
: SageMaker integrationsintegrations/databricks
: Databricks integrationsThe text was updated successfully, but these errors were encountered: