diff --git a/CHANGELOG.md b/CHANGELOG.md index dc824b18..b6b0a423 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ - fix(separation): fix clipping issue in speech separation pipeline ([@joonaskalda](https://github.com/joonaskalda/)) - fix(separation): fix alignment between separated sources and diarization ([@Lebourdais](https://github.com/Lebourdais/) and [@clement-pages](https://github.com/clement-pages/)) - fix(doc): fix link to pytorch ([@emmanuel-ferdman](https://github.com/emmanuel-ferdman/)) +- fix(task): fix corner case with small (<9) number of validation samples ([@antoinelaurent](https://github.com/antoinelaurent/)) ## Version 3.3.2 (2024-09-11) diff --git a/pyannote/audio/tasks/segmentation/speaker_diarization.py b/pyannote/audio/tasks/segmentation/speaker_diarization.py index 24461565..04d9e7c2 100644 --- a/pyannote/audio/tasks/segmentation/speaker_diarization.py +++ b/pyannote/audio/tasks/segmentation/speaker_diarization.py @@ -583,7 +583,8 @@ class SpeakerDiarization(SegmentationTask): y_pred = multilabel.cpu().numpy() # prepare 3 x 3 grid (or smaller if batch size is smaller) - num_samples = min(self.batch_size, 9) + num_samples = min(self.batch_size, 9, y.shape[0]) + nrows = math.ceil(math.sqrt(num_samples)) ncols = math.ceil(num_samples / nrows) fig, axes = plt.subplots(