Skip to content

A TTS that fits in your CPU (and pocket)

Python

Use tanh GELU approximation in the backbone FFN (#278)

manu-lm2dd548a811fe
diff --git a/pocket_tts/modules/transformer.py b/pocket_tts/modules/transformer.py
index 4abda2f..69cdb19 100644
--- a/pocket_tts/modules/transformer.py
+++ b/pocket_tts/modules/transformer.py
@@ -39,7 +39,7 @@ class StreamingTransformerLayer(nn.Module):
def _ff_block(self, x: torch.Tensor) -> torch.Tensor:
x_orig = x
x = self.norm2(x)
- update = self.linear2(F.gelu(self.linear1(x)))
+ update = self.linear2(F.gelu(self.linear1(x), approximate="tanh"))
return x_orig.to(update) + self.layer_scale_2(update)
def _sa_block(