Repository navigation
Adding flexible input sources for Diarization Mixin - #15184
Conversation
Signed-off-by: taejinp <tango4j@gmail.com>
Signed-off-by: tango4j <tango4j@users.noreply.github.com>
KunalDhawan
left a comment
There was a problem hiding this comment.
LGTM, great work @tango4j!
| self.num_mel_frame_per_target_frame = int(self.cfg.get('subsampling_factor', 8)) | ||
|
|
||
| def __getitem__(self, cuts) -> Tuple[torch.Tensor, ...]: | ||
| # NOTE: This end-to-end diarization dataloader only loads the 1st ch of the audio file. |
There was a problem hiding this comment.
Should we add log this somewhere so that users don't run into unexpected issues?
There was a problem hiding this comment.
Added the warning message and made these into one for loop.
Signed-off-by: taejinp <tango4j@gmail.com>
…into sortformer_infer_fix
Signed-off-by: tango4j <tango4j@users.noreply.github.com>
Signed-off-by: taejinp <tango4j@gmail.com>
…into sortformer_infer_fix
| """ | ||
| return super().diarize( | ||
| audio=audio, | ||
| batch_size=batch_size, |
There was a problem hiding this comment.
Yes because if numpy input is assigned to audio, we do not know what sample rate audio time series signal is based on. This is mentioned in the Huggingface README. default is 16000 always.
There was a problem hiding this comment.
Sorry I wasn't quite clear, I'm wondering if we need to return sample_rate here too.
Running the example as per the readme fails when I try it, as sample_rate is not passed through:
from nemo.collections.asr.models import SortformerEncLabelModel
diar_model = SortformerEncLabelModel.from_pretrained("nvidia/diar_streaming_sortformer_4spk-v2")
diar_model.eval()
import numpy as np
# Create dummy audio: 10 seconds of white noise at 16kHz
audio_input = np.random.randn(16000 * 10).astype(np.float32)
diar_model.diarize(audio=audio_input, batch_size=1, sample_rate=16000)There was a problem hiding this comment.
You are correct and I made a mistake.
sample_rate variable is missing in super().diarize() function.
I checked and I missed this part.
I will make a PR that fixes that.
There was a problem hiding this comment.
The diarize() function in this file
NeMo/nemo/collections/asr/parts/mixins/diarization.py
has "sample_rate" so this fix will do the job.
There was a problem hiding this comment.
Perfect, all set now
Appreciate all your hard work!
* Adding flexible input source for Diarization Mixin Signed-off-by: taejinp <tango4j@gmail.com> * Apply isort and black reformatting Signed-off-by: tango4j <tango4j@users.noreply.github.com> --------- Signed-off-by: taejinp <tango4j@gmail.com> Signed-off-by: tango4j <tango4j@users.noreply.github.com> Co-authored-by: tango4j <tango4j@users.noreply.github.com> Signed-off-by: Akhil Varanasi <akhilvaranasi23@gmail.com>
* Adding flexible input source for Diarization Mixin Signed-off-by: taejinp <tango4j@gmail.com> * Apply isort and black reformatting Signed-off-by: tango4j <tango4j@users.noreply.github.com> --------- Signed-off-by: taejinp <tango4j@gmail.com> Signed-off-by: tango4j <tango4j@users.noreply.github.com> Co-authored-by: tango4j <tango4j@users.noreply.github.com>
What does this PR do ?
Reflecting the change requested by:
Issues #14495
Issues #14977
.diarize()(SpkDiarizationMixin) functionCollection: [Note which collection this PR will affect]
Changelog
The following files are changed.
Usage
GitHub Actions CI
The Jenkins CI system has been replaced by GitHub Actions self-hosted runners.
The GitHub Actions CI will run automatically when the "Run CICD" label is added to the PR.
To re-run CI remove and add the label again.
To run CI on an untrusted fork, a NeMo user with write access must first click "Approve and run".
Before your PR is "Ready for review"
Pre checks:
PR Type:
If you haven't finished some of the above items you can still open "Draft" PR.
Who can review?
Anyone in NeMo ASR
Additional Information
Related issues:
Issues #14495 - A request for numpy input for
.diarize()function.Issues #14977 - Duration is not picked up when manifest is used for
.diarize()function.