Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Gradient Checkpointing for Deberta & Deberta-V2 using PEFT / Adapters #35898

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/transformers/models/deberta/modeling_deberta.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,10 @@ def forward(self, input_ids=None, token_type_ids=None, position_ids=None, mask=N

embeddings = inputs_embeds
if self.position_biased_input:
embeddings += position_embeddings
embeddings = embeddings + position_embeddings
if self.token_type_embeddings is not None:
token_type_embeddings = self.token_type_embeddings(token_type_ids)
embeddings += token_type_embeddings
embeddings = embeddings + token_type_embeddings

if self.embed_proj is not None:
embeddings = self.embed_proj(embeddings)
Expand Down
4 changes: 2 additions & 2 deletions src/transformers/models/deberta_v2/modeling_deberta_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,10 +551,10 @@ def forward(self, input_ids=None, token_type_ids=None, position_ids=None, mask=N

embeddings = inputs_embeds
if self.position_biased_input:
embeddings += position_embeddings
embeddings = embeddings + position_embeddings
if self.token_type_embeddings is not None:
token_type_embeddings = self.token_type_embeddings(token_type_ids)
embeddings += token_type_embeddings
embeddings = embeddings + token_type_embeddings

if self.embed_proj is not None:
embeddings = self.embed_proj(embeddings)
Expand Down