Open pulungw opened 1 year ago
By the way, I'm using mlflow 2.7.1 on Windows 11 machine.
I think I found the root cause.
The MLmodel
file has an extra line params
in the end like below. Since the code is parsing outputs
until the end of line, this params
is giving theJSONDecodeError: Extra data
error. If I remove the params
from the MLmodel. I could read the file just fine.
outputs: '[{"type": "tensor", "tensor-spec": {"dtype": "float64", "shape": [-1]}}]'
params: null
This seems to be a new specification from MLflow 2.6.0 when they add the "Inference params support". This would affect all MLmodel created since MLflow 2.6.0 release. https://github.com/mlflow/mlflow/pull/9068
I believe this is the problematic line of code in sasctl, it assumes no other field after outputs
and reads the whole line.
https://github.com/sassoftware/python-sasctl/blob/d2d568248837092c34ce975b88309b7fbbcbde18/src/sasctl/pzmm/mlflow_model.py#L53
Perhaps a better solution is to parse the MLmodel file natively in YAML? Since it is apparently in YAML format. That way you can keep forward compatibility if MLflow decides to add another field. https://mlflow.org/docs/latest/models.html#id28
I'll stick with MLflow 2.5.0 for now, it seems to be working fine.
Describe the issue Trying to read mlflow model using pzmm.MLFlowModel.read_mlflow_model_file result in JSONDecodeError. I'm just using a simple example from here: https://medium.com/@rehabreda/registering-mlflow-models-to-sas-model-manager-using-sasctl-a-comprehensive-guide-a47dbf183338
To Reproduce The rest of the training code can be found on the above link. The code that perform the read mlflow model file is shown below:
Expected behavior Getting the dictionary successfully from pzmm.MLFlowModel.read_mlflow_model_file().
Stack Trace If you're experiencing an exception, include the full stack trace and error message.
Version 1.10.0