ONNC-bench is a Python wrapper of ONNC
Project description
ONNC-bench
ONNC-bench is a Python wrapper of ONNC
Installation
Using pip
pip install onnc-bench
Python API Example
Here is an example to show how to use ONNC python API
# Setup your ONNC API key
api_key = "Your API KEY"
# Instantiate a workspace for deploying model for device `M487`
workspace = launch(api_key, 'NUMAKER_IOT_M487')
# Quantize model to improve performance and reduce memory footprint.
# Here we need quantization dataset, using validation dataset
# is surfficent.
workspace.quantize(x_test)
# Compile the model and get the compilation results
report = workspace.compile(model, "input_1", "dense_1")["report"]
# Save the compiled model
workspace.save('./output')
# Release disk space in cloud
workspace.close()
print(report)
"""
{'ram': 2490, 'rom': 101970}
The report shows we need:
2,490 bytes of SRAM
101,970 bytes of ROM
to run this model on a CortexM device.
"""
CLI tools
onnc-bench comes with cli tools to help you deploy model faster. Follow below commands to scaffolding a bench.
- Create and enter your bench
onnc-create mybench
cd mybench
- Setup API key
onnc-login --key "Your-API-Key-Here"
- Create an infer
myinfer1
base on templatevww
./create-project -t vww -o myinfer1
- Compile the pretrained model
./build-project -t myinfer1 -d NUMAKER_IOT_M487
- Deoply the compiled model
./deploy-project -t myinfer1 -o ./output
More examples can be found in examples, currently we provide below examples:
- Keras MNIST: Contains a MNIST example in Keras from training to development.
- Simple Example: Compile a serialized model, and download loadable with demo code in c++.
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
onnc-bench-1.4.0.tar.gz
(11.3 MB
view hashes)
Built Distribution
onnc_bench-1.4.0-py3-none-any.whl
(20.3 kB
view hashes)
Close
Hashes for onnc_bench-1.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91615db6880adb60eb1b8728ed3c9197281eb69c10660994023881a27bfb9f68 |
|
MD5 | b165ece8aec413ec98e4cbd34c8d22e1 |
|
BLAKE2b-256 | 76c0f5ec7c2d5d31e6d29fd7f0f037ea1ba2c8b5be28e889948c737fc0943cc2 |