diff --git a/modules/processing_diffusers.py b/modules/processing_diffusers.py index 335122b45..6fa8cec24 100644 --- a/modules/processing_diffusers.py +++ b/modules/processing_diffusers.py @@ -86,7 +86,6 @@ def process_diffusers(p: processing.StableDiffusionProcessing): denoising_start=0 if use_refiner_start else p.refiner_start if use_denoise_start else None, denoising_end=p.refiner_start if use_refiner_start else 1 if use_denoise_start else None, output_type='latent' if hasattr(shared.sd_model, 'vae') else 'np', - # output_type='pil', clip_skip=p.clip_skip, desc='Base', ) diff --git a/modules/processing_vae.py b/modules/processing_vae.py index e8bea9a8c..b5ad196ed 100644 --- a/modules/processing_vae.py +++ b/modules/processing_vae.py @@ -1,5 +1,6 @@ import os import time +import numpy as np import torch import torchvision.transforms.functional as TF from modules import shared, devices, sd_models, sd_vae, sd_vae_taesd @@ -157,12 +158,15 @@ def vae_decode(latents, model, output_type='np', full_quality=True, width=None, else: decoded = taesd_vae_decode(latents=latents) - if hasattr(model, 'image_processor'): - imgs = model.image_processor.postprocess(decoded, output_type=output_type) + if torch.is_tensor(decoded): + if hasattr(model, 'image_processor'): + imgs = model.image_processor.postprocess(decoded, output_type=output_type) + else: + import diffusers + model.image_processor = diffusers.image_processor.VaeImageProcessor() + imgs = model.image_processor.postprocess(decoded, output_type=output_type) else: - import diffusers - model.image_processor = diffusers.image_processor.VaeImageProcessor() - imgs = model.image_processor.postprocess(decoded, output_type=output_type) + imgs = decoded if isinstance(decoded, list) or isinstance(decoded, np.ndarray) else [decoded] shared.state.job = prev_job if shared.cmd_opts.profile or debug: diff --git a/modules/sd_samplers.py b/modules/sd_samplers.py index b7c90e603..5694dd096 100644 --- a/modules/sd_samplers.py +++ b/modules/sd_samplers.py @@ -74,6 +74,9 @@ def create_sampler(name, model): shared.log.warning(f'FLUX: sampler="{name}" unsupported') # sampler.sampler.register_to_config(base_image_seq_len=256, max_image_seq_len=4096, base_shift=0.5, max_shift=1.15) return None + if 'Lumina' in model.__class__.__name__: + shared.log.warning(f'AlphaVLLM-Lumina: sampler="{name}" unsupported') + return if not hasattr(model, 'scheduler_config'): model.scheduler_config = sampler.sampler.config.copy() model.scheduler = sampler.sampler diff --git a/modules/sd_samplers_common.py b/modules/sd_samplers_common.py index 1d4db96cb..1b1cd189a 100644 --- a/modules/sd_samplers_common.py +++ b/modules/sd_samplers_common.py @@ -41,10 +41,11 @@ def single_sample_to_image(sample, approximation=None): approximation = 0 # normal sample is [4,64,64] try: - if sample.dtype == torch.bfloat16: + if sample.dtype == torch.bfloat16 and (approximation == 0 or approximation == 1): sample = sample.to(torch.float16) except Exception as e: warn_once(f'live preview: {e}') + if len(sample.shape) > 4: # likely unknown video latent (e.g. svd) return Image.new(mode="RGB", size=(512, 512)) if len(sample) == 16: # sd_cascade @@ -58,6 +59,7 @@ def single_sample_to_image(sample, approximation=None): sample_min = torch.min(sample) if sample_min < -5: sample = sample * (5 / abs(sample_min)) + if approximation == 2: # TAESD x_sample = sd_vae_taesd.decode(sample) x_sample = (1.0 + x_sample) / 2.0 # preview requires smaller range