Skip to content

Conversation

@nithinraok
Copy link
Member

@nithinraok nithinraok commented Jan 2, 2026

Important

The Update branch button must only be pressed in very rare occassions.
An outdated branch is never blocking the merge of a PR.
Please reach out to the automation team before pressing that button.

What does this PR do ?

Fixes #15224

Collection: ASR

Changelog

  • After chunking and while merging confidences are ignored

Usage

from nemo.collections.asr.models import EncDecMultiTaskModel
from omegaconf import OmegaConf
from nemo.collections.asr.parts.submodules.multitask_greedy_decoding import AEDGreedyInferConfig
from nemo.collections.asr.parts.utils.asr_confidence_utils import ConfidenceConfig


model = EncDecMultiTaskModel.from_pretrained("nvidia/canary-1b-v2")

decode_cfg = OmegaConf.create({
    'strategy': 'greedy',
    'greedy': AEDGreedyInferConfig(preserve_token_confidence=True),
    'confidence_cfg': ConfidenceConfig(preserve_token_confidence=True, preserve_word_confidence=True)
})
model.change_decoding_strategy(decode_cfg)

audio_path = <path_to_audio_file>

hypotheses = model.transcribe(
    audio=audio_path,
    batch_size=1,
    return_hypotheses=True,
)

print(hypotheses)


# len of y sequence
print(f"len of y sequence: {len(hypotheses[0].y_sequence)}")

# len of token confidence
print(f"len of token confidence: {len(hypotheses[0].token_confidence)}")

# len of word confidence
print(f"len of word confidence: {len(hypotheses[0].word_confidence)}")


# Check for CTC BPE Model 
from nemo.collections.asr.parts.submodules.ctc_greedy_decoding import GreedyCTCInferConfig
from nemo.collections.asr.models import ASRModel
model = ASRModel.from_pretrained("nvidia/parakeet-ctc-0.6b")

decode_cfg = OmegaConf.create({
    'strategy': 'greedy',
    'greedy': GreedyCTCInferConfig(preserve_frame_confidence=True),
    'confidence_cfg': ConfidenceConfig(preserve_token_confidence=True, preserve_word_confidence=True)
})
model.change_decoding_strategy(decode_cfg)

hypotheses = model.transcribe(
    audio=audio_path,
    batch_size=1,
    return_hypotheses=True,
)

print(hypotheses)

# len of y sequence
print(f"len of y sequence: {len(hypotheses[0].y_sequence)}")

# len of token confidence
print(f"len of token confidence: {len(hypotheses[0].token_confidence)}")

# len of word confidence
print(f"len of word confidence: {len(hypotheses[0].word_confidence)}")

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:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
    • Reviewer: Does the PR have correct import guards for all optional libraries?

PR Type:

  • New Feature
  • Bugfix
  • Documentation

If you haven't finished some of the above items you can still open "Draft" PR.

Who can review?

Anyone in the community is free to review the PR once the checks have passed.
Contributor guidelines contains specific people who can review PRs to various areas.

Additional Information

  • Related to # (issue)

Signed-off-by: nithinraok <nithinrao.koluguri@gmail.com>
Signed-off-by: nithinraok <nithinrao.koluguri@gmail.com>
Signed-off-by: nithinraok <nithinraok@users.noreply.github.com>
Signed-off-by: nithinraok <nithinrao.koluguri@gmail.com>
@github-actions
Copy link
Contributor

github-actions bot commented Jan 3, 2026

[🤖]: Hi @nithinraok 👋,

We wanted to let you know that a CICD pipeline for this PR just finished successfully.

So it might be time to merge this PR or get some approvals.

//cc @chtruong814 @ko3n1g @pablo-garay @thomasdhc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Canary models expose confidence estimation of words/tokens

2 participants