From 8c579d46dda62ae5bdf04f96796c1acc79d44b59 Mon Sep 17 00:00:00 2001 From: Yixiao Chen <113320753+Bobchenyx@users.noreply.github.com> Date: Wed, 2 Jul 2025 10:48:28 -0400 Subject: [PATCH] Update export_torch_script.py (#2494) Avoid dtype inconsistency when exporting --- GPT_SoVITS/export_torch_script.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/GPT_SoVITS/export_torch_script.py b/GPT_SoVITS/export_torch_script.py index a3a4827..e4406f2 100644 --- a/GPT_SoVITS/export_torch_script.py +++ b/GPT_SoVITS/export_torch_script.py @@ -474,6 +474,10 @@ class T2SModel(nn.Module): bert = bert.unsqueeze(0) x = self.ar_text_embedding(all_phoneme_ids) + + # avoid dtype inconsistency when exporting + bert = bert.to(dtype=self.bert_proj.weight.dtype) + x = x + self.bert_proj(bert.transpose(1, 2)) x: torch.Tensor = self.ar_text_position(x)