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

ernie_tiny部署paddle serving后,curl返回 request that this server could not understand #189

Closed
Nicole1983 opened this issue Mar 24, 2021 · 2 comments

Comments

@Nicole1983
Copy link

Nicole1983 commented Mar 24, 2021

paddler serving部署文本匹配的ernie_tiny后,curl -H "Content-Type:application/json" -X POST -d '{"Data":[['世界上什么东西最小', '世界上什么东西最小?']] , "fetch":["prediction"]}' http://172.0.0.1:9292/ernie/prediction,返回
400 Bad Request
Bad Request
The browser (or proxy) sent a request that this server could not understand.

请问是传入参数格式不对吗?还是操作步骤不正确呢?谢谢!
完整的操作步骤如下:

  1. 获取docker 镜像 registry.baidubce.com/paddlepaddle/serving:0.5.0-cuda10.2-cudnn8-devel

  2. 容器内依次安装 paddle-serving-server-gpu==0.5.0.post102,paddlepaddle-gpu==2.0.0 和paddle_serving_client

  3. ernin_tiny的训练模型转为paddle serving模型,ernie_tiny_model包含如下文件
    total 350716
    drwxrwxr-x 2 media media 4096 Mar 24 09:43 ./
    drwxrwxr-x 4 media media 4096 Mar 24 09:44 ../
    -rw-rw-r-- 1 media media 656906 Mar 24 09:43 model
    -rw-rw-r-- 1 media media 358454636 Mar 24 09:43 params
    -rw-rw-r-- 1 media media 356 Mar 24 09:43 serving_server_conf.prototxt
    -rw-rw-r-- 1 media media 147 Mar 24 09:43 serving_server_conf.stream.prototxt

  4. 将步骤#3中生成的ernie_tiny_model和ernie_tiny_client拷贝到docker/home/workspace/Serving/python/examples/ernie_tiny 中

  5. 使用uwsgi启动服务
    from paddle_serving_server.web_service import WebService
    uci_service = WebService(name="ernie")
    uci_service.load_model_config("./ernie_tiny_model")
    uci_service.prepare_server(workdir="./workdir", port=int(9500), device="cpu")
    uci_service.run_rpc_service()
    app_instance = uci_service.get_app_instance()

  6. 启动服务 uwsgi --http :9292 --module uwsgi_service:app_instance

@TeslaZhao
Copy link

TeslaZhao commented Mar 28, 2021

您好,根据您的报错判断,错误原因webserver端口没有开启。

请参考Paddle Serving的web server示例可以参考python/examples/下bert和lac示例,webserver启动采用run_web_service()方法,在bert示例服务启动方法(https://github.com/PaddlePaddle/Serving/blob/develop/python/examples/bert/bert_web_service.py),打开web端口为int(9500)

bert_service.run_web_service()

@Nicole1983
Copy link
Author

已经好用了,谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants