Skip to main content

transformers for production runtime, 3x faster on cpu, no pytorch nor tensorflow included

Project description

onnxruntime_transformers

transformers for production runtime, 3x faster on cpu, no pytorch nor tensorflow included

convert models to onnx

install converter pip install optimum[exporters]

convert embedding model to onnx

optimum-cli export onnx --task sentence-similarity --model "infgrad/stella-base-zh-v3-1792d" bert_embed

convert sentence correction model to onnx

optimum-cli export onnx --task fill-mask --model "shibing624/macbert4csc-base-chinese" bert_csc

convert ner model to onnx

optimum-cli export onnx --task token-classification --model "shibing624/bert4ner-base-chinese" bert_ner

inference with onnx

generate embeddings

from onnxruntime_transformers import OnnxruntimeTransformers
encoder = OnnxruntimeTransformers("./bert_embed/tokenizer.json", "./bert_embed/model.onnx")
embeddings = encoder.encode([
    "how are you",
    "I'm fine thank you, and you?",
])

Project details


Download files

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

Source Distribution

onnxruntime_transformers-0.1.2.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

onnxruntime_transformers-0.1.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file onnxruntime_transformers-0.1.2.tar.gz.

File metadata

File hashes

Hashes for onnxruntime_transformers-0.1.2.tar.gz
Algorithm Hash digest
SHA256 dfb3d3a534ac0f33d43d6304371122f9fecf6f4d011ab5fa480e6ed04eb7f015
MD5 d6e2e435e10f01c0c82de35527848e4c
BLAKE2b-256 16472e3c9e160f16671fea8366a8993732db0583abc3d47b1651433a35e63e9d

See more details on using hashes here.

File details

Details for the file onnxruntime_transformers-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for onnxruntime_transformers-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f9e2eab9190ac37bbd256d83e4685a0cd65bc15b68d583a61247044c3df31759
MD5 75a73f73177c1c0bd4d5b62c15af843f
BLAKE2b-256 5fdb700fdf8a61803176e6dfc50b5200829f98e843eb27a3014cb17430eea5d7

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