Skip to content

Commit 91c3f5b

Browse files
rkazantsmvafin
authored andcommitted
[TTS] Fix second generation for Speech T5 TSS (#1389)
Signed-off-by: Kazantsev, Roman <[email protected]>
1 parent b0ed71f commit 91c3f5b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

optimum/intel/openvino/modeling_text2speech.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ def forward(self, inputs_embeds, speaker_embeddings, encoder_last_hidden_state,
9797
prob = torch.from_numpy(result[2])
9898
return ModelOutput(output_sequence_out=output_sequence_out, spectrum=spectrum, prob=prob)
9999

100+
def reset_state(self) -> None:
101+
if self.request:
102+
self.request.reset_state()
103+
100104

101105
class OVTextToSpeechPostNet(OVModelPart):
102106
_model_name = "postnet"
@@ -472,6 +476,9 @@ def generate(
472476
idx = 0
473477
result_spectrogram = {}
474478

479+
# clean-up decoder states for new generation
480+
self.decoder.reset_state()
481+
475482
while True:
476483
idx += 1
477484

0 commit comments

Comments
 (0)