Collab Error

#6
by mjolnirPH - opened

Hi Dwarkesh!

First of all, thanks for this great tool! I came across it today and tried out the your collab notebook. Unfortunately, when it came to the embeddings code, I got this error :

== begin error message
AssertionError Traceback (most recent call last)
in <cell line: 2>()
1 embeddings = np.zeros(shape=(len(segments), 192))
2 for i, segment in enumerate(segments):
----> 3 embeddings[i] = segment_embedding(segment)
4
5 embeddings = np.nan_to_num(embeddings)

1 frames
in segment_embedding(segment)
7 clip = Segment(start, end)
8 waveform, sample_rate = audio.crop(path, clip)
----> 9 return embedding_model(waveform[None])

/usr/local/lib/python3.10/dist-packages/pyannote/audio/pipelines/speaker_verification.py in call(self, waveforms, masks)
332
333 batch_size, num_channels, num_samples = waveforms.shape
--> 334 assert num_channels == 1
335
336 waveforms = waveforms.squeeze(dim=1)

AssertionError:

== end error message

I hope this gets fixed.

Once again, thank you!

to solve this issue , please change the channel of audio to single

from pydub import AudioSegment
sound = AudioSegment.from_wav(path)

Converting the audio to mono

sound = sound.set_channels(1)

output_path = "/kaggle/working/audioSingle.wav"
sound.export(output_path, format="wav")

Sign up or log in to comment