Skip to content

fix: tie weights outside _init_model#1817

Merged
akoumpa merged 4 commits into
mainfrom
akoumparouli/fix_tied_weights_init
Apr 14, 2026
Merged

fix: tie weights outside _init_model#1817
akoumpa merged 4 commits into
mainfrom
akoumparouli/fix_tied_weights_init

Conversation

@akoumpa

@akoumpa akoumpa commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

What does this PR do ?

Add a one line overview of what this PR aims to accomplish.

Changelog

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

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?

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

Additional Information

  • Related to # (issue)

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Apr 14, 2026

Copy link
Copy Markdown

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.

@akoumpa akoumpa added the r0.4.0 Auto-cherrypick to release branch. Apply before merge; cherrypick happens after merge. label Apr 14, 2026
@akoumpa

akoumpa commented Apr 14, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test a45ba52

akoumpa added 3 commits April 13, 2026 20:39
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
@akoumpa

akoumpa commented Apr 14, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 07a94bc

@akoumpa

akoumpa commented Apr 14, 2026

Copy link
Copy Markdown
Contributor Author

@HuiyingLi confirmed this working on phi4mm too.

@akoumpa akoumpa merged commit f326651 into main Apr 14, 2026
75 of 78 checks passed
@akoumpa akoumpa deleted the akoumparouli/fix_tied_weights_init branch April 14, 2026 08:01
svcnvidia-nemo-ci pushed a commit that referenced this pull request Apr 14, 2026
* tie weights outside _init_model

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* update test

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* undo test

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add typecasting back

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

---------

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Signed-off-by: NeMo Bot <nemo-bot@nvidia.com>
akoumpa added a commit that referenced this pull request Apr 14, 2026
fix: tie weights outside _init_model (#1817)

* tie weights outside _init_model



* update test



* undo test



* add typecasting back



---------

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Signed-off-by: NeMo Bot <nemo-bot@nvidia.com>
Co-authored-by: Alexandros Koumparoulis <153118171+akoumpa@users.noreply.github.com>
edjson pushed a commit to edjson/Automodel that referenced this pull request Apr 17, 2026
* tie weights outside _init_model

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* update test

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* undo test

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add typecasting back

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

---------

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
edjson pushed a commit to edjson/Automodel that referenced this pull request Apr 18, 2026
* tie weights outside _init_model

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* update test

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* undo test

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add typecasting back

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

---------

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
Signed-off-by: Edison <edisonggacc@gmail.com>
linnanwang pushed a commit that referenced this pull request Apr 24, 2026
* tie weights outside _init_model

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* update test

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* undo test

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add typecasting back

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

---------

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
kashif pushed a commit to kashif/Automodel that referenced this pull request May 25, 2026
* tie weights outside _init_model

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* update test

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* undo test

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

* add typecasting back

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>

---------

Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
yuhezhang-ai added a commit that referenced this pull request Jul 8, 2026
Nemotron-Flash-1B is the tied list-form-tied-keys remote-code model (the
#1817 case): enabling Phase 0 on it proves the force-HF load still ties
when the config requests it — the mirror of the untied Nano-9B coverage.

mistral_7b_hellaswag_fp8 covers the training-time FP8 quantization path;
Phase 0 bounds the FP8-prepared trainer against the raw bf16 reference,
with thresholds loosened for expected quantization error.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Yuhe Zhang <yuhez@nvidia.com>
yuhezhang-ai added a commit that referenced this pull request Jul 9, 2026
…#2942)

_tie_weights_nemo re-tied lm_head.weight to the input embedding for any
model exposing _nemo_tied_weights_keys, without consulting
config.tie_word_embeddings. For untied models this aliased away the
trained lm_head loaded by from_pretrained, and corrupted embeddings/head
on checkpoint resume (both tensors loaded into one shared storage).

Gate the re-tie on the controlling config flag via
get_controlling_tie_word_embeddings. Tied models (the #1817
Nemotron-Flash case) keep the existing re-tie behavior; models without a
config fall back to re-tying.

Fixes #2941

Signed-off-by: Yuhe Zhang <yuhez@nvidia.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

r0.4.0 Auto-cherrypick to release branch. Apply before merge; cherrypick happens after merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant