From 61b1f67734f445aabdbd941537c22bfe6f9237aa Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 16 Sep 2023 12:59:54 -0400 Subject: [PATCH] Support models without previews. --- comfy/latent_formats.py | 4 ++++ latent_preview.py | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/comfy/latent_formats.py b/comfy/latent_formats.py index 8b59cfbd..fadc0eec 100644 --- a/comfy/latent_formats.py +++ b/comfy/latent_formats.py @@ -1,5 +1,9 @@ class LatentFormat: + scale_factor = 1.0 + latent_rgb_factors = None + taesd_decoder_name = None + def process_in(self, latent): return latent * self.scale_factor diff --git a/latent_preview.py b/latent_preview.py index 30c1d131..87240a58 100644 --- a/latent_preview.py +++ b/latent_preview.py @@ -53,7 +53,9 @@ def get_previewer(device, latent_format): method = args.preview_method if method != LatentPreviewMethod.NoPreviews: # TODO previewer methods - taesd_decoder_path = folder_paths.get_full_path("vae_approx", latent_format.taesd_decoder_name) + taesd_decoder_path = None + if latent_format.taesd_decoder_name is not None: + taesd_decoder_path = folder_paths.get_full_path("vae_approx", latent_format.taesd_decoder_name) if method == LatentPreviewMethod.Auto: method = LatentPreviewMethod.Latent2RGB @@ -68,7 +70,8 @@ def get_previewer(device, latent_format): print("Warning: TAESD previews enabled, but could not find models/vae_approx/{}".format(latent_format.taesd_decoder_name)) if previewer is None: - previewer = Latent2RGBPreviewer(latent_format.latent_rgb_factors) + if latent_format.latent_rgb_factors is not None: + previewer = Latent2RGBPreviewer(latent_format.latent_rgb_factors) return previewer