From 95287a6e64449c9760e9ad3fc584f86fd7692a94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20Engl=C3=A4nder?= Date: Sun, 26 Jan 2025 18:33:49 +0100 Subject: [PATCH] Replace In-Place Operations for Deberta and Deberta-V2 --- src/transformers/models/deberta/modeling_deberta.py | 4 ++-- src/transformers/models/deberta_v2/modeling_deberta_v2.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/transformers/models/deberta/modeling_deberta.py b/src/transformers/models/deberta/modeling_deberta.py index 415c03fa9685..eba94b57ee9d 100644 --- a/src/transformers/models/deberta/modeling_deberta.py +++ b/src/transformers/models/deberta/modeling_deberta.py @@ -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) diff --git a/src/transformers/models/deberta_v2/modeling_deberta_v2.py b/src/transformers/models/deberta_v2/modeling_deberta_v2.py index 177ca3dca551..b02628ed6929 100644 --- a/src/transformers/models/deberta_v2/modeling_deberta_v2.py +++ b/src/transformers/models/deberta_v2/modeling_deberta_v2.py @@ -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)