Skip to content

fix: count_input_cfg_levels now resolves string file references#15646

Merged
XuesongYang merged 3 commits into
NVIDIA-NeMo:mainfrom
XuesongYang:xueyang/pr-bugfix-reweight
May 1, 2026
Merged

fix: count_input_cfg_levels now resolves string file references#15646
XuesongYang merged 3 commits into
NVIDIA-NeMo:mainfrom
XuesongYang:xueyang/pr-bugfix-reweight

Conversation

@XuesongYang
Copy link
Copy Markdown
Collaborator

@XuesongYang XuesongYang commented Apr 27, 2026

When input_cfg is overridden via CLI to a YAML file path (e.g. model.train_ds.input_cfg=train_all.yaml), the level counter only saw the top-level string and reported 1 level, causing reweight_temperature to broadcast incorrectly. Now it loads referenced YAML files to discover nested input_cfg keys, matching the runtime behavior of parse_and_combine_datasets.

related: #15200

Copilot AI review requested due to automatic review settings April 27, 2026 18:54
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented Apr 27, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes incorrect reweight_temperature broadcasting when input_cfg is overridden to a YAML filepath by making count_input_cfg_levels() resolve and traverse referenced YAML configs (matching parse_and_combine_datasets behavior).

Changes:

  • Update count_input_cfg_levels() to treat string/Path input_cfg values as YAML file references and traverse nested input_cfg keys.
  • Add unit tests covering input_cfg specified as YAML file paths, including nested file references and unresolvable strings.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
nemo/collections/common/data/lhotse/cutset.py Resolve input_cfg string/Path YAML references during depth counting to align with runtime dataset parsing.
tests/collections/common/test_lhotse_temperature_reweighting.py Add coverage for YAML-file-based input_cfg depth counting, including nested references.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread nemo/collections/common/data/lhotse/cutset.py
Comment thread tests/collections/common/test_lhotse_temperature_reweighting.py Outdated
Comment thread nemo/collections/common/data/lhotse/cutset.py Outdated
@XuesongYang
Copy link
Copy Markdown
Collaborator Author

/ok to test 231f656

@github-actions
Copy link
Copy Markdown
Contributor

[🤖]: Hi @XuesongYang 👋,

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.

@XuesongYang XuesongYang enabled auto-merge (squash) April 29, 2026 23:29
if key not in _cache:
try:
_cache[key] = load_yaml(key)
except Exception:
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.

Can you make this Exception tighter?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done!

When input_cfg is overridden via CLI to a YAML file path (e.g.
model.train_ds.input_cfg=train_all.yaml), the level counter only saw
the top-level string and reported 1 level, causing reweight_temperature
to broadcast incorrectly. Now it loads referenced YAML files to discover
nested input_cfg keys, matching the runtime behavior of
parse_and_combine_datasets.

Signed-off-by: Xuesong Yang <1646669+XuesongYang@users.noreply.github.com>
…st name

- Cache resolved YAML files in _resolve_if_path to avoid redundant
  disk/network I/O for sibling groups referencing the same file
- Add logging.debug when a path cannot be resolved, so failures
  are never fully silent
- Rename misleading test to match its assertion (total depth is 2,
  not 1; the unresolvable string is treated as a leaf)

Signed-off-by: Xuesong Yang <1646669+XuesongYang@users.noreply.github.com>
The broad  silently swallowed all errors when
_resolve_if_path could not load a YAML file, masking real problems
(permission errors, malformed YAML, etc.).

The only legitimate failure case is FileNotFoundError: when a nested
input_cfg YAML contains OmegaConf interpolations like
, raw yaml.load returns them as
literal strings that don't exist on disk.  parse_and_combine_datasets
resolves these later via OmegaConf.create().  All other errors should
propagate immediately since they would also crash parse_and_combine_datasets.

Also documents file-path input_cfg depth counting in the RST docs.

Signed-off-by: Xuesong Yang <1646669+XuesongYang@users.noreply.github.com>
@XuesongYang XuesongYang force-pushed the xueyang/pr-bugfix-reweight branch from 231f656 to 296def8 Compare May 1, 2026 05:06
@github-actions github-actions Bot added audio and removed TTS labels May 1, 2026
@XuesongYang
Copy link
Copy Markdown
Collaborator Author

/ok to test 296def8

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

[🤖]: Hi @XuesongYang 👋,

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.

@XuesongYang XuesongYang merged commit 6335c7c into NVIDIA-NeMo:main May 1, 2026
190 of 191 checks passed
@XuesongYang XuesongYang deleted the xueyang/pr-bugfix-reweight branch May 2, 2026 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants