Instructions to use stabilityai/stable-audio-open-1.0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Stable Audio Tools
How to use stabilityai/stable-audio-open-1.0 with Stable Audio Tools:
import torch import torchaudio from einops import rearrange from stable_audio_tools import get_pretrained_model from stable_audio_tools.inference.generation import generate_diffusion_cond device = "cuda" if torch.cuda.is_available() else "cpu" # Download model model, model_config = get_pretrained_model("stabilityai/stable-audio-open-1.0") sample_rate = model_config["sample_rate"] sample_size = model_config["sample_size"] model = model.to(device) # Set up text and timing conditioning conditioning = [{ "prompt": "128 BPM tech house drum loop", }] # Generate stereo audio output = generate_diffusion_cond( model, conditioning=conditioning, sample_size=sample_size, device=device ) # Rearrange audio batch to a single sequence output = rearrange(output, "b d n -> d (b n)") # Peak normalize, clip, convert to int16, and save to file output = output.to(torch.float32).div(torch.max(torch.abs(output))).clamp(-1, 1).mul(32767).to(torch.int16).cpu() torchaudio.save("output.wav", output, sample_rate) - Notebooks
- Google Colab
- Kaggle
Dependency issue when installing stable audio tools
#34
by deleted - opened
PyTorch is 2.0.0 and Torch Audio is the latest.
When I tried pip install stable-audio-tools it showed up in the terminal as below:
INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.
how can i solve this problem
+1
you just wait. and it will go through the list. or in the requirements.txt you put more exacting versions.
if you type
pip freeze > freeze.txt
then you can get a sense of what that current python actually has installed by reading through the freeze.txt
torch==2.1.0+cu121
torch-stoi==0.2.1
torchaudio==2.1.0
torchdata==0.7.0
torchdiffeq==0.2.4
torchlibrosa==0.1.0
torchmetrics==0.11.4
torchsde==0.2.6
torchtext==0.16.0
torchvision==0.16.0+cu121
is a snip from mine.