mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2026-01-09 10:41:15 -08:00
Apply the correct behavior of precision='full'
This commit is contained in:
parent
1fd69655fe
commit
58d5b042cd
1 changed files with 7 additions and 4 deletions
|
|
@ -185,11 +185,14 @@ def autocast(disable=False):
|
|||
if fp8 and device==cpu:
|
||||
return torch.autocast("cpu", dtype=torch.bfloat16, enabled=True)
|
||||
|
||||
if dtype == torch.float32:
|
||||
return contextlib.nullcontext()
|
||||
|
||||
if has_xpu() or has_mps() or cuda_no_autocast():
|
||||
return manual_cast(dtype_inference)
|
||||
return manual_cast(dtype)
|
||||
|
||||
if fp8 and dtype_inference == torch.float32:
|
||||
return manual_cast(dtype)
|
||||
|
||||
if dtype == torch.float32 or dtype_inference == torch.float32:
|
||||
return contextlib.nullcontext()
|
||||
|
||||
return torch.autocast("cuda")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue