Fix compiler check for adopt so it doesn't fail for torch >= 2 but less than recent with .is_compiling()

small_384_weights
Ross Wightman 2024-11-13 11:24:01 -08:00
parent 0b5264a108
commit e35ea733ab
1 changed files with 4 additions and 1 deletions

View File

@ -39,7 +39,10 @@ def _get_scalar_dtype(is_fused=None):
def _is_compiling():
return torch.compiler.is_compiling() if hasattr(torch, 'compiler') else False
if hasattr(torch, 'compiler') and hasattr(torch.compiler, 'is_compiling'):
return torch.compiler.is_compiling()
else:
return False
def _get_value(x):