SOTA Open Source TTS
Update 1.2 sft checkpoints, inference.ipynb and READMEs
Lengyue1d942c8b9738
diff --git a/API_FLAGS.txt b/API_FLAGS.txtindex 36f73e2..4e8b6b7 100644--- a/API_FLAGS.txt+++ b/API_FLAGS.txt@@ -1,6 +1,6 @@# --infer# --api--listen 0.0.0.0:8080 \---llama-checkpoint-path "checkpoints/fish-speech-1.2" \---decoder-checkpoint-path "checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth" \+--llama-checkpoint-path "checkpoints/fish-speech-1.2-sft" \+--decoder-checkpoint-path "checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth" \--decoder-config-name firefly_gan_vqdiff --git a/README.md b/README.mdindex 8f55597..1e2e8ec 100644--- a/README.md+++ b/README.md@@ -1,14 +1,9 @@# Fish Speech-# Warning: We are updating code to fish-speech 1.2, the last stable branch is [1.1.2](https://github.com/fishaudio/fish-speech/tree/v1.1.2)-<div><a target="_blank" href="https://discord.gg/Es5qTB9BcN"><img alt="Discord" src="https://img.shields.io/discord/1214047546020728892?color=%23738ADB&label=Discord&logo=discord&logoColor=white&style=flat-square"/></a>-<a target="_blank" href="http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=jCKlUP7QgSm9kh95UlBoYv6s1I-Apl1M&authKey=xI5ttVAp3do68IpEYEalwXSYZFdfxZSkah%2BctF5FIMyN2NqAa003vFtLqJyAVRfF&noverify=0&group_code=593946093">-<img alt="QQ" src="https://img.shields.io/badge/QQ Group-%2312B7F5?logo=tencent-qq&logoColor=white&style=flat-square"/>-</a><a target="_blank" href="https://hub.docker.com/r/lengyue233/fish-speech"><img alt="Docker" src="https://img.shields.io/docker/pulls/lengyue233/fish-speech?style=flat-square&logo=docker"/></a>@@ -17,42 +12,33 @@</a></div>-This codebase and all models are released under CC-BY-NC-SA-4.0 License. Please refer to [LICENSE](LICENSE) for more details.+[Chinese README](README.zh.md)-此代码库及模型根据 CC-BY-NC-SA-4.0 许可证发布。请参阅 [LICENSE](LICENSE) 了解更多细节.+This codebase and all models are released under CC-BY-NC-SA-4.0 License. Please refer to [LICENSE](LICENSE) for more details.-## Disclaimer / 免责声明+## Disclaimer-We do not hold any responsibility for any illegal usage of the codebase. Please refer to your local laws about DMCA and other related laws.-我们不对代码库的任何非法使用承担任何责任. 请参阅您当地关于 DMCA (数字千年法案) 和其他相关法律法规.+We do not hold any responsibility for any illegal usage of the codebase. Please refer to your local laws about DMCA and other related laws.## Online Demo[Fish Audio](https://fish.audio)-## Quick Start+## Quick Start for Local Inference-[inference.ipynb](https://nbviewer.org/github/AnyaCoder/fish-speech/blob/main/inference.ipynb)+[inference.ipynb](/inference.ipynb)## Videos-#### Demo Video: https://www.bilibili.com/video/BV1wz421B71D+#### V1.2 Demo Video: https://www.bilibili.com/video/BV1wz421B71D-#### Tech slides Video: https://www.bilibili.com/video/BV1zJ4m1K7cj--## Documents / 文档+## Documents- [English](https://speech.fish.audio/en/)- [中文](https://speech.fish.audio/)- [日本語](https://speech.fish.audio/ja/)-## Samples / 例子--- [English](https://speech.fish.audio/en/samples/)-- [中文](https://speech.fish.audio/samples/)-- [日本語](https://speech.fish.audio/ja/samples/)--## Credits / 鸣谢+## Credits- [VITS2 (daniilrobnikov)](https://github.com/daniilrobnikov/vits2)- [Bert-VITS2](https://github.com/fishaudio/Bert-VITS2)@@ -61,19 +47,19 @@ We do not hold any responsibility for any illegal usage of the codebase. Please- [GPT Fast](https://github.com/pytorch-labs/gpt-fast)- [GPT-SoVITS](https://github.com/RVC-Boss/GPT-SoVITS)-## Sponsor / 赞助+## Sponsor<div><a href="https://6block.com/"><img src="https://avatars.githubusercontent.com/u/60573493" width="100" height="100" alt="6Block Avatar"/></a><br>- <a href="https://6block.com/">数据处理服务器由 6Block 提供 (Data Processing sponsor by 6Block)</a>+ <a href="https://6block.com/">Data Processing sponsor by 6Block</a></div><div>- <a href="http://fs.firefly.matce.cn/">- <img src="https://dice-forum.s3.ap-northeast-1.amazonaws.com/2024-05-10/1715299538-382065-04170e083d92c5e0eeff534d6e7704ee.jpg" width="158" height="80" alt="6Block Avatar"/>+ <a href="https://www.lepton.ai/">+ <img src="https://www.lepton.ai/favicons/apple-touch-icon.png" width="100" height="100" alt="Lepton Avatar"/></a><br>- <a href="http://fs.firefly.matce.cn/">在线推理Demo服务器由淮北艾阿网络科技有限公司提供 (Online inference sponsor)</a>+ <a href="https://www.lepton.ai/">Fish Audio is served on Lepton.AI</a></div>diff --git a/README.zh.md b/README.zh.mdnew file mode 100644index 0000000..881ada5--- /dev/null+++ b/README.zh.md@@ -0,0 +1,74 @@+# Fish Speech++<div>+<a target="_blank" href="https://discord.gg/Es5qTB9BcN">+<img alt="Discord" src="https://img.shields.io/discord/1214047546020728892?color=%23738ADB&label=Discord&logo=discord&logoColor=white&style=flat-square"/>+</a>+<a target="_blank" href="http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=jCKlUP7QgSm9kh95UlBoYv6s1I-Apl1M&authKey=xI5ttVAp3do68IpEYEalwXSYZFdfxZSkah%2BctF5FIMyN2NqAa003vFtLqJyAVRfF&noverify=0&group_code=593946093">+<img alt="QQ" src="https://img.shields.io/badge/QQ Group-%2312B7F5?logo=tencent-qq&logoColor=white&style=flat-square"/>+</a>+<a target="_blank" href="https://hub.docker.com/r/lengyue233/fish-speech">+<img alt="Docker" src="https://img.shields.io/docker/pulls/lengyue233/fish-speech?style=flat-square&logo=docker"/>+</a>+<a target="_blank" href="https://github.com/fishaudio/fish-speech/actions/workflows/build-windows-package.yml">+<img alt="Action" src="https://img.shields.io/github/actions/workflow/status/fishaudio/fish-speech/build-windows-package.yml?style=flat-square&label=Build%20Windows%20Package&logo=github"/>+</a>+</div>++此代码库及模型根据 CC-BY-NC-SA-4.0 许可证发布。请参阅 [LICENSE](LICENSE) 了解更多细节.++## 免责声明++我们不对代码库的任何非法使用承担任何责任. 请参阅您当地关于 DMCA (数字千年法案) 和其他相关法律法规.++## 在线 DEMO++[Fish Audio](https://fish.audio)++## 快速开始本地推理++[inference.ipynb](/inference.ipynb)++## 视频++#### 1.2 介绍: https://www.bilibili.com/video/BV1wz421B71D++#### 1.1 技术介绍: https://www.bilibili.com/video/BV1zJ4m1K7cj++## 文档++- [English](https://speech.fish.audio/en/)+- [中文](https://speech.fish.audio/)+- [日本語](https://speech.fish.audio/ja/)++## 例子++- [English](https://speech.fish.audio/en/samples/)+- [中文](https://speech.fish.audio/samples/)+- [日本語](https://speech.fish.audio/ja/samples/)++## 鸣谢++- [VITS2 (daniilrobnikov)](https://github.com/daniilrobnikov/vits2)+- [Bert-VITS2](https://github.com/fishaudio/Bert-VITS2)+- [GPT VITS](https://github.com/innnky/gpt-vits)+- [MQTTS](https://github.com/b04901014/MQTTS)+- [GPT Fast](https://github.com/pytorch-labs/gpt-fast)+- [GPT-SoVITS](https://github.com/RVC-Boss/GPT-SoVITS)++## 赞助++<div>+ <a href="https://6block.com/">+ <img src="https://avatars.githubusercontent.com/u/60573493" width="100" height="100" alt="6Block Avatar"/>+ </a>+ <br>+ <a href="https://6block.com/">数据处理服务器由 6Block 提供</a>+</div>+<div>+ <a href="https://www.lepton.ai/">+ <img src="https://www.lepton.ai/favicons/apple-touch-icon.png" width="100" height="100" alt="Lepton Avatar"/>+ </a>+ <br>+ <a href="https://www.lepton.ai/">Fish Audio 在线推理与 Lepton 合作</a>+</div>diff --git a/docs/en/finetune.md b/docs/en/finetune.mdindex 9e3d1f4..b76e1df 100644--- a/docs/en/finetune.md+++ b/docs/en/finetune.md@@ -36,7 +36,7 @@ You need to convert your dataset into the above format and place it under `data`Make sure you have downloaded the VQGAN weights. If not, run the following command:```bash-huggingface-cli download fishaudio/fish-speech-1.2 --local-dir checkpoints/fish-speech-1.2+huggingface-cli download fishaudio/fish-speech-1.2-sft --local-dir checkpoints/fish-speech-1.2-sft```You can then run the following command to extract semantic tokens:@@ -45,7 +45,7 @@ You can then run the following command to extract semantic tokens:python tools/vqgan/extract_vq.py data \--num-workers 1 --batch-size 16 \--config-name "firefly_gan_vq" \- --checkpoint-path "checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth"+ --checkpoint-path "checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth"```!!! note@@ -89,7 +89,7 @@ After the command finishes executing, you should see the `quantized-dataset-ft.pSimilarly, make sure you have downloaded the `LLAMA` weights. If not, run the following command:```bash-huggingface-cli download fishaudio/fish-speech-1.2 --local-dir checkpoints/fish-speech-1.2+huggingface-cli download fishaudio/fish-speech-1.2-sft --local-dir checkpoints/fish-speech-1.2-sft```Finally, you can start the fine-tuning by running the following command:@@ -117,9 +117,9 @@ After training, you need to convert the LoRA weights to regular weights before p```bashpython tools/llama/merge_lora.py \--lora-config r_8_alpha_16 \- --base-weight checkpoints/fish-speech-1.2 \+ --base-weight checkpoints/fish-speech-1.2-sft \--lora-weight results/$project/checkpoints/step_000000010.ckpt \- --output checkpoints/fish-speech-1.2-yth-lora/+ --output checkpoints/fish-speech-1.2-sft-yth-lora/```!!! noteYou may also try other checkpoints. We suggest using the earliest checkpoint that meets your requirements, as they often perform better on out-of-distribution (OOD) data.diff --git a/docs/en/inference.md b/docs/en/inference.mdindex d99dc27..1a5ad5f 100644--- a/docs/en/inference.md+++ b/docs/en/inference.md@@ -15,7 +15,7 @@ Inference support command line, HTTP API and web UI.Download the required `vqgan` and `llama` models from our Hugging Face repository.```bash-huggingface-cli download fishaudio/fish-speech-1.2 --local-dir checkpoints/fish-speech-1.2+huggingface-cli download fishaudio/fish-speech-1.2-sft --local-dir checkpoints/fish-speech-1.2-sft```### 1. Generate prompt from voice:@@ -26,7 +26,7 @@ huggingface-cli download fishaudio/fish-speech-1.2 --local-dir checkpoints/fish-```bashpython tools/vqgan/inference.py \-i "paimon.wav" \- --checkpoint-path "checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth"+ --checkpoint-path "checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth"```You should get a `fake.npy` file.@@ -38,7 +38,7 @@ python tools/llama/generate.py \--text "The text you want to convert" \--prompt-text "Your reference text" \--prompt-tokens "fake.npy" \- --checkpoint-path "checkpoints/fish-speech-1.2" \+ --checkpoint-path "checkpoints/fish-speech-1.2-sft" \--num-samples 2 \--compile```@@ -59,7 +59,7 @@ This command will create a `codes_N` file in the working directory, where N is a```bashpython tools/vqgan/inference.py \-i "codes_0.npy" \- --checkpoint-path "checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth"+ --checkpoint-path "checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth"```## HTTP API Inference@@ -69,8 +69,8 @@ We provide a HTTP API for inference. You can use the following command to start```bashpython -m tools.api \--listen 0.0.0.0:8080 \- --llama-checkpoint-path "checkpoints/fish-speech-1.2" \- --decoder-checkpoint-path "checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth" \+ --llama-checkpoint-path "checkpoints/fish-speech-1.2-sft" \+ --decoder-checkpoint-path "checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth" \--decoder-config-name firefly_gan_vq```@@ -142,8 +142,8 @@ You can start the WebUI using the following command:```bashpython -m tools.webui \- --llama-checkpoint-path "checkpoints/fish-speech-1.2" \- --decoder-checkpoint-path "checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth" \+ --llama-checkpoint-path "checkpoints/fish-speech-1.2-sft" \+ --decoder-checkpoint-path "checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth" \--decoder-config-name firefly_gan_vq```diff --git a/docs/ja/finetune.md b/docs/ja/finetune.mdindex 5a2cf86..1549528 100644--- a/docs/ja/finetune.md+++ b/docs/ja/finetune.md@@ -36,7 +36,7 @@VQGANの重みをダウンロードしたことを確認してください。まだダウンロードしていない場合は、次のコマンドを実行してください。```bash-huggingface-cli download fishaudio/fish-speech-1.2 --local-dir checkpoints/fish-speech-1.2+huggingface-cli download fishaudio/fish-speech-1.2-sft --local-dir checkpoints/fish-speech-1.2-sft```次に、次のコマンドを実行してセマンティックトークンを抽出できます。@@ -45,7 +45,7 @@ huggingface-cli download fishaudio/fish-speech-1.2 --local-dir checkpoints/fish-python tools/vqgan/extract_vq.py data \--num-workers 1 --batch-size 16 \--config-name "firefly_gan_vq" \- --checkpoint-path "checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth"+ --checkpoint-path "checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth"```!!! note@@ -89,7 +89,7 @@ python tools/llama/build_dataset.py \同様に、`LLAMA`の重みをダウンロードしたことを確認してください。まだダウンロードしていない場合は、次のコマンドを実行してください。```bash-huggingface-cli download fishaudio/fish-speech-1.2 --local-dir checkpoints/fish-speech-1.2+huggingface-cli download fishaudio/fish-speech-1.2-sft --local-dir checkpoints/fish-speech-1.2-sft```最後に、次のコマンドを実行して微調整を開始できます。@@ -117,9 +117,9 @@ python fish_speech/train.py --config-name text2semantic_finetune \```bashpython tools/llama/merge_lora.py \--lora-config r_8_alpha_16 \- --base-weight checkpoints/fish-speech-1.2 \+ --base-weight checkpoints/fish-speech-1.2-sft \--lora-weight results/$project/checkpoints/step_000000010.ckpt \- --output checkpoints/fish-speech-1.2-yth-lora/+ --output checkpoints/fish-speech-1.2-sft-yth-lora/```!!! note他のチェックポイントを試すこともできます。要件を満たす最も早いチェックポイントを使用することをお勧めします。これらは通常、分布外(OOD)データでより良いパフォーマンスを発揮します。diff --git a/docs/ja/inference.md b/docs/ja/inference.mdindex efdedb2..5e78acb 100644--- a/docs/ja/inference.md+++ b/docs/ja/inference.md@@ -15,7 +15,7 @@必要な`vqgan`および`llama`モデルを Hugging Face リポジトリからダウンロードします。```bash-huggingface-cli download fishaudio/fish-speech-1.2 --local-dir checkpoints/fish-speech-1.2+huggingface-cli download fishaudio/fish-speech-1.2-sft --local-dir checkpoints/fish-speech-1.2-sft```### 1. 音声からプロンプトを生成する:@@ -26,7 +26,7 @@ huggingface-cli download fishaudio/fish-speech-1.2 --local-dir checkpoints/fish-```bashpython tools/vqgan/inference.py \-i "paimon.wav" \- --checkpoint-path "checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth"+ --checkpoint-path "checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth"````fake.npy`ファイルが生成されるはずです。@@ -38,7 +38,7 @@ python tools/llama/generate.py \--text "変換したいテキスト" \--prompt-text "参照テキスト" \--prompt-tokens "fake.npy" \- --checkpoint-path "checkpoints/fish-speech-1.2" \+ --checkpoint-path "checkpoints/fish-speech-1.2-sft" \--num-samples 2 \--compile```@@ -63,7 +63,7 @@ python tools/llama/generate.py \```bashpython tools/vqgan/inference.py \-i "codes_0.npy" \- --checkpoint-path "checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth"+ --checkpoint-path "checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth"```## HTTP API 推論@@ -73,8 +73,8 @@ python tools/vqgan/inference.py \```bashpython -m tools.api \--listen 0.0.0.0:8080 \- --llama-checkpoint-path "checkpoints/fish-speech-1.2" \- --decoder-checkpoint-path "checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth" \+ --llama-checkpoint-path "checkpoints/fish-speech-1.2-sft" \+ --decoder-checkpoint-path "checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth" \--decoder-config-name firefly_gan_vq```@@ -150,8 +150,8 @@ python -m tools.post_api \```bashpython -m tools.webui \- --llama-checkpoint-path "checkpoints/fish-speech-1.2" \- --decoder-checkpoint-path "checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth" \+ --llama-checkpoint-path "checkpoints/fish-speech-1.2-sft" \+ --decoder-checkpoint-path "checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth" \--decoder-config-name firefly_gan_vq```diff --git a/docs/zh/finetune.md b/docs/zh/finetune.mdindex 2c00cc8..7d47e60 100644--- a/docs/zh/finetune.md+++ b/docs/zh/finetune.md@@ -34,13 +34,13 @@确保你已经下载了 vqgan 权重, 如果没有, 请运行以下命令:```bash-huggingface-cli download fishaudio/fish-speech-1.2 --local-dir checkpoints/fish-speech-1.2+huggingface-cli download fishaudio/fish-speech-1.2-sft --local-dir checkpoints/fish-speech-1.2-sft```对于中国大陆用户, 可使用 mirror 下载.```bash-HF_ENDPOINT=https://hf-mirror.com huggingface-cli download fishaudio/fish-speech-1.2 --local-dir checkpoints/fish-speech-1.2+HF_ENDPOINT=https://hf-mirror.com huggingface-cli download fishaudio/fish-speech-1.2-sft --local-dir checkpoints/fish-speech-1.2-sft```随后可运行以下命令来提取语义 token:@@ -49,7 +49,7 @@ HF_ENDPOINT=https://hf-mirror.com huggingface-cli download fishaudio/fish-speechpython tools/vqgan/extract_vq.py data \--num-workers 1 --batch-size 16 \--config-name "firefly_gan_vq" \- --checkpoint-path "checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth"+ --checkpoint-path "checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth"```!!! note@@ -93,13 +93,13 @@ python tools/llama/build_dataset.py \同样的, 请确保你已经下载了 `LLAMA` 权重, 如果没有, 请运行以下命令:```bash-huggingface-cli download fishaudio/fish-speech-1.2 --local-dir checkpoints/fish-speech-1.2+huggingface-cli download fishaudio/fish-speech-1.2-sft --local-dir checkpoints/fish-speech-1.2-sft```对于中国大陆用户, 可使用 mirror 下载.```bash-HF_ENDPOINT=https://hf-mirror.com huggingface-cli download fishaudio/fish-speech-1.2 --local-dir checkpoints/fish-speech-1.2+HF_ENDPOINT=https://hf-mirror.com huggingface-cli download fishaudio/fish-speech-1.2-sft --local-dir checkpoints/fish-speech-1.2-sft```最后, 你可以运行以下命令来启动微调:@@ -127,9 +127,9 @@ python fish_speech/train.py --config-name text2semantic_finetune \```bashpython tools/llama/merge_lora.py \--lora-config r_8_alpha_16 \- --base-weight checkpoints/fish-speech-1.2 \+ --base-weight checkpoints/fish-speech-1.2-sft \--lora-weight results/$project/checkpoints/step_000000010.ckpt \- --output checkpoints/fish-speech-1.2-yth-lora/+ --output checkpoints/fish-speech-1.2-sft-yth-lora/```!!! notediff --git a/docs/zh/inference.md b/docs/zh/inference.mdindex 295c84b..140722d 100644--- a/docs/zh/inference.md+++ b/docs/zh/inference.md@@ -15,13 +15,13 @@从我们的 huggingface 仓库下载所需的 `vqgan` 和 `llama` 模型。```bash-huggingface-cli download fishaudio/fish-speech-1.2 --local-dir checkpoints/fish-speech-1.2+huggingface-cli download fishaudio/fish-speech-1.2-sft --local-dir checkpoints/fish-speech-1.2-sft```对于中国大陆用户,可使用 mirror 下载。```bash-HF_ENDPOINT=https://hf-mirror.com huggingface-cli download fishaudio/fish-speech-1.2 --local-dir checkpoints/fish-speech-1.2+HF_ENDPOINT=https://hf-mirror.com huggingface-cli download fishaudio/fish-speech-1.2-sft --local-dir checkpoints/fish-speech-1.2-sft```### 1. 从语音生成 prompt:@@ -32,7 +32,7 @@ HF_ENDPOINT=https://hf-mirror.com huggingface-cli download fishaudio/fish-speech```bashpython tools/vqgan/inference.py \-i "paimon.wav" \- --checkpoint-path "checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth"+ --checkpoint-path "checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth"```你应该能得到一个 `fake.npy` 文件.@@ -44,7 +44,7 @@ python tools/llama/generate.py \--text "要转换的文本" \--prompt-text "你的参考文本" \--prompt-tokens "fake.npy" \- --checkpoint-path "checkpoints/fish-speech-1.2" \+ --checkpoint-path "checkpoints/fish-speech-1.2-sft" \--num-samples 2 \--compile```@@ -68,7 +68,7 @@ python tools/llama/generate.py \```bashpython tools/vqgan/inference.py \-i "codes_0.npy" \- --checkpoint-path "checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth"+ --checkpoint-path "checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth"```## HTTP API 推理@@ -78,8 +78,8 @@ python tools/vqgan/inference.py \```bashpython -m tools.api \--listen 0.0.0.0:8080 \- --llama-checkpoint-path "checkpoints/fish-speech-1.2" \- --decoder-checkpoint-path "checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth" \+ --llama-checkpoint-path "checkpoints/fish-speech-1.2-sft" \+ --decoder-checkpoint-path "checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth" \--decoder-config-name firefly_gan_vq如果你想要加速推理,可以加上--compile参数。@@ -155,8 +155,8 @@ python -m tools.post_api \```bashpython -m tools.webui \- --llama-checkpoint-path "checkpoints/fish-speech-1.2" \- --decoder-checkpoint-path "checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth" \+ --llama-checkpoint-path "checkpoints/fish-speech-1.2-sft" \+ --decoder-checkpoint-path "checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth" \--decoder-config-name firefly_gan_vq```diff --git a/fish_speech/configs/text2semantic_finetune.yaml b/fish_speech/configs/text2semantic_finetune.yamlindex adebb5a..1bf8fd6 100644--- a/fish_speech/configs/text2semantic_finetune.yaml+++ b/fish_speech/configs/text2semantic_finetune.yaml@@ -4,7 +4,7 @@ defaults:project: text2semantic_finetune_dual_armax_length: 4096-pretrained_ckpt_path: checkpoints/fish-speech-1.2+pretrained_ckpt_path: checkpoints/fish-speech-1.2-sft# Lightning Trainertrainer:diff --git a/fish_speech/webui/manage.py b/fish_speech/webui/manage.pyindex 24bb855..d66e72f 100644--- a/fish_speech/webui/manage.py+++ b/fish_speech/webui/manage.py@@ -469,7 +469,7 @@ def train_process("--config-name","firefly_gan_vq","--checkpoint-path",- "checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth",+ "checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth",])@@ -485,7 +485,7 @@ def train_process("16",])- ckpt_path = "checkpoints/fish-speech-1.2/model.pth"+ ckpt_path = "checkpoints/fish-speech-1.2-sft/model.pth"lora_prefix = "lora_" if llama_use_lora else ""llama_name = lora_prefix + "text2semantic_" + new_projectlatest = next(@@ -918,9 +918,9 @@ with gr.Blocks("Type the path or select from the dropdown"),choices=[- "checkpoints/fish-speech-1.2/model.pth",+ "checkpoints/fish-speech-1.2-sft/model.pth",],- value="checkpoints/fish-speech-1.2/model.pth",+ value="checkpoints/fish-speech-1.2-sft/model.pth",allow_custom_value=True,interactive=True,)@@ -972,7 +972,7 @@ with gr.Blocks("Type the path or select from the dropdown"),choices=list_llama_models(),- value="checkpoints/fish-speech-1.2",+ value="checkpoints/fish-speech-1.2-sft",allow_custom_value=True,interactive=True,)@@ -1035,7 +1035,7 @@ with gr.Blocks("Type the path or select from the dropdown"),choices=list_decoder_models(),- value="checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth",+ value="checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth",allow_custom_value=True,)infer_decoder_config = gr.Dropdown(@@ -1053,7 +1053,7 @@ with gr.Blocks(info=i18n("Type the path or select from the dropdown"),- value="checkpoints/fish-speech-1.2",+ value="checkpoints/fish-speech-1.2-sft",choices=list_llama_models(),allow_custom_value=True,)diff --git a/inference.ipynb b/inference.ipynbindex 94ea2aa..fcc5765 100644--- a/inference.ipynb+++ b/inference.ipynb@@ -4,7 +4,7 @@"cell_type": "markdown","metadata": {},"source": [- "## 命令行推理"+ "# Fish Speech"]},{@@ -48,65 +48,57 @@"cell_type": "markdown","metadata": {},"source": [- "## API Client\n",- "\n",- "需要在终端开启API Server\n",- "\n",- "> 音频用本地路径\n",- "\n",- "> 文本可以直接用路径,也可以用内容"+ "### Prepare Model"]},{"cell_type": "code","execution_count": null,- "metadata": {- "vscode": {- "languageId": "shellscript"- }- },+ "metadata": {},"outputs": [],"source": [- "!python -m tools.post_api \\\n",- " --text \"Hello everyone, I am an open-source text-to-speech model developed by Fish Audio.\" \\\n",- " --reference_audio \"D:\\PythonProject\\原神语音中文\\胡桃\\vo_hutao_draw_appear.wav\" \\\n",- " --reference_text \"D:\\PythonProject\\原神语音中文\\胡桃\\vo_hutao_draw_appear.lab\" \\\n",- " --streaming True"+ "# For Chinese users, you probably want to use mirror to accelerate downloading\n",+ "# !set HF_ENDPOINT=https://hf-mirror.com\n",+ "# !export HF_ENDPOINT=https://hf-mirror.com \n",+ "\n",+ "!huggingface-cli download fishaudio/fish-speech-1.2-sft --local-dir checkpoints/fish-speech-1.2-sft/"]},{"cell_type": "markdown","metadata": {},"source": [- "## For Test"+ "## WebUI Inference\n",+ "\n",+ "> You can use --compile to fuse CUDA kernels for faster inference (10x)."]},{- "cell_type": "markdown",+ "cell_type": "code",+ "execution_count": null,"metadata": {},+ "outputs": [],"source": [- "### 0. 下载模型"+ "!python tools/webui.py \\\n",+ " --llama-checkpoint-path checkpoints/fish-speech-1.2-sft \\\n",+ " --decoder-checkpoint-path checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth \\\n",+ " # --compile"]},{- "cell_type": "code",- "execution_count": null,+ "cell_type": "markdown","metadata": {},- "outputs": [],"source": [- "!set HF_ENDPOINT=https://hf-mirror.com\n",- "# !export HF_ENDPOINT=https://hf-mirror.com\n",- "!huggingface-cli download fishaudio/fish-speech-1.2 --local-dir checkpoints/fish-speech-1.2/"+ "## Break-down CLI Inference"]},{"cell_type": "markdown","metadata": {},"source": [- "### 1. 从语音生成 prompt:\n",- "> 如果你打算让模型随机选择音色, 你可以跳过这一步.\n",+ "### 1. Encode reference audio\n","\n",- "你应该能得到一个 `fake.npy` 文件."+ "You should get a `fake.npy` by doing this."]},{@@ -119,12 +111,12 @@},"outputs": [],"source": [- "## 在此输入你的语音路径:\n",- "src_audio = r\"D:\\PythonProject\\原神语音中文\\胡桃\\vo_hutao_draw_appear.wav\"\n",+ "## Enter the path to the audio file here\n",+ "src_audio = r\"D:\\PythonProject\\\\vo_hutao_draw_appear.wav\"\n","\n","!python tools/vqgan/inference.py \\\n"," -i {src_audio} \\\n",- " --checkpoint-path \"checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth\"\n",+ " --checkpoint-path \"checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth\"\n","\n","from IPython.display import Audio, display\n","audio = Audio(filename=\"fake.wav\")\n",@@ -135,10 +127,10 @@"cell_type": "markdown","metadata": {},"source": [- "### 2. 从文本生成语义 token:\n",- "> 该命令会在工作目录下创建 codes_N 文件, 其中 N 是从 0 开始的整数.\n",+ "### 2. Generate semantic tokens from text:\n",+ "> This command will create codes_N files in the working directory, where N is an integer starting from 0.\n","\n",- "> 您可以使用 --compile 来融合 cuda 内核以实现更快的推理"+ "> You can use --compile to fuse CUDA kernels for faster inference."]},{@@ -152,10 +144,10 @@"outputs": [],"source": ["!python tools/llama/generate.py \\\n",- " --text \"人间灯火倒映湖中,她的渴望让静水泛起涟漪。若代价只是孤独,那就让这份愿望肆意流淌。流入她所注视的世间,也流入她如湖水般澄澈的目光。\" \\\n",- " --prompt-text \"唷,找本堂主有何贵干呀?嗯?你不知道吗,往生堂第七十七代堂主就是胡桃我啦!嘶,不过瞧你的模样,容光焕发,身体健康,嗯…想必是为了工作以外的事来找我,对吧?\" \\\n",+ " --text \"hello world\" \\\n",+ " --prompt-text \"The text corresponding to reference audio\" \\\n"," --prompt-tokens \"fake.npy\" \\\n",- " --checkpoint-path \"checkpoints/fish-speech-1.2\" \\\n",+ " --checkpoint-path \"checkpoints/fish-speech-1.2-sft\" \\\n"," --num-samples 2\n"," # --compile"]@@ -164,7 +156,7 @@"cell_type": "markdown","metadata": {},"source": [- "### 3. 从语义 token 生成人声:"+ "### 3. Generate speech from semantic tokens:"]},{@@ -179,7 +171,7 @@"source": ["!python tools/vqgan/inference.py \\\n"," -i \"codes_0.npy\" \\\n",- " --checkpoint-path \"checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth\"\n",+ " --checkpoint-path \"checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth\"\n","\n","from IPython.display import Audio, display\n","audio = Audio(filename=\"fake.wav\")\n",diff --git a/tools/api.py b/tools/api.pyindex d8aab90..5dbea29 100644--- a/tools/api.py+++ b/tools/api.py@@ -363,12 +363,12 @@ def parse_args():parser.add_argument("--llama-checkpoint-path",type=str,- default="checkpoints/fish-speech-1.2",+ default="checkpoints/fish-speech-1.2-sft",)parser.add_argument("--decoder-checkpoint-path",type=str,- default="checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth",+ default="checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth",)parser.add_argument("--decoder-config-name", type=str, default="firefly_gan_vq")parser.add_argument("--device", type=str, default="cuda")diff --git a/tools/download_models.py b/tools/download_models.pyindex b73cd05..7ae4a4d 100644--- a/tools/download_models.py+++ b/tools/download_models.py@@ -22,8 +22,8 @@ def check_and_download_files(repo_id, file_list, local_dir):# 1st-repo_id_1 = "fishaudio/fish-speech-1.2"-local_dir_1 = "./checkpoints/fish-speech-1.2"+repo_id_1 = "fishaudio/fish-speech-1.2-sft"+local_dir_1 = "./checkpoints/fish-speech-1.2-sft"files_1 = ["model.pth","README.md",diff --git a/tools/llama/generate.py b/tools/llama/generate.pyindex 535e814..eaf195e 100644--- a/tools/llama/generate.py+++ b/tools/llama/generate.py@@ -604,7 +604,7 @@ def launch_thread_safe_queue(@click.option("--checkpoint-path",type=click.Path(path_type=Path, exists=True),- default="checkpoints/fish-speech-1.2",+ default="checkpoints/fish-speech-1.2-sft",)@click.option("--device", type=str, default="cuda")@click.option("--compile/--no-compile", default=False)diff --git a/tools/llama/merge_lora.py b/tools/llama/merge_lora.pyindex 1b3b507..f12eece 100644--- a/tools/llama/merge_lora.py+++ b/tools/llama/merge_lora.py@@ -15,7 +15,7 @@ from fish_speech.models.text2semantic.lora import get_merged_state_dict@click.command()@click.option("--lora-config", type=str, default="r_8_alpha_16")[email protected]("--base-weight", type=str, default="checkpoints/fish-speech-1.2")[email protected]("--base-weight", type=str, default="checkpoints/fish-speech-1.2-sft")@click.option("--lora-weight", type=str, required=True)@click.option("--output", type=str, required=True)def merge(lora_config, base_weight, lora_weight, output):diff --git a/tools/llama/quantize.py b/tools/llama/quantize.pyindex 46781bc..aae32fc 100644--- a/tools/llama/quantize.py+++ b/tools/llama/quantize.py@@ -428,7 +428,7 @@ def generate_folder_name():@click.option("--checkpoint-path",type=click.Path(path_type=Path, exists=True),- default="checkpoints/fish-speech-1.2",+ default="checkpoints/fish-speech-1.2-sft",)@click.option("--mode", type=str, default="int8", help="type of quantization to perform"diff --git a/tools/vqgan/extract_vq.py b/tools/vqgan/extract_vq.pyindex 3004a84..fc84f7e 100644--- a/tools/vqgan/extract_vq.py+++ b/tools/vqgan/extract_vq.py@@ -42,7 +42,7 @@ logger.add(sys.stderr, format=logger_format)@lru_cache(maxsize=1)def get_model(config_name: str = "firefly_gan_vq",- checkpoint_path: str = "checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth",+ checkpoint_path: str = "checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth",device: str | torch.device = "cuda",):with initialize(version_base="1.3", config_path="../../fish_speech/configs"):@@ -133,7 +133,7 @@ def process_batch(files: list[Path], model) -> float:@click.option("--config-name", default="firefly_gan_vq")@click.option("--checkpoint-path",- default="checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth",+ default="checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth",)@click.option("--batch-size", default=64)@click.option("--filelist", default=None, type=Path)diff --git a/tools/vqgan/inference.py b/tools/vqgan/inference.pyindex 1d2e867..68b73b5 100644--- a/tools/vqgan/inference.py+++ b/tools/vqgan/inference.py@@ -59,7 +59,7 @@ def load_model(config_name, checkpoint_path, device="cuda"):@click.option("--config-name", default="firefly_gan_vq")@click.option("--checkpoint-path",- default="checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth",+ default="checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth",)@click.option("--device",diff --git a/tools/webui.py b/tools/webui.pyindex 78d9b71..0bd87df 100644--- a/tools/webui.py+++ b/tools/webui.py@@ -428,12 +428,12 @@ def parse_args():parser.add_argument("--llama-checkpoint-path",type=Path,- default="checkpoints/fish-speech-1.2",+ default="checkpoints/fish-speech-1.2-sft",)parser.add_argument("--decoder-checkpoint-path",type=Path,- default="checkpoints/fish-speech-1.2/firefly-gan-vq-fsq-4x1024-42hz-generator.pth",+ default="checkpoints/fish-speech-1.2-sft/firefly-gan-vq-fsq-4x1024-42hz-generator.pth",)parser.add_argument("--decoder-config-name", type=str, default="firefly_gan_vq")parser.add_argument("--device", type=str, default="cuda")