Skip to content

Commit

Permalink
Add explanatory comments for add resizing function in lxmert
Browse files Browse the repository at this point in the history
  • Loading branch information
Prashanth Sateesh authored and Prashanth Sateesh committed Jul 20, 2024
1 parent c023ebb commit 799299e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/transformers/models/lxmert/modeling_lxmert.py
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ def __init__(self, config):
self.visual_losses = visual_losses

def resize_token_embeddings(self, new_num_tokens: int, pad_to_multiple_of: Optional[int] = None) -> nn.Embedding:
# Adding the following steps to resize bias term while resizing embeddings
# Adding the following steps to resize bias term to match the shape of resized embeddings
new_embeddings = super().resize_token_embeddings(new_num_tokens, pad_to_multiple_of)
self.cls.predictions._resize_bias(new_num_tokens)
return new_embeddings
Expand Down

0 comments on commit 799299e

Please sign in to comment.