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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file onnxruntime_transformers-0.1.1.tar.gz
.
File metadata
- Download URL: onnxruntime_transformers-0.1.1.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34d30cff15812ccb5a0bb3284586ede1b4b840ef4ca5e0fdb5d65ef29976d814 |
|
MD5 | 480af7922beaed99f76b97b09cb19e75 |
|
BLAKE2b-256 | a82f641ba71554a008634d9e085fdfef3f0840265bf3c6eefb0fecf666e4bccc |
File details
Details for the file onnxruntime_transformers-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: onnxruntime_transformers-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3810d50eb2ad5be6da4e9aa3b450a9e3506e902f406631b628f255e84c319b5b |
|
MD5 | 632aef5c756dcc68a3bb6063645aff48 |
|
BLAKE2b-256 | 82ffc03288fed3a3734d14085ada0ce888c140385110098ce2a6c37558722eec |