Signed-off-by: Vladimir Mandic <mandic00@live.com>
pull/4204/head
Vladimir Mandic 2025-09-12 16:28:53 -04:00
parent 175e9cbe29
commit 8cd5fbc926
11 changed files with 11 additions and 11 deletions

View File

@ -85,6 +85,7 @@ ignore = [
"RUF013", # PEP 484 prohibits implicit `Optional`
"RUF015", # Prefer `next(...)` over single element slice
"RUF046", # Value being cast to `int` is already an integer
"RUF059", # Unpacked variables are not used
"RUF051", # Prefer pop over del
]
fixable = ["ALL"]

View File

@ -58,7 +58,7 @@ def FeedForward(dim, mult=4):
def reshape_tensor(x, heads):
bs, length, width = x.shape
bs, length, _width = x.shape
# (bs, length, width) --> (bs, length, n_heads, dim_per_head)
x = x.view(bs, length, heads, -1)
# (bs, length, n_heads, dim_per_head) --> (bs, n_heads, length, dim_per_head)

View File

@ -276,7 +276,7 @@ def vae_decode(latents, model, output_type='np', vae_type='Full', width=None, he
shared.state.end(jobid)
if tensors is not None and len(tensors) > 0:
return vae_postprocess(tensors, model, output_type)
jobid = shared.state.begin('VAE Decode')
if latents.shape[0] == 0:
shared.log.error(f'VAE nothing to decode: {latents.shape}')

View File

@ -541,10 +541,10 @@ class SDNQConfig(QuantizationConfigMixin):
self.modules_dtype_dict = {}
import diffusers.quantizers.auto # noqa: E402,RUF100
import diffusers.quantizers.auto # noqa: E402,RUF100 # pylint: disable=wrong-import-order
diffusers.quantizers.auto.AUTO_QUANTIZER_MAPPING["sdnq"] = SDNQQuantizer
diffusers.quantizers.auto.AUTO_QUANTIZATION_CONFIG_MAPPING["sdnq"] = SDNQConfig
import transformers.quantizers.auto # noqa: E402,RUF100
import transformers.quantizers.auto # noqa: E402,RUF100 # pylint: disable=wrong-import-order
transformers.quantizers.auto.AUTO_QUANTIZER_MAPPING["sdnq"] = SDNQQuantizer
transformers.quantizers.auto.AUTO_QUANTIZATION_CONFIG_MAPPING["sdnq"] = SDNQConfig

View File

@ -1,5 +1,4 @@
import os
import copy
from abc import abstractmethod
from PIL import Image
from modules import modelloader, shared

View File

@ -195,7 +195,7 @@ class Script(scripts_manager.Script):
shared.log.warning(f'ConsiStory: class={shared.sd_model.__class__.__name__} model={shared.sd_model_type} required={supported_model_list}')
return None
subject, concepts, prompts, dropout, sampler, steps, same, queries, sdsa, freeu, freeu_preset, alpha, injection = args # pylint: disable=unused-variable
subject, concepts, prompts, dropout, sampler, steps, same, queries, sdsa, freeu, _freeu_preset, alpha, injection = args # pylint: disable=unused-variable
self.create_model() # create model if not already done
concepts, anchors, prompts, alpha, steps, seed = self.set_args(p, *args) # set arguments

View File

@ -21,7 +21,7 @@ def FeedForward(dim, mult=4):
def reshape_tensor(x, heads):
bs, length, width = x.shape
bs, length, _width = x.shape
# (bs, length, width) --> (bs, length, n_heads, dim_per_head)
x = x.view(bs, length, heads, -1)
# (bs, length, n_heads, dim_per_head) --> (bs, n_heads, length, dim_per_head)

View File

@ -270,7 +270,7 @@ class TransparentVAEDecoder(AutoencoderKL):
alpha = y[..., :1]
fg = y[..., 1:]
B, H, W, C = fg.shape
_B, H, W, _C = fg.shape
cb = checkerboard(shape=(H // 64, W // 64))
cb = cv2.resize(cb, (W, H), interpolation=cv2.INTER_LANCZOS4)
cb = (0.5 + (cb - 0.5) * 0.1)[None, ..., None]

View File

@ -56,7 +56,7 @@ class Script(scripts_manager.Script):
change = (final_denoising_strength - initial_denoising_strength) * strength
return initial_denoising_strength + change
for n in range(initial_batch_count):
for _n in range(initial_batch_count):
p.init_images = initial_init_images
p.denoising_strength = initial_denoising_strength
last_image = None

View File

@ -206,7 +206,7 @@ class Script(scripts_manager.Script):
p.n_iter = 1
state.job_count = batch_count * ((1 if left > 0 else 0) + (1 if right > 0 else 0) + (1 if up > 0 else 0) + (1 if down > 0 else 0))
all_processed_images = []
for i in range(batch_count):
for _i in range(batch_count):
imgs = [init_img] * batch_size
if left > 0:
imgs = expand(imgs, batch_size, left, is_left=True)

View File

@ -49,7 +49,7 @@ def _get_text_embeddings(prompt: str, tokenizer, text_encoder, device):
def _encode_text_sdxl(model: StableDiffusionXLPipeline, prompt: str) -> tuple[dict[str, T], T]:
device = model._execution_device # pylint: disable=protected-access
prompt_embeds, pooled_prompt_embeds, = _get_text_embeddings(prompt, model.tokenizer, model.text_encoder, device) # pylint: disable=unused-variable
prompt_embeds, _pooled_prompt_embeds, = _get_text_embeddings(prompt, model.tokenizer, model.text_encoder, device) # pylint: disable=unused-variable
prompt_embeds_2, pooled_prompt_embeds2, = _get_text_embeddings( prompt, model.tokenizer_2, model.text_encoder_2, device)
prompt_embeds = torch.cat((prompt_embeds, prompt_embeds_2), dim=-1)
text_encoder_projection_dim = model.text_encoder_2.config.projection_dim