[BUG] Conversion of non-dataframe type to dataframe in a pyfunc.PythonModel predict calls #11930
Open
2 of 23 tasks
Labels
area/models
MLmodel format, model serialization/deserialization, flavors
bug
Something isn't working
Issues Policy acknowledgement
Where did you encounter this bug?
Local machine
Willingness to contribute
Yes. I would be willing to contribute a fix for this bug with guidance from the MLflow community.
MLflow version
System information
Describe the problem
I'm unsure if this is a bug, documentation issue, or feature request.
When passing a dictionary input to the
mlflow.pyfunc.PythonModel
predict
function it is converted to apandas.core.DataFrame
. I can't find documentation to clearly state that this is the expected operation, but did see the following in the save_model docs:The issue is reproduced by:
mlflow.pyfunc.PythonModel
to accept aDict
as input to thepredict
function.predict
callWhen passing a dictionary input to the
mlflow.pyfunc.PythonModel
predict
function it is converted to apandas.core.DataFrame
.My primary goal here is to infer a signature that is a Dict and to process it as a dict at inference time. Is it expected behavior to infer the signature based on type Dict, but then always try to convert it to dataframe at inference time?
Tracking information
NA
Code to reproduce issue
Output:
Stack trace
NA
Other info / logs
No response
What component(s) does this bug affect?
area/artifacts
: Artifact stores and artifact loggingarea/build
: Build and test infrastructure for MLflowarea/deployments
: MLflow Deployments client APIs, server, and third-party Deployments integrationsarea/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/recipes
: Recipes, Recipe APIs, Recipe configs, Recipe Templatesarea/projects
: MLproject format, project running backendsarea/scoring
: MLflow Model server, model deployment tools, Spark UDFsarea/server-infra
: MLflow Tracking server backendarea/tracking
: Tracking Service, tracking client APIs, autologgingWhat interface(s) does this bug affect?
area/uiux
: Front-end, user experience, plotting, JavaScript, JavaScript dev serverarea/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 supportWhat language(s) does this bug affect?
language/r
: R APIs and clientslanguage/java
: Java APIs and clientslanguage/new
: Proposals for new client languagesWhat integration(s) does this bug affect?
integrations/azure
: Azure and Azure ML integrationsintegrations/sagemaker
: SageMaker integrationsintegrations/databricks
: Databricks integrationsThe text was updated successfully, but these errors were encountered: