From 017398885a6184ce79166bd053ee9d395dc1bd6c Mon Sep 17 00:00:00 2001 From: Yan233_ Date: Wed, 29 Mar 2023 23:32:48 +0800 Subject: [PATCH] Fix hasattr to in method --- modules/sd_models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/sd_models.py b/modules/sd_models.py index 6ea874dfc..f0c13dbd7 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -375,7 +375,7 @@ def enable_midas_autodownload(): def repair_config(sd_config): - if not hasattr(sd_config.model.params, "use_ema"): + if not "use_ema" in sd_config.model.params: sd_config.model.params.use_ema = False if shared.cmd_opts.no_half: @@ -387,7 +387,7 @@ def repair_config(sd_config): sd_config.model.params.first_stage_config.params.ddconfig.attn_type = "vanilla" # For UnCLIP-L, override the hardcoded karlo directory - if hasattr(sd_config.model.params, "noise_aug_config") and hasattr(sd_config.model.params.noise_aug_config.params, "clip_stats_path"): + if "noise_aug_config" in sd_config.model.params and "clip_stats_path" in sd_config.model.params.noise_aug_config.params: karlo_path = os.path.join(paths.models_path, 'karlo') sd_config.model.params.noise_aug_config.params.clip_stats_path = sd_config.model.params.noise_aug_config.params.clip_stats_path.replace("checkpoints/karlo_models", karlo_path)