Spaces:
Sleeping
Sleeping
Add variable audio lengths
Browse files
app.py
CHANGED
@@ -95,8 +95,10 @@ def generate_base(story):
|
|
95 |
speech_output = model.generate(input_ids=description_tokens.input_ids,
|
96 |
prompt_input_ids=story_tokens.input_ids,
|
97 |
attention_mask=description_tokens.attention_mask,
|
98 |
-
prompt_attention_mask=story_tokens.attention_mask
|
99 |
-
|
|
|
|
|
100 |
return None, None, speech_output
|
101 |
|
102 |
|
|
|
95 |
speech_output = model.generate(input_ids=description_tokens.input_ids,
|
96 |
prompt_input_ids=story_tokens.input_ids,
|
97 |
attention_mask=description_tokens.attention_mask,
|
98 |
+
prompt_attention_mask=story_tokens.attention_mask,
|
99 |
+
return_dict_in_generate=True,
|
100 |
+
)
|
101 |
+
speech_output = [output.cpu().numpy()[:output_length] for (output, output_length) in zip(speech_output.sequences, speech_output.audios_length)]
|
102 |
return None, None, speech_output
|
103 |
|
104 |
|