Skip to content

Commit e35ea73

Browse files
committed
Fix compiler check for adopt so it doesn't fail for torch >= 2 but less than recent with .is_compiling()
1 parent 0b5264a commit e35ea73

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

timm/optim/adopt.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ def _get_scalar_dtype(is_fused=None):
3939

4040

4141
def _is_compiling():
42-
return torch.compiler.is_compiling() if hasattr(torch, 'compiler') else False
42+
if hasattr(torch, 'compiler') and hasattr(torch.compiler, 'is_compiling'):
43+
return torch.compiler.is_compiling()
44+
else:
45+
return False
4346

4447

4548
def _get_value(x):

0 commit comments

Comments
 (0)