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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

onnxruntime_transformers-0.1.5-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: onnxruntime_transformers-0.1.5.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for onnxruntime_transformers-0.1.5.tar.gz
Algorithm Hash digest
SHA256 8511ee1893ec972d24e9674b75bb5cef1826b5d09c739caef3413bbad5ba443c
MD5 b863bc81429a13d31d943e30ecc466bc
BLAKE2b-256 57b0656a4b198f4755bc8afb3fd12e16a8843c1866a5b7952d8c53d5bf648848

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for onnxruntime_transformers-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a06d72d54e02dfe8ba6de1eacb6c5002a0a0731295c60b90072a42c7335a4592
MD5 614dca23db600c660793488125296f33
BLAKE2b-256 75e0cfcc7f485f619e44209459bf95906d01db95f9729377889485bd0d6aa2ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page