Safetensors
omni
custom_code
bigmoyan commited on
Commit
fc81ff3
·
verified ·
1 Parent(s): 6761be8

Remove channel num check

Browse files

这个assert是不必要的,因为接下来马上就to mono了
这个assert会不必要的导致在一些测试集上失败,例如 mmau-test,因为这里的音频是6声道的。这本来可以被正确处理,但被assert干掉了。

Files changed (1) hide show
  1. processor_omni.py +1 -1
processor_omni.py CHANGED
@@ -255,7 +255,7 @@ class OmniAudioProcessor:
255
 
256
  def load_audio_waveform(self, uri, return_tensors=True, do_normalize=False):
257
  metadata = torchaudio.info(uri) # sample_rate, num_frames, num_channels, bits_per_sample, encoding=PCM_S
258
- assert(metadata.num_channels <= 2), "acoustic file with {} channels.".format(metadata.num_channels) # whisper only accept mono channel audio
259
  waveform_tensor, _ = torchaudio.load(uri, normalize=True)
260
  if self.config.sampling_rate != metadata.sample_rate:
261
  waveform_tensor = torchaudio.functional.resample(waveform_tensor, metadata.sample_rate, self.config.sampling_rate, lowpass_filter_width=128)
 
255
 
256
  def load_audio_waveform(self, uri, return_tensors=True, do_normalize=False):
257
  metadata = torchaudio.info(uri) # sample_rate, num_frames, num_channels, bits_per_sample, encoding=PCM_S
258
+ # assert(metadata.num_channels <= 2), "acoustic file with {} channels.".format(metadata.num_channels) # whisper only accept mono channel audio
259
  waveform_tensor, _ = torchaudio.load(uri, normalize=True)
260
  if self.config.sampling_rate != metadata.sample_rate:
261
  waveform_tensor = torchaudio.functional.resample(waveform_tensor, metadata.sample_rate, self.config.sampling_rate, lowpass_filter_width=128)