Skip to content

SOTA Open Source TTS

fix: replace in-place tensor operations for torch.compile compatibility (#1179)

A1618b7bea285
diff --git a/README.md b/README.md
index 655d316..7944483 100644
--- a/README.md
+++ b/README.md
@@ -37,7 +37,7 @@
<img alt="Fish Audio Blog" src="https://img.shields.io/badge/Blog-Fish_Audio_S2-1f7a8c?style=flat-square&logo=readme&logoColor=white"/>
</a>
<a target="_blank" href="https://github.com/fishaudio/fish-speech/blob/main/FishAudioS2TecReport.pdf">
- <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Tecnical_Report-b31b1b?style=flat-square"/>
+ <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Technical_Report-b31b1b?style=flat-square"/>
</a>
</div>
@@ -77,7 +77,7 @@ Fish Audio S2 is the latest model developed by [Fish Audio](https://fish.audio/)
S2 supports fine-grained inline control of prosody and emotion using natural-language tags like `[laugh]`, `[whispers]`, and `[super happy]`, as well as native multi-speaker and multi-turn generation.
-Visit the [Fish Audio website](https://fish.audio/) for live playground. Read the [blog post](https://fish.audio/blog/fish-audio-open-sources-s2/) and [tecnical report](https://github.com/fishaudio/fish-speech/blob/main/FishAudioS2TecReport.pdf) for more details.
+Visit the [Fish Audio website](https://fish.audio/) for live playground. Read the [blog post](https://fish.audio/blog/fish-audio-open-sources-s2/) and [technical report](https://github.com/fishaudio/fish-speech/blob/main/FishAudioS2TecReport.pdf) for more details.
### Model Variants
diff --git a/docs/README.ar.md b/docs/README.ar.md
index 87409fe..ca6cebd 100644
--- a/docs/README.ar.md
+++ b/docs/README.ar.md
@@ -37,7 +37,7 @@
<img alt="Fish Audio Blog" src="https://img.shields.io/badge/Blog-Fish_Audio_S2-1f7a8c?style=flat-square&logo=readme&logoColor=white"/>
</a>
<a target="_blank" href="https://github.com/fishaudio/fish-speech/blob/main/FishAudioS2TecReport.pdf">
- <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Tecnical_Report-b31b1b?style=flat-square"/>
+ <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Technical_Report-b31b1b?style=flat-square"/>
</a>
</div>
diff --git a/docs/README.ja.md b/docs/README.ja.md
index 54d61f2..cfc5c86 100644
--- a/docs/README.ja.md
+++ b/docs/README.ja.md
@@ -37,7 +37,7 @@
<img alt="Fish Audio Blog" src="https://img.shields.io/badge/Blog-Fish_Audio_S2-1f7a8c?style=flat-square&logo=readme&logoColor=white"/>
</a>
<a target="_blank" href="https://github.com/fishaudio/fish-speech/blob/main/FishAudioS2TecReport.pdf">
- <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Tecnical_Report-b31b1b?style=flat-square"/>
+ <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Technical_Report-b31b1b?style=flat-square"/>
</a>
</div>
diff --git a/docs/README.ko.md b/docs/README.ko.md
index f1660bc..7957554 100644
--- a/docs/README.ko.md
+++ b/docs/README.ko.md
@@ -37,7 +37,7 @@
<img alt="Fish Audio Blog" src="https://img.shields.io/badge/Blog-Fish_Audio_S2-1f7a8c?style=flat-square&logo=readme&logoColor=white"/>
</a>
<a target="_blank" href="https://github.com/fishaudio/fish-speech/blob/main/FishAudioS2TecReport.pdf">
- <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Tecnical_Report-b31b1b?style=flat-square"/>
+ <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Technical_Report-b31b1b?style=flat-square"/>
</a>
</div>
diff --git a/docs/README.pt-BR.md b/docs/README.pt-BR.md
index 8183ad4..d969e5a 100644
--- a/docs/README.pt-BR.md
+++ b/docs/README.pt-BR.md
@@ -37,7 +37,7 @@
<img alt="Fish Audio Blog" src="https://img.shields.io/badge/Blog-Fish_Audio_S2-1f7a8c?style=flat-square&logo=readme&logoColor=white"/>
</a>
<a target="_blank" href="https://github.com/fishaudio/fish-speech/blob/main/FishAudioS2TecReport.pdf">
- <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Tecnical_Report-b31b1b?style=flat-square"/>
+ <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Technical_Report-b31b1b?style=flat-square"/>
</a>
</div>
diff --git a/docs/README.zh.md b/docs/README.zh.md
index cf8c983..5abfb03 100644
--- a/docs/README.zh.md
+++ b/docs/README.zh.md
@@ -37,7 +37,7 @@
<img alt="Fish Audio Blog" src="https://img.shields.io/badge/Blog-Fish_Audio_S2-1f7a8c?style=flat-square&logo=readme&logoColor=white"/>
</a>
<a target="_blank" href="https://github.com/fishaudio/fish-speech/blob/main/FishAudioS2TecReport.pdf">
- <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Tecnical_Report-b31b1b?style=flat-square"/>
+ <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Technical_Report-b31b1b?style=flat-square"/>
</a>
</div>
diff --git a/docs/ar/index.md b/docs/ar/index.md
index 71d4d83..e305f76 100644
--- a/docs/ar/index.md
+++ b/docs/ar/index.md
@@ -37,7 +37,7 @@
<img alt="Fish Audio Blog" src="https://img.shields.io/badge/Blog-Fish_Audio_S2-1f7a8c?style=flat-square&logo=readme&logoColor=white"/>
</a>
<a target="_blank" href="https://github.com/fishaudio/fish-speech/blob/main/FishAudioS2TecReport.pdf">
- <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Tecnical_Report-b31b1b?style=flat-square"/>
+ <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Technical_Report-b31b1b?style=flat-square"/>
</a>
</div>
diff --git a/docs/en/index.md b/docs/en/index.md
index be2b138..2cba608 100644
--- a/docs/en/index.md
+++ b/docs/en/index.md
@@ -37,7 +37,7 @@
<img alt="Fish Audio Blog" src="https://img.shields.io/badge/Blog-Fish_Audio_S2-1f7a8c?style=flat-square&logo=readme&logoColor=white"/>
</a>
<a target="_blank" href="https://github.com/fishaudio/fish-speech/blob/main/FishAudioS2TecReport.pdf">
- <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Tecnical_Report-b31b1b?style=flat-square"/>
+ <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Technical_Report-b31b1b?style=flat-square"/>
</a>
</div>
diff --git a/docs/ja/index.md b/docs/ja/index.md
index 58fe061..f7088f9 100644
--- a/docs/ja/index.md
+++ b/docs/ja/index.md
@@ -37,7 +37,7 @@
<img alt="Fish Audio Blog" src="https://img.shields.io/badge/Blog-Fish_Audio_S2-1f7a8c?style=flat-square&logo=readme&logoColor=white"/>
</a>
<a target="_blank" href="https://github.com/fishaudio/fish-speech/blob/main/FishAudioS2TecReport.pdf">
- <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Tecnical_Report-b31b1b?style=flat-square"/>
+ <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Technical_Report-b31b1b?style=flat-square"/>
</a>
</div>
diff --git a/docs/ko/index.md b/docs/ko/index.md
index 78dec42..f0c7f68 100644
--- a/docs/ko/index.md
+++ b/docs/ko/index.md
@@ -37,7 +37,7 @@
<img alt="Fish Audio Blog" src="https://img.shields.io/badge/Blog-Fish_Audio_S2-1f7a8c?style=flat-square&logo=readme&logoColor=white"/>
</a>
<a target="_blank" href="https://github.com/fishaudio/fish-speech/blob/main/FishAudioS2TecReport.pdf">
- <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Tecnical_Report-b31b1b?style=flat-square"/>
+ <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Technical_Report-b31b1b?style=flat-square"/>
</a>
</div>
diff --git a/docs/pt/index.md b/docs/pt/index.md
index 49d53fe..2b24f2d 100644
--- a/docs/pt/index.md
+++ b/docs/pt/index.md
@@ -37,7 +37,7 @@
<img alt="Fish Audio Blog" src="https://img.shields.io/badge/Blog-Fish_Audio_S2-1f7a8c?style=flat-square&logo=readme&logoColor=white"/>
</a>
<a target="_blank" href="https://github.com/fishaudio/fish-speech/blob/main/FishAudioS2TecReport.pdf">
- <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Tecnical_Report-b31b1b?style=flat-square"/>
+ <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Technical_Report-b31b1b?style=flat-square"/>
</a>
</div>
diff --git a/docs/zh/index.md b/docs/zh/index.md
index 84c1af0..286af63 100644
--- a/docs/zh/index.md
+++ b/docs/zh/index.md
@@ -37,7 +37,7 @@
<img alt="Fish Audio Blog" src="https://img.shields.io/badge/Blog-Fish_Audio_S2-1f7a8c?style=flat-square&logo=readme&logoColor=white"/>
</a>
<a target="_blank" href="https://github.com/fishaudio/fish-speech/blob/main/FishAudioS2TecReport.pdf">
- <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Tecnical_Report-b31b1b?style=flat-square"/>
+ <img alt="Paper | Technical Report" src="https://img.shields.io/badge/Paper-Technical_Report-b31b1b?style=flat-square"/>
</a>
</div>
diff --git a/fish_speech/models/dac/modded_dac.py b/fish_speech/models/dac/modded_dac.py
index eb14b47..066bdf9 100644
--- a/fish_speech/models/dac/modded_dac.py
+++ b/fish_speech/models/dac/modded_dac.py
@@ -86,8 +86,12 @@ class KVCache(nn.Module):
)
def clear_cache(self, prompt_len):
- self.k_cache[:, :, prompt_len:, :].fill_(0)
- self.v_cache[:, :, prompt_len:, :].fill_(0)
+ self.k_cache[:, :, prompt_len:, :] = torch.zeros_like(
+ self.k_cache[:, :, prompt_len:, :]
+ )
+ self.v_cache[:, :, prompt_len:, :] = torch.zeros_like(
+ self.v_cache[:, :, prompt_len:, :]
+ )
class Transformer(nn.Module):
diff --git a/fish_speech/models/text2semantic/llama.py b/fish_speech/models/text2semantic/llama.py
index 22187ed..3c40f41 100644
--- a/fish_speech/models/text2semantic/llama.py
+++ b/fish_speech/models/text2semantic/llama.py
@@ -961,9 +961,11 @@ class Attention(nn.Module):
if attn_mask is not None:
if attn_mask.dtype == torch.bool:
- attn_bias.masked_fill_(attn_mask.logical_not(), float("-inf"))
+ attn_bias = torch.where(
+ attn_mask.logical_not(), float("-inf"), attn_bias
+ )
else:
- attn_bias += attn_mask
+ attn_bias = attn_bias + attn_mask
attn_weight = query @ key.transpose(-2, -1) * scale_factor
attn_weight += attn_bias