tract-python
Project Archived: tract now maintains it's own Python package here.
tract inference engine bindings in Python via FFI. It support Neural Network inference from NNEF or ONNX.
Why
No need to compile tract or have cargo installed, fast install.
tract-cli is very feature-full but reloading a model each time you wish
to do an inference is computationaly costy and slow.
Think onnxruntime except it support NNEF, and it is based on tract.
Install
Install using pip:
pip install tract_python
Usage
import tract_python
print(tract_python.TRACT_VERSION)
# "X.X.X"
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)
'./tests/assets/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.
Metadata
Release files for tract-python 0.2.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tract_python-0.2.12.tar.gz | 21.8 kB | Without provenance | Details for tract_python-0.2.12.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tract_python-0.2.12-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for tract_python-0.2.12-py3-none-win_amd64.whl |
| tract_python-0.2.12-py3-none-manylinux_2_35_x86_64.whl | Python 3 | none | Linux glibc 2.35+ x86-64 | Details for tract_python-0.2.12-py3-none-manylinux_2_35_x86_64.whl |
| tract_python-0.2.12-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl | Python 3 | none | macOS 10.9+ universal2 (ARM64, x86-64), macOS 10.9+ x86-64, macOS 11.0+ ARM64 | Details for tract_python-0.2.12-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl |
Total release size: 24.8 MB
Release files / tract_python-0.2.12.tar.gz
| Download URL | tract_python-0.2.12.tar.gz |
|---|---|
| Size | 21.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f68ec403b95b3a78664b96fe98314711a2a4c48d6b35d597364864593c757e87
|
|
BLAKE2b-256 checksum How to use checksums |
f76f4c31e906ab50bd42a97f404de57c0fc75eb6d1d63dfbb9a7a96bd7239091
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.2.3
|
Release files / tract_python-0.2.12-py3-none-win_amd64.whl
| Download URL | tract_python-0.2.12-py3-none-win_amd64.whl |
|---|---|
| Size | 5.4 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
8520afeee35d1279421a53757380eb171864fd7701254411e68de18fe4d0b60e
|
|
BLAKE2b-256 checksum How to use checksums |
587dbe1fffb3d2ff920244771aa1492fabd10a9029cf9f4e9e113b98e12fe7d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.2.3
|
Release files / tract_python-0.2.12-py3-none-manylinux_2_35_x86_64.whl
| Download URL | tract_python-0.2.12-py3-none-manylinux_2_35_x86_64.whl |
|---|---|
| Size | 7.9 MB |
| Tags | Linux glibc 2.35+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
7e8df16661ec37b07b3f2d97cc03de39be814dc5665bfe930cdd1e7013aeed32
|
|
BLAKE2b-256 checksum How to use checksums |
dd795b11dca2daba98cbe5df032be593dfbbff58121653dc0ddb2dc6b3311bd3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.2.3
|
Release files / tract_python-0.2.12-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
| Download URL | tract_python-0.2.12-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl |
|---|---|
| Size | 11.5 MB |
| Tags | Python 3 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
fc44f4de94544facdbd02626cb659555c908486da42ab24c72f5baa66796c630
|
|
BLAKE2b-256 checksum How to use checksums |
8f96220b8ac2c50e64b3d90b833259abb4558385053865a54ceab6c8ca4e1c2b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.2.3
|
Security for tract-python 0.2.12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.