linoyts HF staff commited on
Commit
e7fdc7d
1 Parent(s): a7153c1

limit input length

Browse files
Files changed (1) hide show
  1. utils.py +1 -1
utils.py CHANGED
@@ -16,7 +16,7 @@ def load_audio(audio_path: Union[str, np.array], fn_STFT, left: int = 0, right:
16
  import audioldm
17
  import audioldm.audio
18
 
19
- duration = audioldm.utils.get_duration(audio_path)
20
 
21
  mel, _, _ = audioldm.audio.wav_to_fbank(audio_path, target_length=int(duration * 102.4), fn_STFT=fn_STFT)
22
  mel = mel.unsqueeze(0)
 
16
  import audioldm
17
  import audioldm.audio
18
 
19
+ duration = min(audioldm.utils.get_duration(audio_path), 15)
20
 
21
  mel, _, _ = audioldm.audio.wav_to_fbank(audio_path, target_length=int(duration * 102.4), fn_STFT=fn_STFT)
22
  mel = mel.unsqueeze(0)