🚀 TangoFlux:基於流匹配和Clap排序偏好優化的超快速且忠實的文本到音頻生成
TangoFlux是一個文本到音頻生成模型,它結合了流匹配和Clap排序偏好優化技術,能夠實現超快速且忠實的文本到音頻轉換。
🚀 快速開始
從我們的GitHub倉庫獲取TangoFlux:
pip install git+https://github.com/declare-lab/TangoFlux
模型將自動下載並保存到緩存中。後續運行將直接從緩存中加載模型。
generate
函數默認使用25步從流模型中採樣。我們建議使用50步來生成更高質量的音頻,但這會增加運行時間。
import torchaudio
from tangoflux import TangoFluxInference
from IPython.display import Audio
model = TangoFluxInference(name='declare-lab/TangoFlux')
audio = model.generate('Hammer slowly hitting the wooden table', steps=50, duration=10)
Audio(data=audio, rate=44100)
✨ 主要特性
- 模型架構:TangoFlux由FluxTransformer塊組成,這些塊是擴散變壓器(DiT)和多模態擴散變壓器(MMDiT),基於文本提示和時長嵌入來生成44.1kHz、最長30秒的音頻。
- 訓練流程:TangoFlux學習由變分自編碼器(VAE)編碼的音頻潛在表示的校正流軌跡。其訓練管道包括三個階段:預訓練、微調和平偏好優化。
- 對齊方式:TangoFlux通過CRPO進行對齊,該方法迭代生成新的合成數據並構建偏好對以進行偏好優化。
📦 安裝指南
可以使用以下命令從GitHub倉庫安裝TangoFlux:
pip install git+https://github.com/declare-lab/TangoFlux
💻 使用示例
基礎用法
import torchaudio
from tangoflux import TangoFluxInference
from IPython.display import Audio
model = TangoFluxInference(name='declare-lab/TangoFlux')
audio = model.generate('Hammer slowly hitting the wooden table', steps=50, duration=10)
Audio(data=audio, rate=44100)
高級用法
import torchaudio
from tangoflux import TangoFluxInference
from IPython.display import Audio
model = TangoFluxInference(name='declare-lab/TangoFlux')
audio = model.generate('A gentle breeze blowing through the trees', steps=100, duration=20)
Audio(data=audio, rate=44100)
📚 詳細文檔
數據集
- cvssp/WavCaps
- declare-lab/CRPO
引用論文
arXiv:2412.21037
@misc{hung2024tangofluxsuperfastfaithful,
title={TangoFlux: Super Fast and Faithful Text to Audio Generation with Flow Matching and Clap-Ranked Preference Optimization},
author={Chia-Yu Hung and Navonil Majumder and Zhifeng Kong and Ambuj Mehrish and Rafael Valle and Bryan Catanzaro and Soujanya Poria},
year={2024},
eprint={2412.21037},
archivePrefix={arXiv},
primaryClass={cs.SD},
url={https://arxiv.org/abs/2412.21037},
}
相關鏈接
📄 許可證
TangoFlux的檢查點僅用於非商業研究用途。它們受Stable Audio Open的許可證、WavCap的許可證以及每個訓練數據集附帶的原始許可證的約束。
此Stability AI模型根據Stability AI社區許可證進行許可,版權所有 © Stability AI Ltd. 保留所有權利。