Generate audio with Stable Audio Open Small using ExecuTorch
Introduction
Set up your development environment
Download the Stable Audio Open Small model
Convert the model to ExecuTorch format
Build and run on macOS
Build and run on Android
Next Steps
Generate audio with Stable Audio Open Small using ExecuTorch
Overview
In this Learning Path, you will learn how to convert the Stable Audio Open Small model to ExecuTorch (.pte) format, then build an audio generation application to run on Android or macOS. ExecuTorch is a PyTorch framework designed for on-device inference on edge and mobile devices.
Identify requirements
Before you begin, you need a development environment with the required software:
- An Android device with an Arm CPU supporting FEAT_DotProd (dotprod) and optionally FEAT_I8MM (i8mm), with at least 8 GB of RAM
- Python 3.10 or newer
- CMake version 3.16.0 or newer
- Android NDK r27c (if building for Android)
Create workspace directory
Create a workspace directory to manage the dependencies and repositories.
Export the WORKSPACE variable to point to this directory:
mkdir my-workspace
export WORKSPACE=$PWD/my-workspace
cd $WORKSPACE
Install Python 3.10
Install Python 3.10 or newer for compatibility with the required packages:
sudo apt install -y python3.10 python3.10-venv
brew install python@3.10
brew link python@3.10 --force
Verify the installation:
python3 --version
The output is similar to:
Python 3.10.19
Install CMake
Install CMake to automate the build process for the audio generation application:
sudo apt update
sudo apt install cmake g++ git
brew install cmake
Verify the installation:
cmake --version
The output is similar to:
cmake version 4.2.1
See the CMake install guide for additional help.
Clone the ML examples repository
Clone the Arm ML examples repository, which contains the scripts and application code:
cd $WORKSPACE
git clone https://github.com/Arm-Examples/ML-examples.git
cd ML-examples/kleidiai-examples/audiogen-et/
What you’ve accomplished and what’s next
Your development environment is ready with Python 3.10, CMake, and the ML examples repository. In the next section, you’ll download the Stable Audio Open Small model from Hugging Face.