Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After using mlflow to deploy the model into docker, input data shows error. #1661

Closed
lyw615 opened this issue Jul 24, 2019 · 5 comments
Closed
Labels
bug Something isn't working

Comments

@lyw615
Copy link

lyw615 commented Jul 24, 2019

System information

The model is deployed into docker which is from mlflow/examples/sklearn_elasticnet_wine/train.py. Following are details of docker.
docker run -p 5001:8080 "ni"
pip 19.0.3 from /miniconda/lib/python3.7/site-packages/pip (python 3.7)
Python 3.7.3
1.0.0
[2019-07-24 11:55:06 +0000] [44] [INFO] Starting gunicorn 19.9.0
[2019-07-24 11:55:06 +0000] [44] [INFO] Listening at: unix:/tmp/gunicorn.sock (44)
[2019-07-24 11:55:06 +0000] [44] [INFO] Using worker: gevent
[2019-07-24 11:55:06 +0000] [47] [INFO] Booting worker with pid: 47

127.0.0.1 - - [24/Jul/2019:12:12:51 +0000] "POST /invocations HTTP/1.1" 400 1174 "-" "curl/7.47.0"

Describe the problem

Inside docker enter data with the following command :
curl http://127.0.0.1:8080/invocations -H 'Content-Type: application/json' -d '{ "columns": ["a", "b", "c"], "data": [[1, 2, 3], [4, 5, 6]] }'
Error report:
{"error_code": "BAD_REQUEST", "message": "Encountered an unexpected error while evaluating the model. Verify that the serialized input Dataframe is compatible with the model for inference.", "stack_trace": "Traceback (most recent call last):\n File \"/miniconda/envs/custom_env/lib/python3.6/site-packages/mlflow/pyfunc/scoring_server/__init__.py\", line 196, in transformation\n raw_predictions = model.predict(data)\n File \"/miniconda/envs/custom_env/lib/python3.6/site-packages/sklearn/linear_model/base.py\", line 256, in predict\n return self._decision_function(X)\n File \"/miniconda/envs/custom_env/lib/python3.6/site-packages/sklearn/linear_model/coordinate_descent.py\", line 791, in _decision_function\n return super(ElasticNet, self)._decision_function(X)\n File \"/miniconda/envs/custom_env/lib/python3.6/site-packages/sklearn/linear_model/base.py\", line 241, in _decision_function\n dense_output=True) + self.intercept_\n File \"/miniconda/envs/custom_env/lib/python3.6/site-packages/sklearn/utils/extmath.py\", line 140, in safe_sparse_dot\n return np.dot(a, b)\nValueError: shapes (2,3) and (11,) not aligned: 3 (dim 1) != 11 (dim 0)\n"}

@lyw615
Copy link
Author

lyw615 commented Jul 24, 2019

I know that there may be a problem with the format of my data input, but I can't find other information.

@apurva-koti apurva-koti added the bug Something isn't working label Jul 24, 2019
@lyw615 lyw615 closed this as completed Jul 25, 2019
@lyw615
Copy link
Author

lyw615 commented Jul 25, 2019

My input was error,sorry very much

@vijayakumarmariyappan
Copy link

@lyw615 Me too facing the same problem.
Your input is also fine right
curl http://127.0.0.1:8080/invocations -H 'Content-Type: application/json' -d '{ "columns": ["a", "b", "c"], "data": [[1, 2, 3], [4, 5, 6]] }'

How did you fix this? meant what changes you did for the above url?

THanks for helping :)

@Yeshvini
Copy link

Could you @lyw615 please tell , how you fixed this issue?

@vatsaRJOYO
Copy link

I got the same issue as well. To aid in type inferencing, i had to log model with model signature. Now, deploy the new model saved with model signature, It then works like a charm.
reference: https://www.mlflow.org/docs/latest/models.html#how-to-log-models-with-signatures

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants