repair --no-half for SDXL

This commit is contained in:
AUTOMATIC1111 2023-07-13 17:32:35 +03:00
parent b8159d0919
commit e16ebc917d

View File

@ -395,10 +395,11 @@ def repair_config(sd_config):
if not hasattr(sd_config.model.params, "use_ema"): if not hasattr(sd_config.model.params, "use_ema"):
sd_config.model.params.use_ema = False sd_config.model.params.use_ema = False
if shared.cmd_opts.no_half: if hasattr(sd_config.model.params, 'unet_config'):
sd_config.model.params.unet_config.params.use_fp16 = False if shared.cmd_opts.no_half:
elif shared.cmd_opts.upcast_sampling: sd_config.model.params.unet_config.params.use_fp16 = False
sd_config.model.params.unet_config.params.use_fp16 = True elif shared.cmd_opts.upcast_sampling:
sd_config.model.params.unet_config.params.use_fp16 = True
if getattr(sd_config.model.params.first_stage_config.params.ddconfig, "attn_type", None) == "vanilla-xformers" and not shared.xformers_available: if getattr(sd_config.model.params.first_stage_config.params.ddconfig, "attn_type", None) == "vanilla-xformers" and not shared.xformers_available:
sd_config.model.params.first_stage_config.params.ddconfig.attn_type = "vanilla" sd_config.model.params.first_stage_config.params.ddconfig.attn_type = "vanilla"