This app will launch a gradio webserver to interact with Meta MusicGen and AudioGen models using AudioCraft.
Overview
An Open OnDemand Batch Connect app that launches a Gradio web interface for Meta's AudioCraft framework as an interactive web server session on HPC clusters. AudioCraft provides state-of-the-art audio generation models including MusicGen and AudioGen.
This app uses the Batch Connect basic template to run a Gradio web server
on a compute node. The server is launched via app.py and reverse-proxied
through Open OnDemand.
Developed by the Wake Forest University (WFU) HPC Team. Primary Contact: Sean Anderson (anderss@wfu.edu)
- Upstream project: AudioCraft
- Web framework: Gradio
- Batch Connect template:
basic - Scheduler: Slurm
- Cluster: DEAC
Screenshots
Features
- Launches a Gradio web server for AudioCraft music and audio generation on
compute nodes via Batch Connect
basictemplate - Interact with Meta MusicGen and AudioGen models through a web browser
- Configurable
AUDIOCRAFT_CACHE_DIRfor model download and storage location - Configurable Slurm account, partition, node type, cores, memory, and GPUs via the launch form
- Working directory selector
- Optional additional environment modules can be loaded at launch time
- Deploy on both CPU and GPU compute nodes
- Module loaded at runtime:
envs/audiocraft
Requirements
- Python 3.9+
- NVIDIA Compute Capable 7.0 GPU (NVIDIA V100) or better.
- FFmpeg (Optional)
Compute Node Software
- AudioCraft Python environment available as an environment module
(currently
envs/audiocraft) - Environment Modules with init at
/usr/share/Modules/init/bash - Python 3 with Gradio, AudioCraft, and their dependencies installed in the module environment
- GPU recommended for audio generation workloads
Open OnDemand
- Slurm scheduler
App Installation
1. Clone the repository
cd /var/www/ood/apps/sys
git clone https://github.com/WFU-HPC/OOD-apps.server.gradio-audiocraft.git
cd OOD-apps.server.gradio-audiocraft
2. Set up the AudioCraft environment
Make this environment available as an environment module (e.g.,
envs/audiocraft), or update script.sh.erb to activate it directly.
3. Configure for your site
Edit form.yml.erb and update these values for your cluster:
| Attribute | WFU Default | Change to |
|---|---|---|
cluster |
"deac" |
Your cluster name |
accounts |
WFU Slurm accounts | Your Slurm accounts |
queues |
"ondemand" |
Your Slurm partition |
node_type |
WFU-specific node types | Node types on your cluster |
You will also need to update submit.yml.erb if your cluster uses different
Slurm constraint names or node configurations.
In script.sh.erb, the app loads the module with:
module load envs/audiocraft
Ensure an equivalent module is available on your system.
4. Verify
No OOD restart is needed (Batch Connect apps are detected automatically). Visit your OOD dashboard and look for AudioCraft Appverse under Appverse Appss.
Configuration
form.yml.erb attributes
| Attribute | Widget | Description | Default |
|---|---|---|---|
enable_extra_modules |
check_box | Toggle extra module loading | unchecked |
extra_modules |
text_field | Additional environment modules to load | "" |
working_dir |
path_selector | Working directory for the session | User's $HOME |
accounts |
select | Slurm account for job submission | (dynamic from cluster) |
queues |
select | Slurm partition | "ondemand" |
bc_num_hours |
number | Maximum wall time (hours) | 1 |
num_cores |
number_field | Number of CPU cores | 1 |
memory |
number_field | Memory in GB | 8 |
node_type |
select | Compute node type (CPU, GPU, specific HW) | Any (shortest wait) |
num_gpus |
number_field | Number of GPUs (for GPU node types) | 0 |
audiocraft_path |
text_field | Custom AUDIOCRAFT_CACHE_DIR for model storage |
"" |
enable_audiocraft_path |
check_box | Toggle custom AudioCraft cache directory | unchecked |
Troubleshooting
Testing
| Site | OOD Version | Scheduler | Status |
|---|---|---|---|
| Wake Forest University (DEAC) | 4.1.1 | Slurm | Deployed |
Known Limitations
Contributing
Contributions are welcome. To contribute:
- Fork this repository
- Create a feature branch (
git checkout -b feature/my-improvement) - Submit a pull request with a description of your changes
For bugs or feature requests, open an issue.
References
- AudioCraft -- Meta's audio generation framework (MusicGen, AudioGen)
- AudioCraft MusicGen demo -- the upstream demo script this app is based on
- Gradio -- the web UI framework used for the interface
- Open OnDemand -- the HPC portal framework
- OOD Batch Connect app development docs
Software Installation
Install FFMPeg
Create a Python environment with the required packages:
python3 -m venv ${HOME}/env-audiocraft
. ${HOME}/env-audiocraft/bin/activate
python3 -m pip install -r requirements.txt
Clone the AudioCraft repository and install audiocraft locally.
git clone https://github.com/facebookresearch/audiocraft.git
cd audiocraft/
pip install -e .
Sample Module Files
AudioCraft Environment
#%Module
##
## Python environment for AudioCraft
proc ModulesHelp { } {
puts stderr "\tSets up a Python Environment to deploy AudioCraft applications with Gradio."
}
module-whatis "Sets up a Python Environment to deploy AudioCraft applications with Gradio."
module load utils/ffmpeg/7.1
set environment "audiocraft"
set basedir "/opt/envs"
################################################################################
################################################################################
source-sh bash "${basedir}/${environment}/bin/activate"
FFmpeg
#%Module
##
proc ModulesHelp { } {
puts stderr "\tSets up environment for using FFmpeg."
}
module-whatis "Sets up environment for using FFmpeg"
set version "7.1"
set basedir "/opt/ffmpeg/$version"
################################################################################
################################################################################
prepend-path PATH $basedir/bin
prepend-path MANPATH $basedir/share/man
prepend-path LD_LIBRARY_PATH $basedir/lib
prepend-path LIBRARY_PATH $basedir/lib
prepend-path C_INCLUDE_PATH $basedir/include
prepend-path CPLUS_INCLUDE_PATH $basedir/include
prepend-path INCLUDE $basedir/include
prepend-path PKG_CONFIG_PATH $basedir/lib/pkgconfig
prepend-path PATH $basedir/ext/bin
prepend-path LD_LIBRARY_PATH $basedir/ext/lib
prepend-path LIBRARY_PATH $basedir/ext/lib
prepend-path C_INCLUDE_PATH $basedir/ext/include
prepend-path CPLUS_INCLUDE_PATH $basedir/ext/include
prepend-path INCLUDE $basedir/ext/include
prepend-path PKG_CONFIG_PATH $basedir/ext/lib/pkgconfig