Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed chokepoint in diarization for longer audios #9114

10 changes: 5 additions & 5 deletions nemo/collections/asr/parts/utils/offline_clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,11 +406,11 @@ def get_argmin_mat(timestamps_in_scales: List[torch.Tensor]) -> List[torch.Tenso
base_scale_anchor = segment_anchor_list[base_scale_idx]
session_scale_mapping_list = []
for scale_idx in scale_list:
curr_scale_anchor = segment_anchor_list[scale_idx]
curr_mat = torch.tile(curr_scale_anchor, (base_scale_anchor.shape[0], 1))
base_mat = torch.tile(base_scale_anchor, (curr_scale_anchor.shape[0], 1)).t()
argmin_mat = torch.argmin(torch.abs(curr_mat - base_mat), dim=1)
session_scale_mapping_list.append(argmin_mat)
session_scale_mapping = []
for value in base_scale_anchor:
session_scale_mapping.append(torch.argmin(torch.abs(segment_anchor_list[scale_idx] - value)).item())
session_scale_mapping_list.append(torch.tensor(session_scale_mapping, dtype=torch.int64))

return session_scale_mapping_list


Expand Down