declare-lab-sutd
commited on
Commit
•
a38ae9e
1
Parent(s):
bf778ea
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,55 @@
|
|
1 |
---
|
2 |
license: cc-by-nc-4.0
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: cc-by-nc-4.0
|
3 |
---
|
4 |
+
# TANGO: Text to Audio using iNstruction-Guided diffusiOn
|
5 |
+
|
6 |
+
**TANGO** is a latent diffusion model for text to audio generation. **TANGO** can generate realistic audios including human sounds, animal sounds, natural and artificial sounds and sound effects from textual prompts. We use the frozen instruction-tuned LLM Flan-T5 as the text encoder and train a UNet based diffusion model for audio generation. We outperform current state-of-the-art models for audio generation across both objective and subjective metrics. We release our model, training, inference code and pre-trained checkpoints for the research community.
|
7 |
+
|
8 |
+
## Code
|
9 |
+
|
10 |
+
Our code is released here: [https://github.com/declare-lab/tango](https://github.com/declare-lab/tango)
|
11 |
+
|
12 |
+
Please follow the instructions in the repository for installation, usage and experiments.
|
13 |
+
|
14 |
+
## Quickstart Guide
|
15 |
+
|
16 |
+
Download the **TANGO** model and generate audio from a text prompt:
|
17 |
+
|
18 |
+
```python
|
19 |
+
import IPython
|
20 |
+
import soundfile as sf
|
21 |
+
from tango import Tango
|
22 |
+
|
23 |
+
tango = Tango("declare-lab/tango")
|
24 |
+
|
25 |
+
prompt = "An audience cheering and clapping"
|
26 |
+
audio = tango.generate(prompt)
|
27 |
+
sf.write(f"{prompt}.wav", audio, samplerate=16000)
|
28 |
+
IPython.display.Audio(data=audio, rate=16000)
|
29 |
+
```
|
30 |
+
[CheerClap.webm](https://user-images.githubusercontent.com/13917097/233851915-e702524d-cd35-43f7-93e0-86ea579231a7.webm)
|
31 |
+
|
32 |
+
The model will be automatically downloaded and saved in cache. Subsequent runs will load the model directly from cache.
|
33 |
+
|
34 |
+
The `generate` function uses 100 steps by default to sample from the latent diffusion model. We recommend using 200 steps for generating better quality audios. This comes at the cost of increased run-time.
|
35 |
+
|
36 |
+
```python
|
37 |
+
prompt = "Rolling thunder with lightning strikes"
|
38 |
+
audio = tango.generate(prompt, steps=200)
|
39 |
+
IPython.display.Audio(data=audio, rate=16000)
|
40 |
+
```
|
41 |
+
[Thunder.webm](https://user-images.githubusercontent.com/13917097/233851929-90501e41-911d-453f-a00b-b215743365b4.webm)
|
42 |
+
|
43 |
+
<!-- [MachineClicking](https://user-images.githubusercontent.com/25340239/233857834-bfda52b4-4fcc-48de-b47a-6a6ddcb3671b.mp4 "sample 1") -->
|
44 |
+
|
45 |
+
Use the `generate_for_batch` function to generate multiple audio samples for a batch of text prompts:
|
46 |
+
|
47 |
+
```python
|
48 |
+
prompts = [
|
49 |
+
"A car engine revving",
|
50 |
+
"A dog barks and rustles with some clicking",
|
51 |
+
"Water flowing and trickling"
|
52 |
+
]
|
53 |
+
audios = tango.generate_for_batch(prompts, samples=2)
|
54 |
+
```
|
55 |
+
This will generate two samples for each of the three text prompts.
|