Skip to content

Commit cb42793

Browse files
committed
fix
1 parent 14b8057 commit cb42793

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/transformers/trainer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2595,6 +2595,8 @@ def autocast_smart_context_manager(self, cache_enabled: Optional[bool] = True):
25952595
if self.use_cpu_amp
25962596
else torch.cuda.amp.autocast(cache_enabled=cache_enabled, dtype=self.amp_dtype)
25972597
)
2598+
else:
2599+
ctx_manager = contextlib.nullcontext() if sys.version_info >= (3, 7) else contextlib.suppress()
25982600

25992601
return ctx_manager
26002602

0 commit comments

Comments
 (0)