Skip to content

Commit 72fba66

Browse files
committed
is_scripting() guard on checkpoint_seq
1 parent 95ec255 commit 72fba66

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

timm/models/efficientformer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ def __init__(
336336

337337
def forward(self, x):
338338
x = self.downsample(x)
339-
if self.grad_checkpointing:
339+
if self.grad_checkpointing and not torch.jit.is_scripting():
340340
x = checkpoint_seq(self.blocks, x)
341341
else:
342342
x = self.blocks(x)

timm/models/efficientformer_v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ def __init__(
499499

500500
def forward(self, x):
501501
x = self.downsample(x)
502-
if self.grad_checkpointing:
502+
if self.grad_checkpointing and not torch.jit.is_scripting():
503503
x = checkpoint_seq(self.blocks, x)
504504
else:
505505
x = self.blocks(x)

0 commit comments

Comments
 (0)