ThinkSound
🌐 English | 简体中文 | 繁體中文 | Español | Français | 日本語
如果您覺得這個項目有幫助,
歡迎在 GitHub 上給予星標 ⭐ 支持!
ThinkSound 是一個統一的 Any2Audio 生成框架,利用鏈式思維(Chain-of-Thought, CoT)推理引導的流匹配技術。 PyTorch 實現多模態音訊生成與編輯:由影片、文字和音訊生成或編輯音訊,結合多模態大型語言模型(MLLMs)逐步推理技術。
📰 最新消息
- 2025.09.19 🎉 ThinkSound 已被 NeurIPS 2025 主會議 接收!
- 2025.09.01 🔥 我們的 AudioCoT 資料集已開源並可於 Hugging Face 取得!
- 2025.07.17 🧠 支援微調:訓練與微調程式碼現已公開,並附有詳細使用教學,協助您以自有資料自訂與擴充 ThinkSound。
- 2025.07.15 📦 安裝與使用更簡易:依賴包已上傳至 PyPI,便於跨平台安裝;Windows
.bat腳本自動建立環境及執行腳本。 - 2025.07.08 🔧 重大更新:模型精簡並優化記憶體及 GPU 使用,現支援大規模高吞吐量音訊生成!
- 2025.07.01 🔥Hugging Face Spaces 及 ModelScope 線上互動展示已上線!
- 2025.07.01 🔥推論腳本與網頁介面已釋出;
- 2025.06 🔥ThinkSound 論文 已發表於 arXiv!
- 2025.06 🔥線上 Demo 上線 - 現可即時體驗!
🚀 特色功能
- Any2Audio:可由任意模態——影片、文字、音訊或其組合生成音訊。
- Video-to-Audio SOTA:於多項 V2A 基準數據集達到最新技術水準。
- CoT 推理驅動:透過 MLLMs 進行可組合且可控的音訊生成鏈式推理。
- 互動式物件導向編輯:可點選視覺物件或輸入文字指令細緻編輯特定音訊事件。
- 統一框架:單一基礎模型支援生成、編輯與互動式工作流。
✨ 方法總覽
ThinkSound 將音訊生成與編輯流程拆分為三個互動階段,皆由基於 MLLM 的鏈式推理(CoT)引導:
- Foley 生成: 從影片生成具語意及時間對齊的基礎音景。
- 物件導向細化: 透過點擊或選取影片區域,細化或新增使用者指定物件的音效。
- 目標式音訊編輯: 利用高階自然語言指令修改已生成音訊。
⚡ 快速開始
環境準備:
git clone https://github.com/liuhuadai/ThinkSound.git
cd ThinkSound
conda create -n thinksound python=3.10
conda activate thinksound
pip install thinksound
conda install -y -c conda-forge 'ffmpeg<7'
Download pretrained weights https://huggingface.co/liuhuadai/ThinkSound to Directory ckpts/
model weights can be also downloaded from https://www.modelscope.cn/models/iic/ThinkSound
git lfs install
git clone https://huggingface.co/liuhuadai/ThinkSound ckpts
To improve inference and training speed, you may optionally install a FlashAttention backend compatible with your system and PyTorch version.
✅ Windows 提示:
Windows 使用者只需執行 setup_windows.bat(或雙擊它)即可自動建立 conda 環境、安裝所有依賴(包括 FFmpeg),並下載預訓練模型——無需手動設置。
在執行腳本前,請確保conda和git已經安裝並且可在系統 PATH 中使用。
▶️ 執行示範
#### Linux/macOS
chmod +x scripts/demo.sh
./scripts/demo.sh [use-half]
#### Windows您也可以改用提供的 .bat 腳本:
.\scripts\demo.bat [use-half]
注意::單一影片的路徑[use-half](可選):在結尾加上 use-half 以啟用半精度特徵提取。
📦 批次推論
#### Linux/macOS
chmod +x scripts/eval_batch.sh
./scripts/eval_batch.sh [use-half]
#### Windows請使用等效的 .bat 腳本:
.\scripts\eval_batch.bat [use-half]
注意::包含所有待處理 .mp4 影片的根目錄路徑(所有影片必須長度相同)。:每個影片的文字提示 CSV 檔案(格式請參考demo_test.csv)。(可選):產生的音訊儲存位置。預設為results/features。[use-half](可選):最後加上 use-half,可啟用半精度特徵擷取。
網頁介面使用方式
若需互動式操作,可啟動 Gradio 網頁介面:
python app.py🏋️ 訓練模型
請參閱 Training.md
📝 待辦事項與未來規劃
- - [ ] 發佈涵蓋多領域的更強大基礎模型,以提供更具吸引力和沉浸感的擬音創作
- - [ ] 增加對其他模態與下游任務的支援
- - [ ] 發佈不同規模的模型
- - [x] 開源 AudioCoT 數據集與自動化流程
- - [x] 發佈 ThinkSound 模型的訓練腳本
- - [x] 提供適合初學者的 Windows 快速入門 README
📄 授權條款
本專案以 Apache 2.0 授權條款釋出。
注意:
本程式碼、模型與數據集僅供研究與教育用途。
禁止商業使用。
如需商業授權,請聯絡作者。
📦 第三方元件
- Stable Audio Open VAE(由 Stability AI 提供):
- 📘 所有其他程式碼與模型皆採用 Apache License 2.0 釋出。
致謝
特別感謝:
- stable-audio-tools(由 Stability AI 提供):
- MMAudio:
📖 引用
如果您在研究或工作中覺得 ThinkSound 有幫助,請引用我們的論文:
@misc{liu2025thinksoundchainofthoughtreasoningmultimodal,
title={ThinkSound: Chain-of-Thought Reasoning in Multimodal Large Language Models for Audio Generation and Editing},
author={Huadai Liu and Jialei Wang and Kaicheng Luo and Wen Wang and Qian Chen and Zhou Zhao and Wei Xue},
year={2025},
eprint={2506.21448},
archivePrefix={arXiv},
primaryClass={eess.AS},
url={https://arxiv.org/abs/2506.21448},
}📬 Contact
✨ Feel free to open an issue or contact us via email (liuhuadai@zju.edu.cn) if you have any questions or suggestions!
--- Tranlated By Open Ai Tx | Last indexed: 2025-10-04 ---