From d67a49aa362010623a619d68fffe53ef45075792 Mon Sep 17 00:00:00 2001 From: Francesco Cariaggi Date: Wed, 17 Jul 2024 21:42:53 +0200 Subject: [PATCH] Pass missing arguments to `SeamlessM4Tv2ConformerEncoderLayer.forward()` when gradient checkpointing is enabled (#31945) * pass missing arguments when gradient checkpointing is enabled for SeamlessM4Tv2 * fix same bug in SeamlessM4Tv1 * pass args, not kwargs --- src/transformers/models/seamless_m4t/modeling_seamless_m4t.py | 2 ++ .../models/seamless_m4t_v2/modeling_seamless_m4t_v2.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py b/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py index 8a15ba68d1cb71..0fe1e9f7efa5ae 100755 --- a/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py +++ b/src/transformers/models/seamless_m4t/modeling_seamless_m4t.py @@ -842,6 +842,8 @@ def forward( hidden_states, attention_mask, relative_position_embeddings, + output_attentions, + conv_attention_mask, ) else: layer_outputs = layer( diff --git a/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py b/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py index a824ff8f24999a..88a8ab466b2081 100644 --- a/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py +++ b/src/transformers/models/seamless_m4t_v2/modeling_seamless_m4t_v2.py @@ -788,6 +788,8 @@ def forward( layer.__call__, hidden_states, attention_mask, + output_attentions, + conv_attention_mask, ) else: layer_outputs = layer(