Skip to content

Conversation

@Cyrilvallez
Copy link
Member

What does this PR do?

Fixes #39900. Current code calls custom _tie_weights recursively on all modules, but does not recursively ties the embeddings or the encoder/decoder parts

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

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

LGTM otherwise, but this piece of code if very very... tricky haha

# Leading to issues on subsequent calls by different tests or subsequent calls.
self._dynamic_tied_weights_keys = tied_weights

def tie_weights(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

bit scared about the recursivity as we call that function 10 times....

@github-actions
Copy link
Contributor

github-actions bot commented Aug 8, 2025

[For maintainers] Suggested jobs to run (before merge)

run-slow: blip, seamless_m4t, seamless_m4t_v2

@Cyrilvallez Cyrilvallez merged commit a96cccd into main Aug 8, 2025
23 of 25 checks passed
@Cyrilvallez Cyrilvallez deleted the recursive-tie-weights branch August 8, 2025 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Weights not tied when loading from_pretrained with a wrapped model

4 participants