diff --git a/pipelines/generic_text_encoder.py b/pipelines/generic_text_encoder.py index 62c392476..1c2662c11 100644 --- a/pipelines/generic_text_encoder.py +++ b/pipelines/generic_text_encoder.py @@ -21,6 +21,8 @@ def get_shared(cls, repo_id, subfolder=None, variant=None, shared_id: str | None identifiers = [] if isinstance(identifiers, str): identifiers = [identifiers] + if not isinstance(identifiers, list): + identifiers = [] identifiers = [identifier.lower() for identifier in identifiers if identifier is not None] shared_id = shared_id or repo_id.lower() if item['cls'] == cls and (not identifiers or any(identifier in shared_id for identifier in identifiers)): diff --git a/pipelines/native_transformer.py b/pipelines/native_transformer.py index 5e1b00321..b282f92e4 100644 --- a/pipelines/native_transformer.py +++ b/pipelines/native_transformer.py @@ -45,7 +45,7 @@ import os import json import time from dataclasses import dataclass, field -from typing import Callable +from typing import Callable, cast import huggingface_hub as hf import torch @@ -185,7 +185,7 @@ def auto_pickup_converter(cls: type) -> Callable[[dict], dict] | None: fn = entry.get("checkpoint_mapping_fn") if fn is None or is_noop_converter(fn): return None - return fn + return cast('Callable[[dict], dict]', fn) # diffusers' mapping fns vary in signature (extra kwargs/config), all compatible at call sites def is_noop_converter(fn: Callable) -> bool: diff --git a/scripts/differential_diffusion.py b/scripts/differential_diffusion.py index 11eb177af..b5bc5cb1a 100644 --- a/scripts/differential_diffusion.py +++ b/scripts/differential_diffusion.py @@ -869,7 +869,7 @@ class StableDiffusionXLDiffImg2ImgPipeline(DiffusionPipeline, FromSingleFileMixi total_time_steps = num_inference_steps #end diff diff change timesteps, num_inference_steps = self.get_timesteps( - num_inference_steps, strength, device, denoising_start=denoising_start if denoising_value_valid else None # pylint: disable=missing-parentheses-for-call-in-test, using-constant-test + num_inference_steps, strength, device, denoising_start=denoising_start if denoising_value_valid(denoising_start) else None ) latent_timestep = timesteps[:1].repeat(batch_size * num_images_per_prompt) diff --git a/scripts/softfill.py b/scripts/softfill.py index 35b2348e9..ac99afa9f 100644 --- a/scripts/softfill.py +++ b/scripts/softfill.py @@ -964,7 +964,7 @@ class StableDiffusionXLSoftFillPipeline( aesthetic_score: float = 6.0, negative_aesthetic_score: float = 2.5, clip_skip: Optional[int] = None, - callback_on_step_end: Optional[Callable[[int, int, Dict], None]] = None, + callback_on_step_end: Optional[Callable[..., Dict]] = None, # invoked as (self, step_index, timestep, callback_kwargs) -> dict callback_on_step_end_tensor_inputs: List[str] = ["latents"], **kwargs, ):