Tango 2: Aligning Diffusion-based Text-to-Audio Generative Models through Direct Preference Optimization
🎵 We developed
Tango 2
building upon
Tango
for text-to-audio generation. Tango 2 was initialized with the Tango-full-ft checkpoint and underwent alignment training using DPO on audio-alpaca, a pairwise text-to-audio preference dataset. 🎶
Please follow the instructions in the repository for installation, usage and experiments.
Quickstart Guide
Download the
Tango 2
model and generate audio from a text prompt:
import IPython
import soundfile as sf
from tango import Tango
tango = Tango("declare-lab/tango2")
prompt = "An audience cheering and clapping"
audio = tango.generate(prompt)
sf.write(f"{prompt}.wav", audio, samplerate=16000)
IPython.display.Audio(data=audio, rate=16000)
The model will be automatically downloaded and saved in cache. Subsequent runs will load the model directly from cache.
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.
Use the
generate_for_batch
function to generate multiple audio samples for a batch of text prompts:
prompts = [
"A car engine revving",
"A dog barks and rustles with some clicking",
"Water flowing and trickling"
]
audios = tango.generate_for_batch(prompts, samples=2)
This will generate two samples for each of the three text prompts.
Runs of declare-lab tango2 on huggingface.co
87
Total runs
2
24-hour runs
-1
3-day runs
4
7-day runs
24
30-day runs
More Information About tango2 huggingface.co Model
tango2 huggingface.co is an AI model on huggingface.co that provides tango2's model effect (), which can be used instantly with this declare-lab tango2 model. huggingface.co supports a free trial of the tango2 model, and also provides paid use of the tango2. Support call tango2 model through api, including Node.js, Python, http.
tango2 huggingface.co is an online trial and call api platform, which integrates tango2's modeling effects, including api services, and provides a free online trial of tango2, you can try tango2 online for free by clicking the link below.
declare-lab tango2 online free url in huggingface.co:
tango2 is an open source model from GitHub that offers a free installation service, and any user can find tango2 on GitHub to install. At the same time, huggingface.co provides the effect of tango2 install, users can directly use tango2 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.