Skip to content

Commit

Permalink
Change resize_token_embeddings to make it return same Class that is p…
Browse files Browse the repository at this point in the history
…assed to it
  • Loading branch information
Prashanth Sateesh authored and Prashanth Sateesh committed Jul 16, 2024
1 parent 6fbea6d commit d9e1b5e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/transformers/modeling_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2096,7 +2096,8 @@ def _get_resized_embeddings(
else:
new_embeddings.weight.data[:n, :] = old_embeddings.weight.data[:n, :]

return new_embeddings
old_embeddings.weight.data = new_embeddings.weight.data
return old_embeddings

def _get_resized_lm_head(
self, old_lm_head: nn.Linear, new_num_tokens: Optional[int] = None, transposed: Optional[bool] = False
Expand Down

0 comments on commit d9e1b5e

Please sign in to comment.