Skip to content

Commit 4315638

Browse files
Merge pull request #2158 from mhall119/stability-fixes
Updates to Stable Open Audio Small learning path
2 parents c4effd7 + e035234 commit 4315638

5 files changed

Lines changed: 41 additions & 16 deletions

File tree

content/learning-paths/mobile-graphics-and-gaming/run-stable-audio-open-small-with-lite-rt/1-prerequisites.md

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ In this Learning Path, you'll learn how to convert the Stable Audio Open Small m
1212

1313
Your first task is to prepare a development environment with the required software:
1414

15-
- Android NDK: version r25b or newer.
15+
- Android NDK: version r27b or newer.
1616
- Python: version 3.10 or newer (tested with 3.10).
1717
- CMake: version 3.16.0 or newer (tested with 3.28.1).
1818

@@ -33,9 +33,7 @@ Download and install [Python version 3.10](https://www.python.org/downloads/rele
3333

3434
{{< tabpane code=true >}}
3535
{{< tab header="Linux">}}
36-
sudo add-apt-repository ppa:deadsnakes/ppa
37-
sudo apt update
38-
sudo apt install python3.10 python3.10-venv python3.10-pip
36+
sudo apt install -y python3.10 python3.10-venv
3937
{{< /tab >}}
4038
{{< tab header="MacOS">}}
4139
brew install python@3.10
@@ -56,7 +54,7 @@ CMake is an open-source tool that automates the build process for software proje
5654
{{< tabpane code=true >}}
5755
{{< tab header="Linux">}}
5856
sudo apt update
59-
sudo apt install cmake
57+
sudo apt install cmake g++ git
6058
{{< /tab >}}
6159
{{< tab header="MacOS">}}
6260
brew install cmake
@@ -98,33 +96,57 @@ You can verify the installation and check the version with:
9896
bazel --version
9997
```
10098

101-
### Install Android NDK
99+
### Install Android SDK and NDK
100+
101+
To build a native Android application you will need to install the Android SDK:
102+
103+
{{< tabpane code=true >}}
104+
{{< tab header="Linux">}}
105+
cd $WORKSPACE
106+
sudo apt install openjdk-21-jdk openjdk-21-jre unzip
107+
wget https://dl.google.com/android/repository/commandlinetools-linux-13114758_latest.zip
108+
unzip -o commandlinetools-linux-13114758_latest.zip
109+
mkdir -p $WORKSPACE/Android/Sdk
110+
export ANDROID_HOME=$WORKSPACE/Android
111+
export ANDROID_SDK_HOME=$ANDROID_HOME/Sdk
112+
$WORKSPACE/cmdline-tools/bin/sdkmanager --sdk_root=$ANDROID_SDK_HOME --install "platform-tools" "platforms;android-35" "build-tools;35.0.0"
113+
{{< /tab >}}
114+
{{< tab header="MacOS">}}
115+
cd $WORKSPACE
116+
wget https://dl.google.com/android/repository/commandlinetools-mac-13114758_latest.zip
117+
unzip -o commandlinetools-linux-13114758_latest.zip
118+
mkdir -p $WORKSPACE/Android/Sdk
119+
export ANDROID_HOME=$WORKSPACE/Android
120+
export ANDROID_SDK_HOME=$ANDROID_HOME/Sdk
121+
$WORKSPACE/cmdline-tools/bin/sdkmanager --sdk_root=$ANDROID_SDK_HOME --install "platform-tools" "platforms;android-35" "build-tools;35.0.0"
122+
{{< /tab >}}
123+
{{< /tabpane >}}
102124

103125
To run the model on Android, install Android Native Development Kit (Android NDK):
104126

105127
{{< tabpane code=true >}}
106128
{{< tab header="Linux">}}
107129
cd $WORKSPACE
108-
wget https://dl.google.com/android/repository/android-ndk-r25b-linux.zip
109-
unzip android-ndk-r25b-linux.zip
130+
wget https://dl.google.com/android/repository/android-ndk-r27b-linux.zip
131+
unzip android-ndk-r27b-linux.zip
110132
{{< /tab >}}
111133
{{< tab header="MacOS">}}
112134
cd $WORKSPACE
113-
wget https://dl.google.com/android/repository/android-ndk-r25b-darwin.zip
114-
unzip android-ndk-r25b-darwin.zip
135+
wget https://dl.google.com/android/repository/android-ndk-r27b-darwin.zip
136+
unzip android-ndk-r27b-darwin.zip
115137
{{< /tab >}}
116138
{{< /tabpane >}}
117139

118140
For easier access and execution of Android NDK tools, add these to the `PATH` and set the `NDK_PATH` variable:
119141

120142
{{< tabpane code=true >}}
121143
{{< tab header="Linux">}}
122-
export NDK_PATH=$WORKSPACE/android-ndk-r25b/
144+
export NDK_PATH=$WORKSPACE/android-ndk-r27b/
123145
export ANDROID_NDK_HOME=$NDK_PATH
124146
export PATH=$NDK_PATH/toolchains/llvm/prebuilt/linux-x86_64/bin/:$PATH
125147
{{< /tab >}}
126148
{{< tab header="MacOS">}}
127-
export NDK_PATH=$WORKSPACE/android-ndk-r25b/
149+
export NDK_PATH=$WORKSPACE/android-ndk-r27b/
128150
export ANDROID_NDK_HOME=$NDK_PATH
129151
export PATH=$NDK_PATH/toolchains/llvm/prebuilt/darwin-x86_64/bin/:$PATH
130152
{{< /tab >}}

content/learning-paths/mobile-graphics-and-gaming/run-stable-audio-open-small-with-lite-rt/2-testing-model.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ You may need to fill out a form with your contact information to use the model:
2323
Download and copy the configuration file `model_config.json` and the model itself, `model.ckpt`, to your workspace directory, and verify they exist by running the command:
2424

2525
```bash
26-
ls $WORKSPACE/model_config.json $WORKSPACE/model.ckpt
26+
ls -lha $WORKSPACE/model_config.json $WORKSPACE/model.ckpt
2727
```
2828

2929
You can learn more about this model [here](https://huggingface.co/stabilityai/stable-audio-open-small).

content/learning-paths/mobile-graphics-and-gaming/run-stable-audio-open-small-with-lite-rt/3-converting-model.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ To avoid dependency issues, create a virtual environment. For example, you can u
3535
cd $WORKSPACE
3636
python3.10 -m venv .venv
3737
source .venv/bin/activate
38+
export PYTHON_BIN_PATH=$WORKSPACE/.venv/bin/python3
39+
export PYTHON_LIB_PATH=$WORKSPACE/.venv/lib/python3.10/site-packages
3840
```
3941

4042
## Clone the examples repository

content/learning-paths/mobile-graphics-and-gaming/run-stable-audio-open-small-with-lite-rt/5-creating-simple-program-for-android.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,13 @@ From there, you can then run the audiogen application, which requires just three
8181
* **Model Path:** The directory containing your LiteRT models and spiece.model files
8282
* **Prompt:** A text description of the desired audio (e.g., warm arpeggios on house beats 120BPM with drums effect)
8383
* **CPU Threads:** The number of CPU threads to use (e.g., 4)
84+
* **Seed:** A random number to seed the generation (e.g. 1234)
8485

8586
Play around with the advice from [Download and test the model](../2-testing-model) section.
8687

8788
```bash
8889
cd /data/local/tmp/app
89-
LD_LIBRARY_PATH=. ./audiogen . "warm arpeggios on house beats 120BPM with drums effect" 4
90+
LD_LIBRARY_PATH=. ./audiogen . "warm arpeggios on house beats 120BPM with drums effect" 4 1234
9091
exit
9192
```
9293

content/learning-paths/mobile-graphics-and-gaming/run-stable-audio-open-small-with-lite-rt/_index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ learning_objectives:
1313
- Run the application on an Android smartphone and generate an audio snippet.
1414

1515
prerequisites:
16-
- A Linux-based x86 or macOS development machine with at least 8 GB of RAM (tested on Ubuntu 20.04.4 LTS with x86_64).
16+
- A Linux-based x86 or macOS development machine with at least 8 GB of RAM and 50 GB of disk space (tested on Ubuntu 22.04 with x86_64).
1717
- A [HuggingFace](https://huggingface.co/) account.
18-
- An Android phone and a cable to connect it to your development machine.
18+
- An Android phone in [developer mode](https://developer.android.com/studio/debug/dev-options) and a cable to connect it to your development machine.
1919

2020
author:
2121
- Nina Drozd

0 commit comments

Comments
 (0)