Skip to content

fix: skip instantiation of nested configs overridden by kwargs in ConfigNode - #1397

Merged
thomasdhc merged 1 commit into
mainfrom
oholworthy/config-node-duplicate-instantiation
Feb 26, 2026
Merged

thomasdhc merged 1 commit into
mainfrom
oholworthy/config-node-duplicate-instantiation

Conversation

@oliverholworthy

@oliverholworthy oliverholworthy commented Feb 26, 2026 •

Copy link
Copy Markdown
Contributor
  • ConfigNode.instantiate() unconditionally resolved all nested _target_ configs via _instantiate_value() before applying **kwargs overrides. When callers passed a pre-built object as a kwarg, the nested config was instantiated wastefully and the result immediately discarded.
  • Added a one-line early continue to skip _instantiate_value() for keys already present in kwargs.
  • This eliminates the double-instantiation problem that recipes currently work around (e.g. del cfg_dl.dataset in biencoder, lambda-wrapping collate_fn in LLM fine-tuning).

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?

…figNode

Signed-off-by: Oliver Holworthy <1216955+oliverholworthy@users.noreply.github.com>
@oliverholworthy

Copy link
Copy Markdown
Contributor Author

/ok to test b564933

@akoumpa akoumpa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks a lot @oliverholworthy !

@akoumpa

akoumpa commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

pipeline passed in https://github.com/NVIDIA-NeMo/Automodel/actions/runs/22453694117/job/65035858440 rerunning with docs-only to bypass codecov not reporting status

@akoumpa

akoumpa commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

/ok to test b564933

@thomasdhc
thomasdhc disabled auto-merge February 26, 2026 20:54
@thomasdhc
thomasdhc merged commit 4b416b6 into main Feb 26, 2026
92 checks passed
@thomasdhc
thomasdhc deleted the oholworthy/config-node-duplicate-instantiation branch February 26, 2026 20:54
linnanwang pushed a commit that referenced this pull request Apr 24, 2026
…figNode (#1397)

Signed-off-by: Oliver Holworthy <1216955+oliverholworthy@users.noreply.github.com>
kashif pushed a commit to kashif/Automodel that referenced this pull request May 25, 2026
…figNode (NVIDIA-NeMo#1397)

Signed-off-by: Oliver Holworthy <1216955+oliverholworthy@users.noreply.github.com>

This branch was previously deployed

2 inactive deployments
nemo-ci — b5649337 Deployed Feb 26, 2026 by copy-pr-bot[bot] via L2_HF_Transformer_Finetune #4129
test — b5649337 Deployed Feb 26, 2026 by copy-pr-bot[bot] via cicd-wait-in-queue #4129
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-only With great power comes great responsibility.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants