Skip to main content

Colibry NPU Compiler

colibry-npu provides quantization and compilation tools for deploying neural networks on the Asygn Colibry NPU. The nnpa-compiler converts compatible models into .nnpa bitstreams containing the network configuration and weights.

Installation

Requires Python >= 3.12.

pip install colibry-npu
# or
uv add colibry-npu

For standalone CLI usage:

uv tool install --python 3.12 colibry-npu
# or, without installing:
uvx --python 3.12 --from colibry-npu nnpa-compiler --help

Supported formats

Framework / format Input Support
TensorFlow / Keras Keras model Model compilation and PTQ/QAT
TFLite .tflite Model compilation and PTQ
ONNX .onnx Model compilation and PTQ
PyTorch .pt2 (ExportedProgram) Model compilation and PTQ/QAT

Models must use operators and quantization schemes compatible with the Colibry NPU.

TensorFlow compatibility

Compatible TensorFlow versions by Python version (TensorFlow is installed automatically):

Python Version Compatible TensorFlow Versions
3.9 to 3.11 Unsupported
3.12 >= 2.20.0 and < 2.22.0
3.13 >= 2.20.0 and < 2.22.0
3.14 >= 2.22.0rc0 (beta)
3.15 Not supported yet

Quantization

The package includes format-specific quantization utilities:

Module Quantization support
custom_quantization_tf Quantization-aware training (QAT) for Keras models, with custom layer quantization configurations.
custom_quantization_tflite Post-training quantization (PTQ) to TFLite using representative .npz calibration data; supports full-integer conversion and optional evaluation.
custom_quantization_onnx Static ONNX quantization with ONNX Runtime, using a calibration dataset and QDQ representation by default.
custom_quantization_torch PTQ and QAT with a Colibry-specific TorchAO quantizer, targeting hardware-compatible quantization. Export the resulting model as a .pt2 ExportedProgram for compilation.

Quantization does not guarantee that every model is compilable: operators and tensor configurations must also be supported by the NPU backend.

Compiler usage

Compile a model by passing its path:

nnpa-compiler model_directory/  # TensorFlow/Keras
nnpa-compiler model.onnx        # ONNX
nnpa-compiler model.tflite      # TFLite
nnpa-compiler model.pt2         # PyTorch

For TensorFlow/Keras or PyTorch, Post-Training Quantization (PTQ) can be applied to a floating-point model using representative calibration data. The compiler then generates the corresponding .nnpa bitstream.

nnpa-compiler model_directory/ --apply_ptq --calibration-npz calibration.npz   # TensorFlow/Keras (FP32 → NNPA)
nnpa-compiler model.pt2 --apply_ptq --calibration-npz calibration.npz          # PyTorch (FP32 → NNPA)

For all compiler options:

nnpa-compiler --help

Python usage

from colibry_npu.nnpa_compiler import nnpa_compiler

nnpa_compiler.main("model.pt2") # Direct compilation (e.g. a quantized PyTorch ExportedProgram)

Metadata

Release files for colibry-npu 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for colibry-npu 0.2.1
File Interpreter ABI Platform Actions
colibry_npu-0.2.1-py3-none-any.whl Python 3 none any Details for colibry_npu-0.2.1-py3-none-any.whl

Release files / colibry_npu-0.2.1-py3-none-any.whl

Download URL colibry_npu-0.2.1-py3-none-any.whl
Size 102.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f220b21250bccae0d2907c65a8916c2deaf4f4e91e6bc1bc94d01f801827600
BLAKE2b-256 checksum
How to use checksums
37504acf3dcdd74be3e8e13122892b9d1f56aac451195273889c1d719d2014a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for colibry-npu 0.2.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page