Skip to main content

package for paddle serving with bert

Project description

paddle-gpu-serving

paddle-gpu-serving简介是基于Paddle Serving框架的模型预测服务库,通过少量代码即可部署和使用指定的模型进行远程预测。目前支持使用PaddleHub语义理解模型库中的BERT类模型获取文本对应的向量表示。其中serving服务的代码参考bert模型服务demo server端

安装

server端

环境要求:python3,paddlepaddle>=1.6,paddlehub>=1.4

pip install paddle-gpu-serving

client端

环境要求:ujson,python2或python3

下载bert_service.py脚本使用

使用

server端

from paddle_gpu_serving.run import BertServer
bs = BertServer(with_gpu=True)
bs.with_model('bert_chinese_L-12_H-768_A-12')
bs.run(gpu_index = 0, port = 8010)

client端

bc = BertService(
    model_name='bert_chinese_L-12_H-768_A-12',
    max_seq_len=20,
    show_ids=False,
    do_lower_case=True)
bc.add_server('127.0.0.1:8010')
result = bc.encode([["远上寒山石径斜"], ])
print(result[0])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

paddle_gpu_serving-0.8.2-py3-none-any.whl (19.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page