-
Notifications
You must be signed in to change notification settings - Fork 31.4k
Description
Hi,
I noticed that the logic of the tie_weights function has changed in the transformers 5.0.0rc.
In v4.x, when tie_word_embeddings=True, weights between embed_tokens.weight and lm_head.weight were always tied, regardless of whether both tensors were present in the checkpoint.
However, in v5.0.0rc, if both embed_tokens.weight and lm_head.weight are explicitly present in the checkpoint, the model no longer ties them, resulting in two independent copies of the weights.
This change affects training behavior: gradients will now be computed and applied separately to the two weight matrices, potentially leading to divergent updates and inconsistent model behavior compared to previous versions.
I'm concerned this might introduce subtle training instabilities or break backward compatibility for users who expect tied embeddings and output layers by default (as was the case in v4.x). I’m wondering whether this change could lead to any unexpected problems?For example, although embed_tokens.weight and lm_head. weight exist in the checkpoint, I still want to tie these two weights.
Thanks!