Instructions to use sammoran-phd/cara-native-stable-audio with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Stable Audio Tools
How to use sammoran-phd/cara-native-stable-audio 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("sammoran-phd/cara-native-stable-audio") 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
| { | |
| "format": "cara_source_snapshot_v1", | |
| "git_remote": "https://github.com/sammoran78/cara-native-stable-audio.git", | |
| "git_head": "3241adba4fc2a85cf5b29d9eb68d42f40a28e820", | |
| "worktree_clean": false, | |
| "worktree_status": [ | |
| "M .gitignore", | |
| " M stable_audio_tools/models/diffusion.py", | |
| " M stable_audio_tools/training/diffusion.py", | |
| " M stable_audio_tools/training/factory.py", | |
| "?? CARA_NATIVE_STABLE_AUDIO_INTEGRATION_LOG.md", | |
| "?? azureml/", | |
| "?? docs/CARA_NATIVE_STABLE_AUDIO_PHASE2_RUNBOOK.md", | |
| "?? huggingface/", | |
| "?? outputs/", | |
| "?? scripts/benchmark_cara_native_stable_audio.py", | |
| "?? scripts/benchmark_cara_native_stable_audio_fixed.py", | |
| "?? scripts/expand_cara_native_checkpoint.py", | |
| "?? scripts/extract_cara_probe_features.py", | |
| "?? scripts/prompt_semantic_ablation.py", | |
| "?? scripts/reconcile_cara_family_metrics.py", | |
| "?? scripts/train_cara_native_stable_audio.py", | |
| "?? scripts/verify_cara_native_preflight.py", | |
| "?? stable_audio_tools/cara/", | |
| "?? tests/" | |
| ], | |
| "source_archive": "cara-native-stable-audio-source.tar.gz", | |
| "source_archive_sha256": "de33b733bf422b58b14756047ba0a904487d9bc7a89762e6a4972f551908909a", | |
| "note": "The archive is authoritative when worktree_clean is false." | |
| } | |