diff --git a/modules/processing.py b/modules/processing.py index cbf41d853..d2b2bae77 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -543,12 +543,20 @@ def create_infotext(p: StableDiffusionProcessing, all_prompts=None, all_seeds=No index = position_in_batch + iteration * p.batch_size if all_prompts is None: all_prompts = p.all_prompts + if all_negative_prompts is None: + all_negative_prompts = p.all_negative_prompts if all_seeds is None: all_seeds = p.all_seeds if all_subseeds is None: all_subseeds = p.all_subseeds - if all_negative_prompts is None: - all_negative_prompts = p.all_negative_prompts + while len(all_prompts) <= index: + all_prompts.append(all_prompts[-1]) + while len(all_seeds) <= index: + all_seeds.append(all_seeds[-1]) + while len(all_subseeds) <= index: + all_subseeds.append(all_subseeds[-1]) + while len(all_negative_prompts) <= index: + all_negative_prompts.append(all_negative_prompts[-1]) comment = ', '.join(comments) if comments is not None and type(comments) is list else None ops = list(set(p.ops)) ops.reverse() @@ -768,6 +776,8 @@ def process_images(p: StableDiffusionProcessing) -> Processed: def validate_sample(tensor): + if not isinstance(tensor, np.ndarray) and not isinstance(tensor, torch.Tensor): + return tensor if tensor.dtype == torch.bfloat16: # numpy does not support bf16 tensor = tensor.to(torch.float16) if shared.backend == shared.Backend.ORIGINAL: diff --git a/modules/processing_diffusers.py b/modules/processing_diffusers.py index 1a21c34f5..fef1c5c31 100644 --- a/modules/processing_diffusers.py +++ b/modules/processing_diffusers.py @@ -478,6 +478,9 @@ def process_diffusers(p: StableDiffusionProcessing, seeds, prompts, negative_pro p.extra_generation_params["Sampler Eta"] = shared.opts.scheduler_eta if shared.opts.scheduler_eta is not None and shared.opts.scheduler_eta > 0 and shared.opts.scheduler_eta < 1 else None try: output = shared.sd_model(**base_args) # pylint: disable=not-callable + if not hasattr(output, 'images') and hasattr(output, 'frames'): + shared.log.debug(f'Generated: frames={len(output.frames[0])}') + output.images = output.frames[0] except AssertionError as e: shared.log.info(e) except ValueError as e: diff --git a/modules/sd_models.py b/modules/sd_models.py index 1925aae40..ee94ec574 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -637,10 +637,12 @@ def detect_pipeline(f: str, op: str = 'model', warning=True): else: guess = 'Stable Diffusion' # guess by name - if 'LCM_' in f or 'LCM-' or '_LCM' or '-LCM' in f.upper(): + """ + if 'LCM_' in f.upper() or 'LCM-' in f.upper() or '_LCM' in f.upper() or '-LCM' in f.upper(): if shared.backend == shared.Backend.ORIGINAL: warn(f'Model detected as LCM model, but attempting to load using backend=original: {op}={f} size={size} MB') guess = 'Latent Consistency Model' + """ if 'PixArt' in f: if shared.backend == shared.Backend.ORIGINAL: warn(f'Model detected as PixArt Alpha model, but attempting to load using backend=original: {op}={f} size={size} MB') diff --git a/requirements.txt b/requirements.txt index ce5814e92..f65e9fd69 100644 --- a/requirements.txt +++ b/requirements.txt @@ -69,3 +69,4 @@ Pillow==10.1.0 timm==0.9.7 pydantic==1.10.13 typing-extensions==4.8.0 +peft