Skip to main content

esp-ppq is an offline quantization tools

Project description

ESP-PPQ Quantization Tool

ESP-PPQ is a quantization tool based on PPQ, and its source code is fully open-sourced. Built upon PPQ, ESP-PPQ adds Espressif-customized quantizers and exporters, allowing users to select quantization rules compatible with ESP-DL for different chips and export standardized model files that can be directly loaded by ESP-DL. ESP-PPQ is fully compatible with all PPQ APIs and quantization scripts.

For more details on quantization principles, please refer to the PPQ documentation and videos. For instructions on using ESP-PPQ, see How to quantize model.

Installation (安装方法)

  1. Install CUDA from CUDA Toolkit

  2. Install Complier

apt-get install ninja-build # for debian/ubuntu user
yum install ninja-build # for redhat/centos user

For Windows User:

(1) Download ninja.exe from https://github.com/ninja-build/ninja/releases, add it to Windows PATH.

(2) Install Visual Studio 2019 from https://visualstudio.microsoft.com.

(3) Add your C++ compiler to Windows PATH Environment, if you are using Visual Studio, it should be like "C:\Program Files\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x86"

(4) Update PyTorch version to >=2.0.0.

  1. Install PPQ

Method 1: Install the package using pip

   pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
   pip install esp-ppq

Method 2: Install from source with pip to stay synchronized with the master branch

   git clone https://github.com/espressif/esp-ppq.git
   cd esp-ppq
   pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
   pip install -e .

Method 3: Install the package using uv

   uv pip install "esp-ppq[cpu]" --torch-backend=cpu
   # GPU
   # uv pip install "esp-ppq[cpu]" --torch-backend=cu124
   # AMD GPU
   # uv pip install "esp-ppq[cpu]" --torch-backend=rocm6.2
   # Intel XPU
   # uv pip install "esp-ppq[cpu]" --torch-backend=xpu

Method 4: Install from source using uv to stay in sync with the master branch

   git clone https://github.com/espressif/esp-ppq.git
   cd esp-ppq
   uv pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
   uv pip install -e .

Method 5: Use esp-ppq with docker:

docker build -t esp-ppq:your_tag https://github.com/espressif/esp-ppq.git

[!NOTE]

  • The example code installs the Linux PyTorch CPU version. Please install the appropriate PyTorch version based on your actual needs.
  • If installing the package with uv, simply modify the --torch-backend parameter, which will override the PyTorch URLs index configured in the project.

License

This project is distributed under the Apache License, Version 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

esp_ppq-1.3.5.tar.gz (474.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

esp_ppq-1.3.5-py3-none-any.whl (659.5 kB view details)

Uploaded Python 3

File details

Details for the file esp_ppq-1.3.5.tar.gz.

File metadata

  • Download URL: esp_ppq-1.3.5.tar.gz
  • Upload date:
  • Size: 474.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for esp_ppq-1.3.5.tar.gz
Algorithm Hash digest
SHA256 8afc949b8f46a8ef631447480ec8e823406d36ae8c13e4928bf4992182015e9f
MD5 7380469eda89e5327973e92fa043c8a9
BLAKE2b-256 6b552032cb5c0f3cb0e455132741d6f62f490a7655cd1fdd364eda9090ba078d

See more details on using hashes here.

File details

Details for the file esp_ppq-1.3.5-py3-none-any.whl.

File metadata

  • Download URL: esp_ppq-1.3.5-py3-none-any.whl
  • Upload date:
  • Size: 659.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for esp_ppq-1.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9dcd9f523059baa4444f56fdc5a3504b51cefd5ead711cb93486711074c48afe
MD5 cf9b198c2554f6e65d3f1a9420e683ee
BLAKE2b-256 d9772b53131eb2da86f0eeab657955fd9e0443cbb4c2c54d96d796c14a525f91

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page