Instructions to use facebook/musicgen-small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use facebook/musicgen-small with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-to-audio", model="facebook/musicgen-small")# Load model directly from transformers import AutoProcessor, AutoModelForTextToWaveform processor = AutoProcessor.from_pretrained("facebook/musicgen-small") model = AutoModelForTextToWaveform.from_pretrained("facebook/musicgen-small") - Notebooks
- Google Colab
- Kaggle
Android + OpenCL implementation β text-to-music on-device on non-flagship phones (Adreno 6xx)
#36
by a8nova - opened
Hi! I wanted to share an Android + OpenCL implementation of MusicGen-small, in case anyone wants to run it on a phone:
- Try it: Edgi on Google Play β runs fully on-device, no cloud.
- Open source: the app is built on top of the open-source adreno-llms inference engine β https://github.com/a8nova/adreno-llms β pure C++/OpenCL with hand-written kernels tuned for Adreno, running the full T5 + token LM + EnCodec pipeline on the GPU.
It's tuned and tested on Adreno 6xx GPUs β the GPU class in mid-range and older Android phones (verified on a 2020 Motorola Razr / Adreno 620) β and should run on most arm64 Android phones with OpenCL, though the optimizations are Adreno-specific. On the Adreno 620 (an entry-tier GPU) it decodes at ~11 tok/s β a 5 s clip takes ~34 s wall; faster Adreno tiers close the gap toward real time.
Hope it's useful β happy to answer questions!