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

tolerance should be set correctly in K2SpeechRecognitionDataset for importing kaldi data #1429

Open
nuaalixu opened this issue Dec 3, 2024 · 1 comment

Comments

@nuaalixu
Copy link

nuaalixu commented Dec 3, 2024

when converting data form old kaldi format to lhotse, it is recommand to use tolerance 100ms.
e.g. In lhotse/lhotse/bin/modes/kaldi.py

    CutSet.from_manifests(
        recordings=recording_set,
        supervisions=maybe_supervision_set,
        features=maybe_feature_set,
        tolerance=0.1,

However, It will raise an exception when the length of Supervisons and Features mismatch.

AssertionError: Supervisions ending after the cut are not supported for ASR 

The exception is due to the value of tol is fixed and too small:
In lhotse/lhotse/dataset/speech_recognition.py

def validate_for_asr(cuts: CutSet) -> None:
    validate(cuts)
    tol = 2e-3  # 1ms
    for cut in cuts:
        for supervision in cut.supervisions:
            assert supervision.start >= -tol, (
                f"Supervisions starting before the cut are not supported for ASR"
                f" (sup id: {supervision.id}, cut id: {cut.id})"
            )

            # Supervision start time is relative to Cut ...
            # https://lhotse.readthedocs.io/en/v0.10_e/cuts.html
            #
            # 'supervision.end' is end of supervision inside the Cut
            assert supervision.end <= cut.duration + tol, (
                f"Supervisions ending after the cut "
                f"are not supported for ASR"
                f" (sup id: {supervision.id}, cut id: {cut.id})"
            )

I suspect tol = 2e-3 doesn't meet the intended specifications.

@pzelasko
Copy link
Collaborator

pzelasko commented Dec 5, 2024

Use lhotse.qa.fix_manifests on the imported supervisions + recordings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants