ylacombe HF staff commited on
Commit
36654bb
1 Parent(s): e055ee5

Add variable audio lengths

Browse files
Files changed (1) hide show
  1. app.py +4 -2
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
- speech_output = [output.cpu().numpy() for output in speech_output]
 
 
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