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.3-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file paddle_gpu_serving-0.8.3-py3-none-any.whl.

File metadata

  • Download URL: paddle_gpu_serving-0.8.3-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.8

File hashes

Hashes for paddle_gpu_serving-0.8.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5594c2403ec7da2d013ece49eb8ea4bbb05a737390221f3475643740d12a6e30
MD5 26b35242a06ff4b104fbdc77f44ffdc3
BLAKE2b-256 9d6cfdc32da765bb268e961cd79c497410216a7b7bd77384954f8db52742b42a

See more details on using hashes here.

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