mirror of
https://github.com/pyannote/pyannote-audio.git
synced 2026-11-20 13:07:51 +09:00
fix: fix support for numpy==2.x
This commit is contained in:
1 parent
2e04ec7fb6
commit
286ea1a4e3
4 files changed
+14
-11
No files matched your search
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## develop
|
||||
|
||||
- fix: fix support for `numpy==2.x` ([@metal3d](https://github.com/metal3d/))
|
||||
|
||||
|
||||
## Version 3.3.1 (2024-06-19)
|
||||
|
||||
|
||||
@@ -400,7 +400,7 @@ class SpeakerDiarization(SpeakerDiarizationMixin, Pipeline):
|
||||
num_chunks, num_frames, local_num_speakers = segmentations.data.shape
|
||||
|
||||
num_clusters = np.max(hard_clusters) + 1
|
||||
clustered_segmentations = np.NAN * np.zeros(
|
||||
clustered_segmentations = np.nan * np.zeros(
|
||||
(num_chunks, num_frames, num_clusters)
|
||||
)
|
||||
|
||||
@@ -515,7 +515,6 @@ class SpeakerDiarization(SpeakerDiarizationMixin, Pipeline):
|
||||
centroids = None
|
||||
|
||||
else:
|
||||
|
||||
# skip speaker embedding extraction with oracle clustering
|
||||
if self.klustering == "OracleClustering" and not return_embeddings:
|
||||
embeddings = None
|
||||
|
||||
@@ -186,7 +186,7 @@ class NeMoPretrainedSpeakerEmbedding(BaseInference):
|
||||
|
||||
# corner case: every signal is too short
|
||||
if max_len < self.min_num_samples:
|
||||
return np.NAN * np.zeros((batch_size, self.dimension))
|
||||
return np.nan * np.zeros((batch_size, self.dimension))
|
||||
|
||||
too_short = wav_lens < self.min_num_samples
|
||||
wav_lens[too_short] = max_len
|
||||
@@ -197,7 +197,7 @@ class NeMoPretrainedSpeakerEmbedding(BaseInference):
|
||||
)
|
||||
|
||||
embeddings = embeddings.cpu().numpy()
|
||||
embeddings[too_short.cpu().numpy()] = np.NAN
|
||||
embeddings[too_short.cpu().numpy()] = np.nan
|
||||
|
||||
return embeddings
|
||||
|
||||
@@ -364,7 +364,7 @@ class SpeechBrainPretrainedSpeakerEmbedding(BaseInference):
|
||||
|
||||
# corner case: every signal is too short
|
||||
if max_len < self.min_num_samples:
|
||||
return np.NAN * np.zeros((batch_size, self.dimension))
|
||||
return np.nan * np.zeros((batch_size, self.dimension))
|
||||
|
||||
too_short = wav_lens < self.min_num_samples
|
||||
wav_lens = wav_lens / max_len
|
||||
@@ -377,7 +377,7 @@ class SpeechBrainPretrainedSpeakerEmbedding(BaseInference):
|
||||
.numpy()
|
||||
)
|
||||
|
||||
embeddings[too_short.cpu().numpy()] = np.NAN
|
||||
embeddings[too_short.cpu().numpy()] = np.nan
|
||||
|
||||
return embeddings
|
||||
|
||||
@@ -594,7 +594,7 @@ class ONNXWeSpeakerPretrainedSpeakerEmbedding(BaseInference):
|
||||
|
||||
imasks = imasks > 0.5
|
||||
|
||||
embeddings = np.NAN * np.zeros((batch_size, self.dimension))
|
||||
embeddings = np.nan * np.zeros((batch_size, self.dimension))
|
||||
|
||||
for f, (feature, imask) in enumerate(zip(features, imasks)):
|
||||
masked_feature = feature[imask]
|
||||
|
||||
@@ -419,7 +419,7 @@ class SpeechSeparation(SpeakerDiarizationMixin, Pipeline):
|
||||
num_chunks, num_frames, local_num_speakers = segmentations.data.shape
|
||||
|
||||
num_clusters = np.max(hard_clusters) + 1
|
||||
clustered_segmentations = np.NAN * np.zeros(
|
||||
clustered_segmentations = np.nan * np.zeros(
|
||||
(num_chunks, num_frames, num_clusters)
|
||||
)
|
||||
|
||||
@@ -644,9 +644,9 @@ class SpeechSeparation(SpeakerDiarizationMixin, Pipeline):
|
||||
len(speaker_activation), dtype=float
|
||||
)
|
||||
|
||||
speaker_activation_with_context[
|
||||
np.concatenate(remaining_zeros)
|
||||
] = 0.0
|
||||
speaker_activation_with_context[np.concatenate(remaining_zeros)] = (
|
||||
0.0
|
||||
)
|
||||
|
||||
discrete_diarization.data.T[i] = speaker_activation_with_context
|
||||
num_sources = sources.data.shape[1]
|
||||
|
||||
Reference in new issue
Block a user