full codespell coverage

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2026-06-04 12:36:10 +02:00
parent 0bfcdabbbb
commit 5e99dee3c2
103 changed files with 264 additions and 254 deletions
+1 -1
View File
@@ -214,7 +214,7 @@ class ConsistoryExtendAttnSDXLPipeline(
callback_on_step_end_tensor_inputs (`List`, *optional*):
The list of tensor inputs for the `callback_on_step_end` function. The tensors specified in the list
will be passed as `callback_kwargs` argument. You will only be able to include variables listed in the
`._callback_tensor_inputs` attribute of your pipeine class.
`._callback_tensor_inputs` attribute of your pipeline class.
Examples:
+1 -1
View File
@@ -857,7 +857,7 @@ class ConsistorySDXLUNet2DConditionModel(ModelMixin, ConfigMixin, UNet2DConditio
cross_attention_kwargs (`dict`, *optional*):
A kwargs dictionary that if specified is passed along to the [`AttnProcessor`].
added_cond_kwargs: (`dict`, *optional*):
A kwargs dictionary containin additional embeddings that if specified are added to the embeddings that
A kwargs dictionary containing additional embeddings that if specified are added to the embeddings that
are passed along to the UNet blocks.
down_block_additional_residuals (`tuple` of `torch.Tensor`, *optional*):
additional residuals to be added to UNet long skip connections from down blocks to up blocks for
+1 -1
View File
@@ -1157,7 +1157,7 @@ class DemoFusionSDXLPipeline(DiffusionPipeline, FromSingleFileMixin, LoraLoaderM
output = ImagePipelineOutput(images=output_images)
return output
# Overrride to properly handle the loading and unloading of the additional text encoder.
# Override to properly handle the loading and unloading of the additional text encoder.
def load_lora_weights(self, pretrained_model_name_or_path_or_dict: Union[str, Dict[str, torch.Tensor]], **kwargs): # pylint: disable=arguments-differ
# We could have accessed the unet config from `lora_state_dict()` too. We pass
# it here explicitly to be able to tell that it's coming from an SDXL
+2 -2
View File
@@ -940,7 +940,7 @@ class StableDiffusionXLDiffImg2ImgPipeline(DiffusionPipeline, FromSingleFileMixi
num_inference_steps = len(list(filter(lambda ts: ts >= discrete_timestep_cutoff, timesteps)))
timesteps = timesteps[:num_inference_steps]
# prepartions for diff diff
# preparations for diff diff
original_with_noise = self.prepare_latents(
original_image, timesteps, batch_size, num_images_per_prompt, prompt_embeds.dtype, device, generator
)
@@ -1764,7 +1764,7 @@ class StableDiffusionDiffImg2ImgPipeline(DiffusionPipeline):
# 8. Denoising loop
num_warmup_steps = len(timesteps) - num_inference_steps * self.scheduler.order
# prepartions
# preparations
original_with_noise = self.prepare_latents(
image, timesteps, batch_size, num_images_per_prompt, prompt_embeds.dtype, device, generator
)
+1 -1
View File
@@ -118,7 +118,7 @@ class Script(scripts_manager.Script):
for i in range(len(args)):
p.task_args[params[i]] = args[i]
# you can also re-use existing params from `p` object if pipeline wants them, but under a different name
# you can also reuse existing params from `p` object if pipeline wants them, but under a different name
# for example, if pipeline expects 'image' param, but you want to use 'init_images' instead which is what img2img tab uses
# p.task_args['image'] = p.init_images[0]
+1 -1
View File
@@ -1118,7 +1118,7 @@ class StableDiffusionXLFreeScale(DiffusionPipeline, FromSingleFileMixin, LoraLoa
"""
return StableDiffusionXLPipelineOutput(images=results_list)
# Overrride to properly handle the loading and unloading of the additional text encoder.
# Override to properly handle the loading and unloading of the additional text encoder.
def load_lora_weights(self, pretrained_model_name_or_path_or_dict: Union[str, Dict[str, torch.Tensor]], **kwargs):
# We could have accessed the unet config from `lora_state_dict()` too. We pass
# it here explicitly to be able to tell that it's coming from an SDXL
@@ -1174,7 +1174,7 @@ class StableDiffusionXLFreeScaleImg2Img(DiffusionPipeline, FromSingleFileMixin,
"""
return StableDiffusionXLPipelineOutput(images=results_list)
# Overrride to properly handle the loading and unloading of the additional text encoder.
# Override to properly handle the loading and unloading of the additional text encoder.
def load_lora_weights(self, pretrained_model_name_or_path_or_dict: Union[str, Dict[str, torch.Tensor]], **kwargs):
# We could have accessed the unet config from `lora_state_dict()` too. We pass
# it here explicitly to be able to tell that it's coming from an SDXL
@@ -459,7 +459,7 @@ class split_AttnProcessor2_0(torch.nn.Module):
hidden_states_0 = hidden_states_0.view(batch_size, channel, height * width).transpose(1, 2)
hidden_states_1 = hidden_states_1.view(batch_size, channel, height * width).transpose(1, 2)
else:
# directly split sqeuence according to concat dim.
# directly split sequence according to concat dim.
single_dim = original_shape[2] if cat_dim==-2 or cat_dim==2 else original_shape[1]
hidden_states_0 = hidden_states[:, :single_dim*single_dim,:]
hidden_states_1 = hidden_states[:, single_dim*(single_dim+1):,:]
@@ -593,7 +593,7 @@ class sep_split_AttnProcessor2_0(torch.nn.Module):
hidden_states_0 = hidden_states_0.view(batch_size, channel, height * width).transpose(1, 2)
hidden_states_1 = hidden_states_1.view(batch_size, channel, height * width).transpose(1, 2)
else:
# directly split sqeuence according to concat dim.
# directly split sequence according to concat dim.
single_dim = original_shape[2] if cat_dim==-2 or cat_dim==2 else original_shape[1]
hidden_states_0 = hidden_states[:, :single_dim*single_dim,:]
hidden_states_1 = hidden_states[:, single_dim*(single_dim+1):,:]
+2 -2
View File
@@ -65,7 +65,7 @@ def init_adapter_in_unet(
image_projection_layers.append(image_proj_model)
unet.encoder_hid_proj = MultiIPAdapterImageProjection(image_projection_layers)
# Adjust unet config to handle addtional ip hidden states.
# Adjust unet config to handle additional ip hidden states.
unet.config.encoder_hid_dim_type = "ip_image_proj"
unet.to(dtype=dtype, device=device)
@@ -155,7 +155,7 @@ def load_adapter_to_pipe(
image_projection_layers.append(image_proj_model)
unet.encoder_hid_proj = MultiIPAdapterImageProjection(image_projection_layers)
# Adjust unet config to handle addtional ip hidden states.
# Adjust unet config to handle additional ip hidden states.
unet.config.encoder_hid_dim_type = "ip_image_proj"
unet.to(dtype=pipe.dtype, device=pipe.device)
+1 -1
View File
@@ -932,7 +932,7 @@ class InstantIRPipeline(
noise = torch.randn(latents.shape, generator=generator[0] if isinstance(generator, list) else generator, device=self.vae.device, dtype=self.vae.dtype, layout=torch.strided)
bsz = latents.shape[0]
timestep = torch.tensor([timestep]*bsz, device=self.vae.device)
# Note that the latents will be scaled aleady by scheduler.add_noise
# Note that the latents will be scaled already by scheduler.add_noise
latents = self.scheduler.add_noise(latents, noise, timestep)
return latents
+1 -1
View File
@@ -16,7 +16,7 @@ class BaseModel(nn.Module):
"""Called when the training starts
Args:
device (Optional[torch.device], optional): The device to use. Usefull to set
device (Optional[torch.device], optional): The device to use. Useful to set
relevant parameters on the model and embedder to the right device only
once at the start of the training. Defaults to None.
"""
+4 -4
View File
@@ -21,10 +21,10 @@ class BaseConfig:
@classmethod
def from_dict(cls, config_dict: Dict[str, Any]) -> "BaseConfig":
"""Creates a BaseConfig instance from a dictionnary
"""Creates a BaseConfig instance from a dictionary
Args:
config_dict (dict): The Python dictionnary containing all the parameters
config_dict (dict): The Python dictionary containing all the parameters
Returns:
:class:`BaseConfig`: The created instance
@@ -78,10 +78,10 @@ class BaseConfig:
return cls.from_dict(config_dict)
def to_dict(self) -> dict:
"""Transforms object into a Python dictionnary
"""Transforms object into a Python dictionary
Returns:
(dict): The dictionnary containing all the parameters"""
(dict): The dictionary containing all the parameters"""
return asdict(self)
def to_json_string(self):
+5 -5
View File
@@ -84,7 +84,7 @@ class Tiler:
def merge_tiles(
self, tiles: List[List[torch.Tensor]], tiling_method: str = "gaussian"
) -> torch.Tensor:
"""Merge tiles by averaging the overlaping regions
"""Merge tiles by averaging the overlapping regions
Args:
tiles (Dict[str, Tile]): dictionary of processed tiles
tiling_method (str): tiling method. Can be "average", "gaussian" or "linear"
@@ -103,7 +103,7 @@ class Tiler:
)
def _average_merge_tiles(self, tiles: List[List[torch.Tensor]]) -> torch.Tensor:
"""Merge tiles by averaging the overlaping regions
"""Merge tiles by averaging the overlapping regions
Args:
tiles (Dict[str, Tile]): dictionary of processed tiles
Returns:
@@ -149,7 +149,7 @@ class Tiler:
] += 1
# outputs is summed up with this multiplicity
# so we need to divide by the weights wich is either 1, 2 or 4 depending on the region
# so we need to divide by the weights which is either 1, 2 or 4 depending on the region
output = output / weights
return output
@@ -204,7 +204,7 @@ class Tiler:
)
def _gaussian_merge_tiles(self, tiles: List[List[torch.Tensor]]) -> torch.Tensor:
"""Merge tiles by averaging the overlaping regions
"""Merge tiles by averaging the overlapping regions
Args:
List[List[torch.Tensor]]: List of processed tiles
Returns:
@@ -278,7 +278,7 @@ class Tiler:
return b
def _linear_merge_tiles(self, tiles: List[List[torch.Tensor]]) -> torch.Tensor:
"""Merge tiles by blending the overlaping regions
"""Merge tiles by blending the overlapping regions
Args:
tiles (List[List[torch.Tensor]]): List of processed tiles
Returns:
+1 -1
View File
@@ -111,7 +111,7 @@ class DiffusersUNet2DCondWrapper(UNet2DConditionModel):
down_intrablock_additional_residuals_clone = None
# Check diffusers.models.embeddings.py > MultiIPAdapterImageProjectionLayer > forward() for implementation
# Exepected format : List[torch.Tensor] of shape (batch_size, num_image_embeds, embed_dim)
# Expected format : List[torch.Tensor] of shape (batch_size, num_image_embeds, embed_dim)
# with length = number of ip_adapters loaded in the ip_adapter_wrapper
if ip_adapter_cond_embedding is not None:
added_cond_kwargs = {
+1 -1
View File
@@ -3,7 +3,7 @@
# https://huggingface.co/OpenGVLab/InternVL-14B-224px
"""
- [MuLan](https://github.com/mulanai/MuLan) Multi-langunage prompts - wirte your prompts in ~110 auto-detected languages!
- [MuLan](https://github.com/mulanai/MuLan) Multi-langunage prompts - write your prompts in ~110 auto-detected languages!
Compatible with SD15 and SDXL
Enable in scripts -> MuLan and set encoder to `InternVL-14B-224px` encoder
(that is currently only supported encoder, but others will be added)
+1 -1
View File
@@ -61,7 +61,7 @@ def process(
policy=False,
banned=False,
metadata=True,
copy=False, # pylint: disable=unused-argument # compatability
copy=False, # pylint: disable=unused-argument # compatibility
score=0.2,
blocks=3,
censor=[],
+1 -1
View File
@@ -48,7 +48,7 @@ class PixelSmithVAE(ModelMixin, ConfigMixin, FromOriginalModelMixin):
Synthesis with Latent Diffusion Models](https://arxiv.org/abs/2112.10752) paper.
force_upcast (`bool`, *optional*, default to `True`):
If enabled it will force the VAE to run in float32 for high image resolution pipelines, such as SD-XL. VAE
can be fine-tuned / trained to a lower range without loosing too much precision in which case
can be fine-tuned / trained to a lower range without losing too much precision in which case
`force_upcast` can be set to `False` - see: https://huggingface.co/madebyollin/sdxl-vae-fp16-fix
"""
+1 -1
View File
@@ -71,7 +71,7 @@ class Mlp(nn.Module):
x = self.fc1(x)
x = self.act(x)
# x = self.drop(x)
# commit this for the orignal BERT implement
# commit this for the original BERT implement
x = self.ffn_ln(x)
x = self.fc2(x)
+3 -3
View File
@@ -4,7 +4,7 @@ from torch import nn
from einops import rearrange, repeat
import logging
def broadcat(tensors, dim = -1):
def broadcast(tensors, dim = -1):
num_tensors = len(tensors)
shape_lens = set(map(lambda t: len(t.shape), tensors))
assert len(shape_lens) == 1, 'tensors must all have the same number of dimensions'
@@ -60,7 +60,7 @@ class VisionRotaryEmbedding(nn.Module):
freqs_w = torch.einsum('..., f -> ... f', t, freqs)
freqs_w = repeat(freqs_w, '... n -> ... (n r)', r = 2)
freqs = broadcat((freqs_h[:, None, :], freqs_w[None, :, :]), dim = -1)
freqs = broadcast((freqs_h[:, None, :], freqs_w[None, :, :]), dim = -1)
self.register_buffer("freqs_cos", freqs.cos())
self.register_buffer("freqs_sin", freqs.sin())
@@ -106,7 +106,7 @@ class VisionRotaryEmbeddingFast(nn.Module):
freqs = torch.einsum('..., f -> ... f', t, freqs)
freqs = repeat(freqs, '... n -> ... (n r)', r = 2)
freqs = broadcat((freqs[:, None, :], freqs[None, :, :]), dim = -1)
freqs = broadcast((freqs[:, None, :], freqs[None, :, :]), dim = -1)
freqs_cos = freqs.cos().view(-1, freqs.shape[-1])
freqs_sin = freqs.sin().view(-1, freqs.shape[-1])
+1 -1
View File
@@ -27,7 +27,7 @@ def bytes_to_unicode():
The reversible bpe codes work on unicode strings.
This means you need a large # of unicode characters in your vocab if you want to avoid UNKs.
When you're at something like a 10B token dataset you end up needing around 5K for decent coverage.
This is a signficant percentage of your normal, say, 32K bpe vocab.
This is a significant percentage of your normal, say, 32K bpe vocab.
To avoid that, we want lookup tables between utf-8 bytes and unicode strings.
And avoids mapping to whitespace/control characters the bpe code barfs on.
"""
+1 -1
View File
@@ -229,7 +229,7 @@ class StableDiffusionXLPuLIDPipeline:
if len(self.face_helper.cropped_faces) == 0:
raise RuntimeError('facexlib align face fail')
align_face = self.face_helper.cropped_faces[0]
# incase insightface didn't detect face
# in case insightface didn't detect face
if id_ante_embedding is None:
id_ante_embedding = self.handler_ante.get_feat(align_face)
+1 -1
View File
@@ -6,7 +6,7 @@ code from: https://github.com/zacheryvaughn/softfill-pipelines/blob/main/pipelin
sdnext implementation follows after pipeline-end
"""
pnoise2 = None # dynamically instlled and imported module
pnoise2 = None # dynamically installed and imported module
### pipeline start
+2 -2
View File
@@ -144,7 +144,7 @@ class SharedSettingsStackHelper():
shared.opts.data["disable_apply_params"] = ''
def __exit__(self, exc_type, exc_value, tb):
# Restore overriden settings after plot generation
# Restore overridden settings after plot generation
shared.opts.data["disable_apply_metadata"] = self.disable_apply_metadata
shared.opts.data["disable_apply_params"] = self.disable_apply_params
shared.opts.data["extra_networks_default_multiplier"] = self.extra_networks_default_multiplier
@@ -278,7 +278,7 @@ axis_options = [
AxisOption("[Control] End", float, apply_control('control_end')),
AxisOption("[HiDiffusion] T1", float, apply_override('hidiffusion_t1')),
AxisOption("[HiDiffusion] T2", float, apply_override('hidiffusion_t2')),
AxisOption("[HiDiffusion] Agression step", float, apply_field('hidiffusion_steps')),
AxisOption("[HiDiffusion] Aggression step", float, apply_field('hidiffusion_steps')),
AxisOption("[PAG] Attention scale", float, apply_field('cfg_true')),
AxisOption("[PAG] Adaptive scaling", float, apply_field('cfg_adaptive')),
AxisOption("[PAG] Applied layers", str, apply_setting('pag_apply_layers')),