mirror of
https://github.com/lllyasviel/stable-diffusion-webui-forge.git
synced 2026-04-26 01:09:10 +00:00
Update webui.py
i Update initialization.py initialization initialization Update initialization.py i i Update sd_samplers_common.py Update sd_hijack.py i Update sd_models.py Update sd_models.py Update forge_loader.py Update sd_models.py i Update sd_model.py i Update sd_models.py Create sd_model.py i i Update sd_models.py i Update sd_models.py Update sd_models.py i i Update sd_samplers_common.py i Update sd_models.py Update sd_models.py Update sd_samplers_common.py Update sd_models.py Update sd_models.py Update sd_models.py Update sd_models.py Update sd_samplers_common.py i Update shared_options.py Update prompt_parser.py Update sd_hijack_unet.py i Update sd_models.py Update sd_models.py Update sd_models.py Update devices.py i Update sd_vae.py Update sd_models.py Update processing.py Update ui_settings.py Update sd_models_xl.py i i Update sd_samplers_kdiffusion.py Update sd_samplers_timesteps.py Update ui_settings.py Update cmd_args.py Update cmd_args.py Update initialization.py Update shared_options.py Update initialization.py Update shared_options.py i Update cmd_args.py Update initialization.py Update initialization.py Update initialization.py Update cmd_args.py Update cmd_args.py Update sd_hijack.py
This commit is contained in:
@@ -179,26 +179,11 @@ def manual_cast(target_dtype):
|
||||
|
||||
|
||||
def autocast(disable=False):
|
||||
if disable:
|
||||
return contextlib.nullcontext()
|
||||
|
||||
if fp8 and device==cpu:
|
||||
return torch.autocast("cpu", dtype=torch.bfloat16, enabled=True)
|
||||
|
||||
if fp8 and dtype_inference == torch.float32:
|
||||
return manual_cast(dtype)
|
||||
|
||||
if dtype == torch.float32 or dtype_inference == torch.float32:
|
||||
return contextlib.nullcontext()
|
||||
|
||||
if has_xpu() or has_mps() or cuda_no_autocast():
|
||||
return manual_cast(dtype)
|
||||
|
||||
return torch.autocast("cuda")
|
||||
return contextlib.nullcontext()
|
||||
|
||||
|
||||
def without_autocast(disable=False):
|
||||
return torch.autocast("cuda", enabled=False) if torch.is_autocast_enabled() and not disable else contextlib.nullcontext()
|
||||
return contextlib.nullcontext()
|
||||
|
||||
|
||||
class NansException(Exception):
|
||||
|
||||
Reference in New Issue
Block a user