Hugging Face's logo Hugging Face
  • Models
  • Datasets
  • Spaces
  • Buckets new
  • Docs
  • Enterprise
  • Pricing
    • Website
      • Tasks
      • HuggingChat
      • Collections
      • Languages
      • Organizations
    • Community
      • Blog
      • Posts
      • Daily Papers
      • Learn
      • Discord
      • Forum
      • GitHub
    • Solutions
      • Team & Enterprise
      • Hugging Face PRO
      • Enterprise Support
      • Inference Providers
      • Inference Endpoints
      • Storage Buckets

  • Log In
  • Sign Up

cudabenchmarktest
/
stable-audio-open-1.0

Text-to-Audio
Stable Audio Tools
Diffusers
Safetensors
latent-diffusion
stereo
44100hz
Model card Files Files and versions
xet
Community

Instructions to use cudabenchmarktest/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 cudabenchmarktest/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("cudabenchmarktest/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
stable-audio-open-1.0 / transformer
4.23 GB
Ctrl+K
Ctrl+K
  • 1 contributor
History: 1 commit
cudabenchmarktest's picture
cudabenchmarktest
Add files using upload-large-folder tool
35537b3 verified 5 days ago
  • config.json
    391 Bytes
    Add files using upload-large-folder tool 5 days ago
  • diffusion_pytorch_model.safetensors
    4.23 GB
    xet
    Add files using upload-large-folder tool 5 days ago