bindings of sonos/tract rust NN inference enging for python
Project description
tract-python
Tract inference engine bindings in Python via FFI. It support Neural Network inference from NNEF or ONNX.
Why
tract-cli
is very feature-full but reloading a model each time you wish
to do an inference is computationaly costy and slow.
Install
Install using pip:
pip install tract_python
Usage
import tract_python
tract_model = tract_python.TractModel.load_from_path(
# This parameter can be an ONNX or NNEF filepath (in case of NNEF it can be a dir or a tgz)
'./test_simple_nnef/' # simple graph that mul input by 2
)
# .run take as argument names the name of input nodes in your neural network
results = tract_model.run(input_0=np.arange(6).reshape(1, 2, 3).astype(np.float32))
print(results)
#{'output_0': array([[[ 0., 2., 4.],
# [ 6., 8., 10.]]], dtype=float32)}
Status
This project is maintained with latest tract version.
Scope
Our personnal usecase is to be able to run +10M inferences with 'tract' engine. So loading/running NNEF or ONNX is sufficient.
We would be happy to support some others tract-cli
features:
- computing: number of FMA operations
- computing: profiling infos
(Thought it would be better to extract from tract-cli
a tract-profile
crate first in original repo to avoid code duplicate)
We do not have the bandwith to do more and welcome any contributor that would wish to add more features.
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 Distributions
Hashes for tract_python-0.2.3-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4778358691727958817fe07ce115836cefdfa9c1f00734a1154cd5f574f39681 |
|
MD5 | d3fc118bbf84ea541253b2a98cdb6cff |
|
BLAKE2b-256 | 926f90a62cf454647d3c727c545163e3dd51d5f2a6ed40c243aac04ecd6abba2 |
Hashes for tract_python-0.2.3-py3-none-manylinux_2_31_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7c6650609ffe1eff2e654ea4d8206b4749c0b0fd46868c3dc92ef0fb93e97c2 |
|
MD5 | 9bf67a6f301d531d252ca1f23c931709 |
|
BLAKE2b-256 | 3c3a7c90cbca26fc0f43bc3237378766df91a8da374565cb869cda2b23c1f0e0 |
Hashes for tract_python-0.2.3-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8861291dd23f963456cf133698ba90026980036a8bddd7e5b4e8cb8dfad7afbc |
|
MD5 | 1110e72038987bb333798cefc9cddeac |
|
BLAKE2b-256 | f1fa80e79aa5a5dfd135c5a04d30a84359fa00ea8f8a269629f313f90d6138f9 |