9. Model Compile and Evaluate
The EdgeAI Model Zoo runs pre-compiled artifacts on the AM62Dx target. This section covers the x86 host workflow that produces those artifacts: how to compile an audio model for the C7™ NPU, run host-emulation inference, and measure accuracy against a data set - using edgeai-tidlrunner. It runs entirely on an Ubuntu x86 PC; nothing here touches the target.
This is the workflow for any audio model, not just the reference models. The
four reference models below are worked examples. To bring your own model you
point the same tidlrunner-cli at your ONNX graph and a per-model YAML config,
using a reference config as a starting template. Which operators offload to the
C7™ NPU (versus fall back to the Arm core) is determined by TIDL - see
edgeai-tidl-tools for
the authoritative list of supported operators.
9.1. edgeai-tidlrunner
edgeai-tidlrunner is a bring-your-own-model (BYOM) command-line wrapper over the
core edgeai-tidl-tools
compilation stack. A single YAML config per model drives every stage, and one
CLI - tidlrunner-cli - exposes the stages this section uses:
Command |
What it does |
|---|---|
|
Imports the ONNX graph, quantizes and partitions it, and writes the deployable TIDL/TVM-RT artifacts. |
|
Runs the compiled model on the x86 host (PC emulation) to check output correctness before deploying to the target. |
|
Runs the compiled model over a data set and reports accuracy or speech-enhancement metrics. |
|
One-shot compile + inference + reference comparison that emits an interactive HTML analysis report (see Model Inspect). |
All commands are run from the repository root (edgeai-tidlrunner/) and take
--config_path <cfg> pointing at the per-model YAML. The same config file is
reused across compile, infer, and evaluate.
9.2. Setup
Model compilation runs on an x86 PC (Ubuntu Linux recommended). The AM62D audio flow is self-contained: a single setup script installs the whole TVM toolchain into a dedicated Python 3.10 environment. The TIDL tools target Python 3.10. These steps assume pyenv.
Clone the repository (https://github.com/TexasInstruments/edgeai-tidlrunner):
$ git clone https://github.com/TexasInstruments/edgeai-tidlrunner.git $ cd edgeai-tidlrunner
Create and activate a dedicated Python 3.10 environment. The AM62D flow uses a TI TVM wheel; keep it in its own venv (
tidlrunner-am62d) so it never clobbers a standardtidlrunnersetup:$ pyenv install 3.10 $ pyenv virtualenv 3.10 tidlrunner-am62d $ pyenv activate tidlrunner-am62d
Run the AM62D setup script. With the venv active, one script installs everything this flow needs:
$ ./devices/setup_am62d.shIt downloads the ARM GCC 15.2 and C7000 CGT 5.0.0 LTS cross-toolchains into
tools/tidl_tools_package/bin/(skipped if already present), installs the x86 TI TVM wheel - which bundles the AM62D x86 TIDL tools inside the package - and installstidlrunner[pc,audio],tools,onnxruntime, andtidl_onnx_model_optimizer. The[audio]extra pulls in the audio packages (librosa,soundfile,scipy,pesq,pystoi,scikit-learn). No separatepip installis needed.Source the env script once per shell. TVM
dlopens the TIDL runtime (libvx_tidl_rt.so) before Python’s own import runs, so the tool paths must be live in the shell beforetidlrunner-clistarts. Source (do not execute)devices/am62d_env.shonce; everytidlrunner-clicommand run afterward in that shell picks the vars up:$ source devices/am62d_env.sh
It exports:
Variable
Value
TIDL_TOOLS_PATH<tvm-package-dir>/3rdparty/x86_tidl_tools/AM62D(resolved from the active venv’s installedtvm)LD_LIBRARY_PATHprepends
TIDL_TOOLS_PATHsolibvx_tidl_rt.soresolvesARM64_GCC_PATHthe aarch64 GNU toolchain installed by
setup_am62d.shundertools/tidl_tools_package/bin/(override by exporting before sourcing)CGT7X_ROOTthe C7000 code-generation tools installed by
setup_am62d.shundertools/tidl_tools_package/bin/(override by exporting before sourcing)SOCam62d
9.2.1. Data Sets
Accuracy evaluation needs the reference data sets. Compilation alone can run on
random data (for latency-only measurement), but evaluate requires the real
sets. Download them from the repository root:
$ # UrbanSound8K (~5.6 GB) - sound classification (VGGish11, YAMNet)
$ bash examples/audio/scripts/download_urbansound8k.sh
$ # VoiceBank-DEMAND-16k (~2 GB) - speech enhancement (GCRN)
$ python3 examples/audio/scripts/download_voicebank_demand.py
They land under data/datasets/UrbanSound8K/ and
data/datasets/VoiceBank-DEMAND-16k/ - the paths the model configs expect.
The classification configs use UrbanSound8K fold 10 (837 samples) as the
test set; the speech-enhancement configs use the VoiceBank-DEMAND-16k test set
(824 files).
The reference ONNX models auto-download at compile time via .link files, so
fetching them ahead of time is optional. To pre-download all reference ONNX models:
$ bash examples/audio/scripts/download_audio_models.sh
9.3. Compile and evaluate
Each model has one config that drives all stages. All four run under the
tidlrunner-am62d environment with devices/am62d_env.sh already sourced
(see Setup). Three models compile to the C7™ NPU through the TVM runtime.
The AM62D config paths are:
Model |
Model ID |
Runtime |
Tensor Bits |
Config path (relative to |
|---|---|---|---|---|
VGGish11 |
|
TVM-RT |
8 |
|
YAMNet |
|
TVM-RT |
8 |
|
GCRN |
|
TVM-RT |
16 (LSTM), FP32 (Enc/Dec) |
|
9.3.1. VGGish11 (TVM-RT, 8-bit)
Runs on the C7™ NPU (tidl_offload: true):
$ CFG=data/configs/samples/models/audio/audio_classification/urbansound8k/vggish11_tvmrt_config.yaml
$ tidlrunner-cli compile --config_path $CFG
$ tidlrunner-cli infer --config_path $CFG
$ tidlrunner-cli evaluate --config_path $CFG
evaluate reports top-1 / top-5 / macro-F1 over UrbanSound8K fold 10.
9.3.2. YAMNet (TVM-RT, 8-bit)
$ CFG=data/configs/samples/models/audio/audio_classification/urbansound8k/yamnet_tvmrt_config.yaml
$ tidlrunner-cli compile --config_path $CFG
$ tidlrunner-cli infer --config_path $CFG
$ tidlrunner-cli evaluate --config_path $CFG
9.3.3. GCRN (TVM-RT, 16-bit)
GCRN is C7™ NPU-offloaded at 16-bit (tidl_offload: true, fixed 4-second
input):
$ CFG=data/configs/samples/models/audio/speech_enhancement/voicebank_demand_16k/gcrn_fixed_4sec_tvmrt_config.yaml
$ tidlrunner-cli compile --config_path $CFG
$ tidlrunner-cli infer --config_path $CFG
$ tidlrunner-cli evaluate --config_path $CFG
evaluate reports PESQ / STOI / SI-SDR over the VoiceBank-DEMAND-16k test set.