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_plan_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
)
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 in alpha state.
Scope
My personnal usecase is to be able to run benchmarks (+10M inferences) with 'tract' engine.
Ideally I would like to support some others tract-cli
features:
- load NNEF dir and .tgz or ONNX
- run simple plan
- computing: number of FMA operations
- computing: profiling infos
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
tract_python-0.2.2.tar.gz
(8.4 kB
view hashes)
Built Distributions
Close
Hashes for tract_python-0.2.2-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9fed9b67a9e7ae518ba59ee08437e54036cc648238c50dcb1d1df5d49aa6e75 |
|
MD5 | 02ab8db291ff4454f2f4ab86260e5d5e |
|
BLAKE2b-256 | 4da5a0fb6a88c25af0e2e927af2db13551c201516381105d084f9bb0b8ff73b1 |
Close
Hashes for tract_python-0.2.2-py3-none-manylinux_2_31_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bbed6e4418028bfd68438fb345b6638ffa36a1ad404fd7b2fddb274df5d6927 |
|
MD5 | e7f41852317467b22149317e4d40d6de |
|
BLAKE2b-256 | 0396729719639190b1e94925485f75973be2c0b83fe553862e22404230d0622c |
Close
Hashes for tract_python-0.2.2-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32469508147edfa7a430d9a64c2e02d77313dd4f02373b13d203184d87cd6cfb |
|
MD5 | e79273f42b69a13db1c06468bc9f1b7c |
|
BLAKE2b-256 | a94ff8ce8925f82b7f71caaea22517cb5d335f2ea9e7359e51ad4d3a78aa2ab0 |