Skip to content

[MagpieTTS][TTS] ja longform fix and StrEnum import fix#15499

Merged
subhankar-ghosh merged 7 commits into
mainfrom
magpietts_ja_fix
Mar 16, 2026
Merged

[MagpieTTS][TTS] ja longform fix and StrEnum import fix#15499
subhankar-ghosh merged 7 commits into
mainfrom
magpietts_ja_fix

Conversation

@subhankar-ghosh
Copy link
Copy Markdown
Contributor

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 ?

The _initialize_chunked_attn_prior function writes attention prior weights to 5 consecutive text token positions starting at
current_starting_point. The offsets 0–4 are hardcoded with no bounds check. If the chunk has fewer than current_starting_point + 5 tokens, index + 4 goes out of bounds.
This surfaces for Japanese longform because:

  1. Longform splits text into sentence chunks
  2. Japanese sentences can be very short (e.g., 「日本の棚田百選」に選出されている。)
  3. The Japanese phoneme tokenizer produces very few tokens for short sentences — sometimes just 4 including EOS
  4. max_text_len = 4 → valid indices are 0–3 → writing to index 4 crashes

StrEnum was added to Python's standard library enum module in Python 3.11. On Python 3.10, from enum import StrEnum raises an
ImportError at import time, which means the entire eou_classifier module fails to load — crashing any environment running
Python 3.10.

Collection: [Note which collection this PR will affect]

Changelog

  • Add specific line by line info of high level changes in this PR.

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this 

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: subhankar-ghosh <subhankar2321@gmail.com>
Signed-off-by: subhankar-ghosh <subhankar-ghosh@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

[🤖]: Hi @subhankar-ghosh 👋,

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.

Comment thread nemo/collections/tts/metrics/eou_classifier.py
Comment thread nemo/collections/tts/models/magpietts.py
subhankar-ghosh and others added 3 commits March 16, 2026 09:28
Signed-off-by: subhankar-ghosh <subhankar2321@gmail.com>
Signed-off-by: subhankar-ghosh <subhankar-ghosh@users.noreply.github.com>
Added compatibility for StrEnum in Python versions < 3.11.

Signed-off-by: Subhankar Ghosh <subhankarg@nvidia.com>
Signed-off-by: subhankar-ghosh <subhankar-ghosh@users.noreply.github.com>
Copy link
Copy Markdown
Collaborator

@rfejgin rfejgin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but please see comment

for offset, weight in enumerate(prior_weights[:5]):
idx = current_starting_point + offset
if idx < max_text_len:
_attn_prior[_idx, :, idx] = weight
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to name at least one of _idx and idx differently to help distinguish their meaning more easily

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in #15551

@github-actions github-actions Bot removed the Run CICD label Mar 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

[🤖]: Hi @subhankar-ghosh 👋,

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.

@subhankar-ghosh subhankar-ghosh merged commit f767ae5 into main Mar 16, 2026
131 checks passed
@subhankar-ghosh subhankar-ghosh deleted the magpietts_ja_fix branch March 16, 2026 21:03
paarthneekhara pushed a commit to paarthneekhara/NeMo that referenced this pull request Mar 19, 2026
Signed-off-by: subhankar-ghosh <subhankar2321@gmail.com>
Signed-off-by: Paarth Neekhara <paarth.n@gmail.com>
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.

4 participants