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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for onnxruntime_transformers-0.1.1.tar.gz
Algorithm Hash digest
SHA256 34d30cff15812ccb5a0bb3284586ede1b4b840ef4ca5e0fdb5d65ef29976d814
MD5 480af7922beaed99f76b97b09cb19e75
BLAKE2b-256 a82f641ba71554a008634d9e085fdfef3f0840265bf3c6eefb0fecf666e4bccc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for onnxruntime_transformers-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3810d50eb2ad5be6da4e9aa3b450a9e3506e902f406631b628f255e84c319b5b
MD5 632aef5c756dcc68a3bb6063645aff48
BLAKE2b-256 82ffc03288fed3a3734d14085ada0ce888c140385110098ce2a6c37558722eec

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