mirror of
https://github.com/huggingface/transformers.git
synced 2025-08-02 11:11:05 +06:00
didn't exist in pt-1.9 (#17644)
This commit is contained in:
parent
fba0b6a820
commit
df1ec6b122
@ -305,7 +305,10 @@ def is_torch_bf16_available():
|
||||
is_torch_gpu_bf16_available = False
|
||||
|
||||
# checking CPU
|
||||
if not hasattr(torch.cpu.amp, "autocast"):
|
||||
try:
|
||||
# multiple levels of AttributeError depending on the pytorch version so do them all in one check
|
||||
_ = torch.cpu.amp.autocast
|
||||
except AttributeError:
|
||||
is_torch_cpu_bf16_available = False
|
||||
|
||||
return is_torch_cpu_bf16_available or is_torch_gpu_bf16_available
|
||||
|
Loading…
Reference in New Issue
Block a user