Skip to content

Commit

Permalink
fix gradient checkpointing in donut_swin
Browse files Browse the repository at this point in the history
  • Loading branch information
SangbumChoi committed Jan 21, 2024
1 parent e834a3e commit 1cf345e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/transformers/models/donut/modeling_donut_swin.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,12 @@ def forward(

if self.gradient_checkpointing and self.training:
layer_outputs = self._gradient_checkpointing_func(
layer_module.__call__, hidden_states, input_dimensions, layer_head_mask, output_attentions
layer_module.__call__,
hidden_states,
input_dimensions,
layer_head_mask,
output_attentions,
always_partition,
)
else:
layer_outputs = layer_module(
Expand Down

0 comments on commit 1cf345e

Please sign in to comment.