Update README.md
Browse files
README.md
CHANGED
@@ -34,57 +34,7 @@ This version was finetuned by twobob from  library
|
39 |
-
|
40 |
-
|
41 |
-
### Using with `stable-audio-tools`
|
42 |
-
|
43 |
-
This model is made to be used with the [`stable-audio-tools`](https://github.com/Stability-AI/stable-audio-tools) library for inference, for example:
|
44 |
-
|
45 |
-
```python
|
46 |
-
import torch
|
47 |
-
import torchaudio
|
48 |
-
from einops import rearrange
|
49 |
-
from stable_audio_tools import get_pretrained_model
|
50 |
-
from stable_audio_tools.inference.generation import generate_diffusion_cond
|
51 |
-
|
52 |
-
device = "cuda" if torch.cuda.is_available() else "cpu"
|
53 |
-
|
54 |
-
# Download model
|
55 |
-
model, model_config = get_pretrained_model("PsiPi/audio")
|
56 |
-
sample_rate = model_config["sample_rate"]
|
57 |
-
sample_size = model_config["sample_size"]
|
58 |
-
|
59 |
-
model = model.to(device)
|
60 |
-
|
61 |
-
# Set up text and timing conditioning
|
62 |
-
conditioning = [{
|
63 |
-
"prompt": "specialKay vocal, A cappella, 120 BPM twobob house vocalisations feat. Special Kay",
|
64 |
-
"seconds_start": 0,
|
65 |
-
"seconds_total": 30
|
66 |
-
}]
|
67 |
-
|
68 |
-
# Generate stereo audio
|
69 |
-
output = generate_diffusion_cond(
|
70 |
-
model,
|
71 |
-
steps=100,
|
72 |
-
cfg_scale=7,
|
73 |
-
conditioning=conditioning,
|
74 |
-
sample_size=sample_size,
|
75 |
-
sigma_min=0.3,
|
76 |
-
sigma_max=500,
|
77 |
-
sampler_type="dpmpp-3m-sde",
|
78 |
-
device=device
|
79 |
-
)
|
80 |
-
|
81 |
-
# Rearrange audio batch to a single sequence
|
82 |
-
output = rearrange(output, "b d n -> d (b n)")
|
83 |
-
|
84 |
-
# Peak normalize, clip, convert to int16, and save to file
|
85 |
-
output = output.to(torch.float32).div(torch.max(torch.abs(output))).clamp(-1, 1).mul(32767).to(torch.int16).cpu()
|
86 |
-
torchaudio.save("output.wav", output, sample_rate)
|
87 |
-
```
|
88 |
|
89 |
## Using with `diffusers`
|
90 |
|
|
|
34 |
## Usage
|
35 |
|
36 |
This model can be used with:
|
37 |
+
1. the [`diffusers`](https://huggingface.co/docs/diffusers/main/en/index) library
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
## Using with `diffusers`
|
40 |
|