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.0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

onnxruntime_transformers-0.1.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for onnxruntime_transformers-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c8f5c11eabeb9efd53cf954145fa0a230317e14736a9d06d1bb184ede2efb552
MD5 1d9fb1c86262f440c16cefec15a193ac
BLAKE2b-256 274e2f5673de8e0f36c4b873bdc4149bede32885294129a97ed3b2313aa25b3f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for onnxruntime_transformers-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 923ea84f44cc7fefb87560086dc681026e1f6be7e722b32cc95c8bcc035aacda
MD5 6a70250351d2d4f6b2a49d7ed0cf5b02
BLAKE2b-256 8c3b2efa15afddfd04da02ad837666476226518072107e1215ba782107db3aba

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