Skip to content

Projection connector#15468

Open
nune-tadevosyan wants to merge 5 commits intoNVIDIA-NeMo:mainfrom
nune-tadevosyan:projection_connector
Open

Projection connector#15468
nune-tadevosyan wants to merge 5 commits intoNVIDIA-NeMo:mainfrom
nune-tadevosyan:projection_connector

Conversation

@nune-tadevosyan
Copy link
Collaborator

@nune-tadevosyan nune-tadevosyan commented Mar 5, 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 ?

Adds MultiLayerProjectionConnector support for SALM models.

Changelog

  • Adds support for the MultiLayerProjectionConnector.
  • Adds support for initializing SALM model from pretrained checkpoints.

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)

@nune-tadevosyan nune-tadevosyan requested a review from pzelasko March 5, 2026 16:53
setup_speech_encoder(self, pretrained_weights=self.cfg.pretrained_weights)


# Load pretrained weights if provided
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this needed in the PR? Looks to me like a separate feature that we may want to implement in a generic way so that every speechlm2 model can re-use.

if isinstance(self.modality_adapter, (QformerConnector, MultiLayerProjectionConnector)):
# Store as a plain Python attribute (not an nn.Module submodule) to avoid duplicate
# state_dict entries: encoder_multilayer.encoder IS self.encoder, so safetensors
# would de-duplicate them and produce spurious "missing key" warnings on reload.
Copy link
Collaborator

Choose a reason for hiding this comment

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

It might be an overkill. Can we instead do:

# note: not self.encoder
encoder = self.from_config_dict(cfg.encoder)

if isinstance(self.modality_adapter, (QformerConnector, MultiLayerProjectionConnector)):
    self.encoder_multilayer = ConformerMultiLayerFeatureExtractor(encoder, ...)
else:
    self.encoder = encoder

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

missing_keys, unexpected_keys = self.load_state_dict(tensors, strict=False)
logging.warning(f"Missing keys: {missing_keys}")
logging.warning(f"Unexpected keys: {unexpected_keys}")
maybe_install_lora(self)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we move maybe_install_lora back to line 67?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Signed-off-by: Nune <ntadevosyan@nvidia.com>
Signed-off-by: ntadevosyan <ntadevosyan@nvidia.com>
Signed-off-by: ntadevosyan <ntadevosyan@nvidia.com>
Signed-off-by: ntadevosyan <ntadevosyan@nvidia.com>
Signed-off-by: nune-tadevosyan <nune-tadevosyan@users.noreply.github.com>
@pzelasko pzelasko enabled auto-merge (squash) March 9, 2026 17:30
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.

2 participants