mirror of
https://github.com/huggingface/pytorch-image-models.git
synced 2025-06-03 15:01:08 +08:00
is_scripting() guard on checkpoint_seq
This commit is contained in:
parent
95ec255f7f
commit
72fba669a8
@ -336,7 +336,7 @@ class EfficientFormerStage(nn.Module):
|
||||
|
||||
def forward(self, x):
|
||||
x = self.downsample(x)
|
||||
if self.grad_checkpointing:
|
||||
if self.grad_checkpointing and not torch.jit.is_scripting():
|
||||
x = checkpoint_seq(self.blocks, x)
|
||||
else:
|
||||
x = self.blocks(x)
|
||||
|
@ -499,7 +499,7 @@ class EfficientFormerV2Stage(nn.Module):
|
||||
|
||||
def forward(self, x):
|
||||
x = self.downsample(x)
|
||||
if self.grad_checkpointing:
|
||||
if self.grad_checkpointing and not torch.jit.is_scripting():
|
||||
x = checkpoint_seq(self.blocks, x)
|
||||
else:
|
||||
x = self.blocks(x)
|
||||
|
Loading…
x
Reference in New Issue
Block a user