Closed rivamarco closed 1 year ago
Probably related to this: https://github.com/SeldonIO/seldon-core/issues/4332
This is correct and it's the case for all prepackaged servers using python, unfortunately this is a limitation of the way pickle works, and you have to ensure full parity between your local environment that creates the artifact and the runtime environment. For this the preferred option woudl be for you to use the same version of pandas in your local env, but the alternative is for you to build your own custom version of the mlflow image and use that one instead (iwth your desired dependencies) https://docs.seldon.io/projects/seldon-core/en/latest/servers/custom.html
Describe the bug
Deploying a MlFlow model that will use a pickle of a
pandas
dataframe created (and then loaded in the model in theload_context
function) withpandas==1.4.4
will lead to this error:seldon_core.wrapper:handle_generic_exception:53 - ERROR: {'status': {'status': 1, 'info': 'Model not loaded yet', 'code': -1, 'reason': 'MICROSERVICE_INTERNAL_ERROR'}}
In particular we were able to retrieve this log putting the loading of the pickle in the
predict
function (done just to obtain a more precise log):Can't get attribute '_unpickle_block' on <module 'pandas._libs.internals' from '/opt/conda/envs/mlflow/lib/python3.9/site-packages/pandas/_libs/internals.cpython-39-x86_64-linux-gnu.so'
And also we will have this log in the container of the model:
seldon_core.gunicorn_utils:load:109 - DEBUG: No load method in user model
.The same model deployed with plain MlFlow will work correctly. Also, the same model but with the pickle created and loaded using
pandas==1.2.3
will work correctly both in Seldon and plain MlFlowTo reproduce
mlflow==1.28.0
andpandas==1.4.4
. We have used python3.9.9
but also other versions are affectedsave_pickle.py
that is in the attached zip fileexport_model.py
that is in the attached zip filenot_working_pickle_pandas
with the files of the model.{"value":1200}
but instead we have the above errormlflow models serve -m working_pickle_pandas
and try to cURL it it will workTo make it work
If we do the above steps but using
pandas==1.2.3
everything will work correctly.Environment
Kubernetes version:
Seldon Images:
files.zip