我可以使用以下命令创建 ml 模型服务器
mlflow models serve -m file:///C:/Users/SawarkarFamily/Desktop/mlflow-master/examples/sklearn_elasticnet_wine/mlruns/0/9aeb7ba16d7e4c20870b664e267524ea/artifacts/model -p 8000
2020/07/28 17:10:59 INFO mlflow.models.cli: Selected backend for flavor 'python_function'
2020/07/28 17:11:03 INFO mlflow.pyfunc.backend: === Running command 'conda activate mlflow-76d7aedf36021b9bb7f176264305cf2b7868ca8d & waitress-serve --host=127.0.0.1 --port=8000 --ident=mlflow mlflow.pyfunc.scoring_server.wsgi:app'
c:\users\sawarkarfamily\anaconda3\envs\mlflow-76d7aedf36021b9bb7f176264305cf2b7868ca8d\lib\site-packages\waitress\adjustments.py:441: DeprecationWarning: In future versions of Waitress clear_untrusted_proxy_headers will be set to True by default. You may opt-out by setting this value to False, or opt-in explicitly by setting this to True.
warnings.warn(
Serving on http://DESKTOP-AO59MJC:8000
在文档中给出了使用 curl 命令发送预测,如下所示:
curl -X POST -H "Content-Type:application/json; format=pandas-split" --data '{"columns":["alcohol", "chlorides", "citric acid", "density", "fixed acidity", "free sulfur dioxide", "pH", "residual sugar", "sulphates", "total sulfur dioxide", "volatile acidity"],"data":[[12.8, 0.029, 0.48, 0.98, 6.2, 29, 3.33, 1.2, 0.39, 75, 0.66]]}' http://127.0.0.1:1234/invocations
我用 8000 替换了端口号,但出现错误。
curl: (6) Could not resolve host: chlorides,
curl: (6) Could not resolve host: citric acid,
curl: (6) Could not resolve host: density,
curl: (6) Could not resolve host: fixed acidity,
curl: (6) Could not resolve host: free sulfur dioxide,
curl: (6) Could not resolve host: pH,
curl: (6) Could not resolve host: residual sugar,
curl: (6) Could not resolve host: sulphates,
curl: (6) Could not resolve host: total sulfur dioxide,
curl: (3) [globbing] unmatched close brace/bracket in column 17
curl: (6) Could not resolve host: 0.029,
curl: (6) Could not resolve host: 0.48,
curl: (6) Could not resolve host: 0.98,
curl: (6) Could not resolve host: 6.2,
curl: (6) Could not resolve host: 29,
curl: (6) Could not resolve host: 3.33,
curl: (6) Could not resolve host: 1.2,
curl: (6) Could not resolve host: 0.39,
curl: (6) Could not resolve host: 75,
curl: (3) [globbing] unmatched close brace/bracket in column 5
{"error_code": "MALFORMED_REQUEST", "message": "Failed to parse input as a Pandas DataFrame. Ensure that the input is a valid JSON-formatted Pandas DataFrame with the `split` orient produced using the `pandas.DataFrame.to_json(..., orient='split')` method.", "stack_trace": "Traceback (most recent call last):\n File \"c:\\users\\sawarkarfamily\\anaconda3\\envs\\mlflow-76d7aedf36021b9bb7f176264305cf2b7868ca8d\\lib\\site-packages\\mlflow\\pyfunc\\scoring_server\\__init__.py\", line 74, in parse_json_input\n return _dataframe_from_json(json_input, pandas_orient=orient, schema=schema)\n File \"c:\\users\\sawarkarfamily\\anaconda3\\envs\\mlflow-76d7aedf36021b9bb7f176264305cf2b7868ca8d\\lib\\site-packages\\mlflow\\utils\\proto_json_utils.py\", line 106, in _dataframe_from_json\n return pd.read_json(path_or_str, orient=pandas_orient, dtype=False,\n File \"c:\\users\\sawarkarfamily\\anaconda3\\envs\\mlflow-76d7aedf36021b9bb7f176264305cf2b7868ca8d\\lib\\site-packages\\pandas\\util\\_decorators.py\", line 214, in wrapper\n return func(*args, **kwargs)\n File \"c:\\users\\sawarkarfamily\\anaconda3\\envs\\mlflow-76d7aedf36021b9bb7f176264305cf2b7868ca8d\\lib\\site-packages\\pandas\\io\\json\\_json.py\", line 608, in read_json\n result = json_reader.read()\n File \"c:\\users\\sawarkarfamily\\anaconda3\\envs\\mlflow-76d7aedf36021b9bb7f176264305cf2b7868ca8d\\lib\\site-packages\\pandas\\io\\json\\_json.py\", line 731, in read\n obj = self._get_object_parser(self.data)\n File \"c:\\users\\sawarkarfamily\\anaconda3\\envs\\mlflow-76d7aedf36021b9bb7f176264305cf2b7868ca8d\\lib\\site-packages\\pandas\\io\\json\\_json.py\", line 753, in _get_object_parser\n obj = FrameParser(json, **kwargs).parse()\n File \"c:\\users\\sawarkarfamily\\anaconda3\\envs\\mlflow-76d7aedf36021b9bb7f176264305cf2b7868ca8d\\lib\\site-packages\\pandas\\io\\json\\_json.py\", line 857, in parse\n self._parse_no_numpy()\n File \"c:\\users\\sawarkarfamily\\anaconda3\\envs\\mlflow-76d7aedf36021b9bb7f176264305cf2b7868ca8d\\lib\\site-packages\\pandas\\io\\json\\_json.py\", line 1094, in _parse_no_numpy\n for k, v in loads(json, precise_float=self.precise_float).items()\nValueError: Expected object or value\n"}
请有人帮我解决这个问题。