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
Cannot access gated repo
I have access to the model since I filled out the form, but how do I implement it?
Do I have access and do I already have the token as added to this library (get_pretrained_model)?
!pip install huggingface_hub
!python -c "from huggingface_hub.hf_api import HfFolder; HfFolder.save_token('token_hf')"
get_pretrained_model
I'm also having this issue. I can't find where the code authenticates you; does it? Quite new to Python as well.
@CoolScratcher and @NickyNicky check alreay share the Space on Zero GPU so from that you get some insights ,
@NickyNicky Generate a HF access token and use huggingface-cli login
nice
@NickyNicky Generate a HF access token and use
huggingface-cli login
I can access it from browser and i dont wanna edit the source files. Is there any solution or workaround for this error? Tried with proxy, tried multiple times.
Got the same problem, any solutions yet?
I was able to use from huggingface_hub import loginhelp(login)
But now I get a different error with run_gradio.py
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
Need some accepted way to load model locally. Right now, I noticed a new folder named blob appeared in ~/.cache/huggingface/hub/models--stabilityai--stable-audio-open-1.0
Inside blob/ I found a file somethingsomething.incomplete that was increasing in size.
I stopped run_gradio.py and copied the already-downloaded model.safetensors to blobs/somethingsomething.incomplete
Re-ran run_gradio.pyand now I get the feeling it would work. Except, my video card doesn't have 'nuff memory (4 GiB).
use export/set HUGGING_FACE_HUB_TOKEN={your huggingface token}
get a key with the right permissions.
for python:
import os
WANDB_API_KEY = "e25452a211e677731ae0ea1ca4csausagehead"
os.environ["WANDB_API_KEY"] = WANDB_API_KEY
Shell Commands
Unix (Bash): export WANDB_API_KEY="e25452a211e677731ae0ea1ca4csausagehead"
Windows CMD: set WANDB_API_KEY=e25452a211e677731ae0ea1ca4csausagehead
Windows PowerShell: $env:WANDB_API_KEY = "e25452a211e677731ae0ea1ca4csausagehead"
