mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 01:04:32 +02:00
full codespell coverage
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
+1
-1
@@ -38,7 +38,7 @@ def get_gpu_smi():
|
||||
|
||||
|
||||
"""
|
||||
Resut should always be: list[ResGPU]
|
||||
Result should always be: list[ResGPU]
|
||||
class ResGPU(BaseModel):
|
||||
name: str = Field(title="GPU Name")
|
||||
data: dict = Field(title="Name/Value data")
|
||||
|
||||
@@ -217,7 +217,7 @@ class ItemFace(BaseModel):
|
||||
mode: str = Field(title="Mode", default="FaceID", description="The mode to use (available values: FaceID, FaceSwap, PhotoMaker, InstantID).")
|
||||
source_images: list[str] = Field(title="Source Images", description="Source face images, must be base64 encoded containing the image's data.")
|
||||
ip_model: str = Field(title="IPAdapter Model", default="FaceID Base", description="The IPAdapter model to use.")
|
||||
ip_override_sampler: bool = Field(title="IPAdapter Override Sampler", default=True, description="Should the sampler be overriden?")
|
||||
ip_override_sampler: bool = Field(title="IPAdapter Override Sampler", default=True, description="Should the sampler be overridden?")
|
||||
ip_cache_model: bool = Field(title="IPAdapter Cache", default=True, description="Should the IPAdapter model be cached?")
|
||||
ip_strength: float = Field(title="IPAdapter Strength", default=1, ge=0, le=2, description="IPAdapter strength of the source images, must be between 0.0 and 2.0.")
|
||||
ip_structure: float = Field(title="IPAdapter Structure", default=1, ge=0, le=1, description="IPAdapter structure to use, must be between 0.0 and 1.0.")
|
||||
|
||||
@@ -23,7 +23,7 @@ class ResPreprocess(BaseModel):
|
||||
class ReqMask(BaseModel):
|
||||
image: str = Field(title="Image", description="The base64 encoded image")
|
||||
type: str = Field(title="Mask type", description="Type of masking image to return")
|
||||
mask: str | None = Field(title="Mask", description="If optional maks image is not provided auto-masking will be performed")
|
||||
mask: str | None = Field(title="Mask", description="If optional mask image is not provided auto-masking will be performed")
|
||||
model: str | None = Field(title="Model", description="The model to use for preprocessing")
|
||||
params: dict | None = Field(default={}, title="Settings", description="Preprocessor settings")
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ def set_sage_attention(backend: str, device: torch.device):
|
||||
key = key.repeat_interleave(query.size(-3)//key.size(-3), -3)
|
||||
value = value.repeat_interleave(query.size(-3)//value.size(-3), -3)
|
||||
|
||||
# Call pre-selected sage attention implementation
|
||||
# Call preselected sage attention implementation
|
||||
return sage_attn_impl(query, key, value, is_causal, scale)
|
||||
else:
|
||||
if enable_gqa:
|
||||
|
||||
@@ -437,7 +437,7 @@ class SwinTransformer(nn.Module):
|
||||
https://arxiv.org/pdf/2103.14030
|
||||
Args:
|
||||
pretrain_img_size (int): Input image size for training the pretrained model,
|
||||
used in absolute postion embedding. Default 224.
|
||||
used in absolute position embedding. Default 224.
|
||||
patch_size (int | tuple(int)): Patch size. Default: 4.
|
||||
in_chans (int): Number of input image channels. Default: 3.
|
||||
embed_dim (int): Number of linear projection output channels. Default: 96.
|
||||
|
||||
@@ -131,7 +131,7 @@ class Resize(object):
|
||||
# fit height
|
||||
scale_width = scale_height
|
||||
elif self.__resize_method == "minimal":
|
||||
# scale as least as possbile
|
||||
# scale as least as possible
|
||||
if abs(1 - scale_width) < abs(1 - scale_height):
|
||||
# fit width
|
||||
scale_height = scale_width
|
||||
@@ -209,7 +209,7 @@ class Resize(object):
|
||||
|
||||
|
||||
class NormalizeImage(object):
|
||||
"""Normlize image by given mean and std.
|
||||
"""Normalize image by given mean and std.
|
||||
"""
|
||||
|
||||
def __init__(self, mean, std):
|
||||
|
||||
@@ -49,7 +49,7 @@ def estimateleres(img, model, w, h):
|
||||
return prediction
|
||||
|
||||
def generatemask(size):
|
||||
# Generates a Guassian mask
|
||||
# Generates a Gaussian mask
|
||||
mask = np.zeros(size, dtype=np.float32)
|
||||
sigma = int(size[0]/16)
|
||||
k_size = int(2 * np.ceil(2 * int(size[0]/16)) + 1)
|
||||
@@ -395,7 +395,7 @@ def estimateboost(img, model, model_type, pix2pixmodel, max_res=512, depthmap_sc
|
||||
gc.collect()
|
||||
torch_gc()
|
||||
|
||||
# Generate mask used to smoothly blend the local pathc estimations to the base estimate.
|
||||
# Generate mask used to smoothly blend the local patch estimations to the base estimate.
|
||||
# It is arbitrarily large to avoid artifacts during rescaling for each crop.
|
||||
mask_org = generatemask((3000, 3000))
|
||||
mask = mask_org.copy()
|
||||
|
||||
@@ -136,7 +136,7 @@ class BaseModel(ABC):
|
||||
return visual_ret
|
||||
|
||||
def get_current_losses(self):
|
||||
"""Return traning losses / errors. train.py will print out these errors on console, and save them to a file"""
|
||||
"""Return training losses / errors. train.py will print out these errors on console, and save them to a file"""
|
||||
errors_ret = OrderedDict()
|
||||
for name in self.loss_names:
|
||||
if isinstance(name, str):
|
||||
@@ -229,7 +229,7 @@ class BaseModel(ABC):
|
||||
print('-----------------------------------------------')
|
||||
|
||||
def set_requires_grad(self, nets, requires_grad=False):
|
||||
"""Set requies_grad=Fasle for all the networks to avoid unnecessary computations
|
||||
"""Set requies_grad=False for all the networks to avoid unnecessary computations
|
||||
Parameters:
|
||||
nets (network list) -- a list of networks
|
||||
requires_grad (bool) -- whether the networks require gradients or not
|
||||
|
||||
@@ -255,7 +255,7 @@ class GANLoss(nn.Module):
|
||||
"""Create label tensors with the same size as the input.
|
||||
|
||||
Parameters:
|
||||
prediction (tensor) - - tpyically the prediction from a discriminator
|
||||
prediction (tensor) - - typically the prediction from a discriminator
|
||||
target_is_real (bool) - - if the ground truth label is for real images or fake images
|
||||
|
||||
Returns:
|
||||
@@ -272,7 +272,7 @@ class GANLoss(nn.Module):
|
||||
"""Calculate loss given Discriminator's output and grount truth labels.
|
||||
|
||||
Parameters:
|
||||
prediction (tensor) - - tpyically the prediction output from a discriminator
|
||||
prediction (tensor) - - typically the prediction output from a discriminator
|
||||
target_is_real (bool) - - if the ground truth label is for real images or fake images
|
||||
|
||||
Returns:
|
||||
|
||||
@@ -9,7 +9,7 @@ class Pix2Pix4DepthModel(BaseModel):
|
||||
The model training requires '--dataset_mode aligned' dataset.
|
||||
By default, it uses a '--netG unet256' U-Net generator,
|
||||
a '--netD basic' discriminator (PatchGAN),
|
||||
and a '--gan_mode' vanilla GAN loss (the cross-entropy objective used in the orignal GAN paper).
|
||||
and a '--gan_mode' vanilla GAN loss (the cross-entropy objective used in the original GAN paper).
|
||||
|
||||
pix2pix paper: https://arxiv.org/pdf/1611.07004.pdf
|
||||
"""
|
||||
@@ -152,4 +152,4 @@ class Pix2Pix4DepthModel(BaseModel):
|
||||
self.set_requires_grad(self.netD, False) # D requires no gradients when optimizing G
|
||||
self.optimizer_G.zero_grad() # set G's gradients to zero
|
||||
self.backward_G() # calculate graidents for G
|
||||
self.optimizer_G.step() # udpate G's weights
|
||||
self.optimizer_G.step() # update G's weights
|
||||
|
||||
@@ -14,7 +14,7 @@ class BaseOptions():
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
"""Reset the class; indicates the class hasn't been initailized"""
|
||||
"""Reset the class; indicates the class hasn't been initialized"""
|
||||
self.initialized = False
|
||||
|
||||
def initialize(self, parser):
|
||||
|
||||
@@ -125,7 +125,7 @@ class Resize(object):
|
||||
# fit height
|
||||
scale_width = scale_height
|
||||
elif self.__resize_method == "minimal":
|
||||
# scale as least as possbile
|
||||
# scale as least as possible
|
||||
if abs(1 - scale_width) < abs(1 - scale_height):
|
||||
# fit width
|
||||
scale_height = scale_width
|
||||
@@ -195,7 +195,7 @@ class Resize(object):
|
||||
|
||||
|
||||
class NormalizeImage(object):
|
||||
"""Normlize image by given mean and std.
|
||||
"""Normalize image by given mean and std.
|
||||
"""
|
||||
|
||||
def __init__(self, mean, std):
|
||||
|
||||
@@ -109,7 +109,7 @@ class Body(object):
|
||||
limbSeq = [[2, 3], [2, 6], [3, 4], [4, 5], [6, 7], [7, 8], [2, 9], [9, 10], \
|
||||
[10, 11], [2, 12], [12, 13], [13, 14], [2, 1], [1, 15], [15, 17], \
|
||||
[1, 16], [16, 18], [3, 17], [6, 18]]
|
||||
# the middle joints heatmap correpondence
|
||||
# the middle joints heatmap correspondence
|
||||
mapIdx = [[31, 32], [39, 40], [33, 34], [35, 36], [41, 42], [43, 44], [19, 20], [21, 22], \
|
||||
[23, 24], [25, 26], [27, 28], [29, 30], [47, 48], [49, 50], [53, 54], [51, 52], \
|
||||
[55, 56], [37, 38], [45, 46]]
|
||||
|
||||
@@ -285,7 +285,7 @@ class TinyViTBlock(nn.Module):
|
||||
|
||||
Args:
|
||||
dim (int): Number of input channels.
|
||||
input_resolution (tuple[int, int]): Input resulotion.
|
||||
input_resolution (tuple[int, int]): Input resolution.
|
||||
num_heads (int): Number of attention heads.
|
||||
window_size (int): Window size.
|
||||
mlp_ratio (float): Ratio of mlp hidden dim to embedding dim.
|
||||
|
||||
@@ -134,7 +134,7 @@ class Resize(object):
|
||||
# fit height
|
||||
scale_width = scale_height
|
||||
elif self.__resize_method == "minimal":
|
||||
# scale as least as possbile
|
||||
# scale as least as possible
|
||||
if abs(1 - scale_width) < abs(1 - scale_height):
|
||||
# fit width
|
||||
scale_height = scale_width
|
||||
|
||||
@@ -125,7 +125,7 @@ class Resize(object):
|
||||
# fit height
|
||||
scale_width = scale_height
|
||||
elif self.__resize_method == "minimal":
|
||||
# scale as least as possbile
|
||||
# scale as least as possible
|
||||
if abs(1 - scale_width) < abs(1 - scale_height):
|
||||
# fit width
|
||||
scale_height = scale_width
|
||||
@@ -195,7 +195,7 @@ class Resize(object):
|
||||
|
||||
|
||||
class NormalizeImage(object):
|
||||
"""Normlize image by given mean and std.
|
||||
"""Normalize image by given mean and std.
|
||||
"""
|
||||
|
||||
def __init__(self, mean, std):
|
||||
|
||||
@@ -153,7 +153,7 @@ class LinearSplitter(nn.Module):
|
||||
b_prev = nn.functional.interpolate(b_prev, (h,w), mode='bilinear', align_corners=True)
|
||||
|
||||
|
||||
b_prev = b_prev / b_prev.sum(dim=1, keepdim=True) # renormalize for gurantees
|
||||
b_prev = b_prev / b_prev.sum(dim=1, keepdim=True) # renormalize for guarantees
|
||||
# print(b_prev.shape, S_normed.shape)
|
||||
# if is_for_query:(1).expand(-1, b_prev.size(0)//n, -1, -1, -1, -1).flatten(0,1)
|
||||
b = b_prev.unsqueeze(2) * S_normed
|
||||
|
||||
@@ -63,7 +63,7 @@ class ZoeDepthNK(DepthModel):
|
||||
min_temp (int, optional): Lower bound for temperature of output probability distribution. Defaults to 5.
|
||||
max_temp (int, optional): Upper bound for temperature of output probability distribution. Defaults to 50.
|
||||
|
||||
memory_efficient (bool, optional): Whether to use memory efficient version of attractor layers. Memory efficient version is slower but is recommended incase of multiple metric heads in order save GPU memory. Defaults to False.
|
||||
memory_efficient (bool, optional): Whether to use memory efficient version of attractor layers. Memory efficient version is slower but is recommended in case of multiple metric heads in order save GPU memory. Defaults to False.
|
||||
|
||||
train_midas (bool, optional): Whether to train "core", the base midas model. Defaults to True.
|
||||
is_midas_pretrained (bool, optional): Is "core" pretrained? Defaults to True.
|
||||
|
||||
@@ -73,7 +73,7 @@ def set_pipe(p, has_models, unit_type, selected_models, active_model, active_str
|
||||
return pipe
|
||||
if has_models:
|
||||
p.ops.append('control')
|
||||
p.extra_generation_params["Control type"] = unit_type # overriden later with pretty-print
|
||||
p.extra_generation_params["Control type"] = unit_type # overridden later with pretty-print
|
||||
p.extra_generation_params["Control model"] = ';'.join([(m.model_id or '') for m in active_model if m.model is not None])
|
||||
p.extra_generation_params["Control conditioning"] = control_conditioning if isinstance(control_conditioning, list) else [control_conditioning]
|
||||
p.extra_generation_params['Control start'] = control_guidance_start if isinstance(control_guidance_start, list) else [control_guidance_start]
|
||||
|
||||
@@ -345,7 +345,7 @@ class ControlNetXSModel(ModelMixin, ConfigMixin):
|
||||
conditioning_channels=conditioning_channels,
|
||||
)
|
||||
|
||||
# In the mininal implementation setting, we only need the control model up to the mid block
|
||||
# In the minimal implementation setting, we only need the control model up to the mid block
|
||||
del self.control_model.up_blocks
|
||||
del self.control_model.conv_norm_out
|
||||
del self.control_model.conv_out
|
||||
@@ -377,7 +377,7 @@ class ControlNetXSModel(ModelMixin, ConfigMixin):
|
||||
controlnet_conditioning_channel_order (`str`, defaults to `"rgb"`):
|
||||
The channel order of conditional image. Will convert to `rgb` if it's `bgr`.
|
||||
learn_embedding (`bool`, defaults to `False`):
|
||||
Wether to use time embedding of the control model. If yes, the time embedding is a linear interpolation
|
||||
Whether to use time embedding of the control model. If yes, the time embedding is a linear interpolation
|
||||
of the time embeddings of the control and base model with interpolation parameter
|
||||
`time_embedding_mix**3`.
|
||||
time_embedding_mix (`float`, defaults to 1.0):
|
||||
|
||||
+1
-1
@@ -337,7 +337,7 @@ def test_fp16():
|
||||
return fp16_ok
|
||||
elif backend == 'rocm':
|
||||
# gfx1102 (RX 7600, 7500, 7650 and 7700S) causes segfaults with fp16
|
||||
# agent can be overriden to gfx1100 to get gfx1102 working with ROCm so check the gpu name as well
|
||||
# agent can be overridden to gfx1100 to get gfx1102 working with ROCm so check the gpu name as well
|
||||
agent = get_hip_agent()
|
||||
agent_name = getattr(torch.cuda.get_device_properties(device), "name", "AMD Radeon RX 0000")
|
||||
if agent.gfx_version == 0x1102 or (agent.gfx_version == 0x1100 and any(i in agent_name for i in ("7600", "7500", "7650", "7700S"))):
|
||||
|
||||
@@ -62,7 +62,7 @@ class ExtraNetwork:
|
||||
Called by processing on every run. Whatever the extra network is meant to do should be activated here. Passes arguments related to this extra network in params_list. User passes arguments by specifying this in his prompt:
|
||||
<name:arg1:arg2:arg3>
|
||||
Where name matches the name of this ExtraNetwork object, and arg1:arg2:arg3 are any natural number of text arguments separated by colon.
|
||||
Even if the user does not mention this ExtraNetwork in his prompt, the call will stil be made, with empty params_list - in this case, all effects of this extra networks should be disabled.
|
||||
Even if the user does not mention this ExtraNetwork in his prompt, the call will still be made, with empty params_list - in this case, all effects of this extra networks should be disabled.
|
||||
Can be called multiple times before deactivate() - each new call should override the previous call completely.
|
||||
For example, if this ExtraNetwork's name is 'hypernet' and user's prompt is:
|
||||
> "1girl, <hypernet:agm:1.1> <extrasupernet:master:12:13:14> <hypernet:ray>"
|
||||
|
||||
+1
-1
@@ -173,7 +173,7 @@ def run_modelmerger(id_task, **kwargs): # pylint: disable=unused-argument
|
||||
_, extension = os.path.splitext(output_modelname)
|
||||
|
||||
if os.path.exists(output_modelname) and not kwargs.get("overwrite", False):
|
||||
return [*[gr.Dropdown.update(choices=sd_models.checkpoint_titles()) for _ in range(4)], f"Model alredy exists: {output_modelname}"]
|
||||
return [*[gr.Dropdown.update(choices=sd_models.checkpoint_titles()) for _ in range(4)], f"Model already exists: {output_modelname}"]
|
||||
if extension.lower() == ".safetensors":
|
||||
safetensors.torch.save_file(theta_0, output_modelname, metadata=metadata)
|
||||
else:
|
||||
|
||||
@@ -704,7 +704,7 @@ class StableDiffusionXLInstantIDPipeline(StableDiffusionXLControlNetPipeline):
|
||||
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:
|
||||
|
||||
@@ -990,7 +990,7 @@ class StableDiffusionXLInstantIDPipeline(StableDiffusionXLControlNetPipeline):
|
||||
)
|
||||
|
||||
if guess_mode and self.do_classifier_free_guidance:
|
||||
# Infered ControlNet only for the conditional batch.
|
||||
# Inferred ControlNet only for the conditional batch.
|
||||
# To apply the output of ControlNet to both the unconditional and conditional batches,
|
||||
# add 0 to the unconditional batch to keep it unchanged.
|
||||
down_block_res_samples = [torch.cat([torch.zeros_like(d), d]) for d in down_block_res_samples]
|
||||
|
||||
@@ -64,7 +64,7 @@ class Directory(Directory): # pylint: disable=E0102
|
||||
return self
|
||||
|
||||
def _update(self, source:Directory) -> None:
|
||||
assert not source.path or source.path == self.path, f'When updating a directory, the paths must match. Attemped to update Directory `{self.path}` with `{source.path}`'
|
||||
assert not source.path or source.path == self.path, f'When updating a directory, the paths must match. Attempted to update Directory `{self.path}` with `{source.path}`'
|
||||
for dead_path in self.directories:
|
||||
if dead_path not in source.directories:
|
||||
delete_cached_directory(dead_path)
|
||||
|
||||
@@ -550,7 +550,7 @@ def attention_prefill_forward_triton_impl(
|
||||
dropout_mask = None
|
||||
scores_strides = (0, 0, 0, 0)
|
||||
|
||||
# stores LSE the log of the normalization constant / sum of expoential score(unnormalzied probablities)
|
||||
# stores LSE the log of the normalization constant / sum of exponential score(unnormalzied probabilities)
|
||||
if is_varlen:
|
||||
softmax_lse = torch.zeros((q.shape[0], nheads_q), device=q.device, dtype=torch.float32)
|
||||
stride_lse_m, stride_lse_h = softmax_lse.stride()
|
||||
|
||||
@@ -17,7 +17,7 @@ def install_gguf():
|
||||
scripts_dir = os.path.join(os.path.dirname(gguf.__file__), '..', 'scripts')
|
||||
if os.path.exists(scripts_dir):
|
||||
os.rename(scripts_dir, scripts_dir + str(time.time()))
|
||||
# monkey patch transformers/diffusers so they detect newly installed gguf pacakge correctly
|
||||
# monkey patch transformers/diffusers so they detect newly installed gguf package correctly
|
||||
ver = importlib.metadata.version('gguf')
|
||||
transformers.utils.import_utils._is_gguf_available = True # pylint: disable=protected-access
|
||||
transformers.utils.import_utils._gguf_version = ver # pylint: disable=protected-access
|
||||
|
||||
@@ -277,7 +277,7 @@ def make_diffusers_cross_attn_down_block(block_class: Type[torch.nn.Module]) ->
|
||||
T1_ratio = 0
|
||||
T1_start = 0
|
||||
T1_end = 0
|
||||
T1 = 0 # to avoid confict with sdxl-turbo
|
||||
T1 = 0 # to avoid conflict with sdxl-turbo
|
||||
max_timestep = current_steps
|
||||
|
||||
def forward(
|
||||
@@ -323,7 +323,7 @@ def make_diffusers_cross_attn_down_block(block_class: Type[torch.nn.Module]) ->
|
||||
if self.aggressive_raunet:
|
||||
self.T1_start = int(aggressive_step/50 * self.max_timestep)
|
||||
self.T1_end = int(self.max_timestep * self.T1_ratio)
|
||||
self.T1 = 0 # to avoid confict with sdxl-turbo
|
||||
self.T1 = 0 # to avoid conflict with sdxl-turbo
|
||||
else:
|
||||
self.T1 = int(self.max_timestep * self.T1_ratio)
|
||||
|
||||
@@ -410,7 +410,7 @@ def make_diffusers_cross_attn_up_block(block_class: Type[torch.nn.Module]) -> Ty
|
||||
T1_ratio = 0
|
||||
T1_start = 0
|
||||
T1_end = 0
|
||||
T1 = 0 # to avoid confict with sdxl-turbo
|
||||
T1 = 0 # to avoid conflict with sdxl-turbo
|
||||
max_timestep = 50
|
||||
|
||||
def forward(
|
||||
@@ -463,7 +463,7 @@ def make_diffusers_cross_attn_up_block(block_class: Type[torch.nn.Module]) -> Ty
|
||||
if self.aggressive_raunet:
|
||||
self.T1_start = int(aggressive_step/50 * self.max_timestep)
|
||||
self.T1_end = int(self.max_timestep * self.T1_ratio)
|
||||
self.T1 = 0 # to avoid confict with sdxl-turbo
|
||||
self.T1 = 0 # to avoid conflict with sdxl-turbo
|
||||
else:
|
||||
self.T1 = int(self.max_timestep * self.T1_ratio)
|
||||
|
||||
|
||||
@@ -709,7 +709,7 @@ def make_diffusers_sdxl_contrtolnet_ppl(block_class):
|
||||
)
|
||||
|
||||
if guess_mode and self.do_classifier_free_guidance:
|
||||
# Infered ControlNet only for the conditional batch.
|
||||
# Inferred ControlNet only for the conditional batch.
|
||||
# To apply the output of ControlNet to both the unconditional and conditional batches,
|
||||
# add 0 to the unconditional batch to keep it unchanged.
|
||||
down_block_res_samples = [torch.cat([torch.zeros_like(d), d]) for d in down_block_res_samples]
|
||||
|
||||
@@ -32,7 +32,7 @@ def check_grid_size(imgs: list[Image.Image] | list[list[Image.Image]] | None):
|
||||
mp = round(mp / 1000000)
|
||||
ok = mp <= shared.opts.img_max_size_mp
|
||||
if not ok:
|
||||
log.warning(f'Maximum image size exceded: size={mp} maximum={shared.opts.img_max_size_mp} MPixels')
|
||||
log.warning(f'Maximum image size exceeded: size={mp} maximum={shared.opts.img_max_size_mp} MPixels')
|
||||
return ok
|
||||
|
||||
|
||||
|
||||
@@ -477,7 +477,7 @@ def _convert_kohya_sd3_lora_to_diffusers(state_dict):
|
||||
def assign_network_names_to_compvis_modules(sd_model):
|
||||
if sd_model is None:
|
||||
return
|
||||
sd_model = getattr(shared.sd_model, "pipe", shared.sd_model) # wrapped model compatiblility
|
||||
sd_model = getattr(shared.sd_model, "pipe", shared.sd_model) # wrapped model compatibility
|
||||
network_layer_mapping = {}
|
||||
if hasattr(sd_model, 'text_encoder') and sd_model.text_encoder is not None:
|
||||
for name, module in sd_model.text_encoder.named_modules():
|
||||
|
||||
@@ -191,7 +191,7 @@ def make_lora(fn, maxrank, auto_rank, rank_ratio, modules, overwrite):
|
||||
submodel = getattr(shared.sd_model, sub, None)
|
||||
if submodel is not None:
|
||||
modules = submodel.named_modules()
|
||||
task = progress.add_task(description=f"{sub} exctract", total=len(list(modules)))
|
||||
task = progress.add_task(description=f"{sub} extract", total=len(list(modules)))
|
||||
for _name, module in submodel.named_modules():
|
||||
progress.update(task, advance=1)
|
||||
if not hasattr(module, "svdhandler"):
|
||||
|
||||
@@ -28,9 +28,9 @@ def factorization(dimension: int, factor:int=-1) -> tuple[int, int]:
|
||||
second value is higher or equal than first value.
|
||||
|
||||
In LoRA with Kroneckor Product, first value is a value for weight scale.
|
||||
secon value is a value for weight.
|
||||
second value is a value for weight.
|
||||
|
||||
Becuase of non-commutative property, A⊗B ≠ B⊗A. Meaning of two matrices is slightly different.
|
||||
Because of non-commutative property, A⊗B ≠ B⊗A. Meaning of two matrices is slightly different.
|
||||
|
||||
examples
|
||||
factor
|
||||
|
||||
@@ -20,7 +20,7 @@ from modules.merging.merge_PermSpec_SDXL import sdxl_permutation_spec
|
||||
##########################################################
|
||||
# Files in modules.merging are heavily modified
|
||||
# versions of sd-meh by @s1dxl used with his blessing
|
||||
# orginal code can be found @ https://github.com/s1dlx/meh
|
||||
# original code can be found @ https://github.com/s1dlx/meh
|
||||
##########################################################
|
||||
|
||||
MAX_TOKENS = 77
|
||||
|
||||
@@ -112,7 +112,7 @@ def euclidean_add_difference(a: Tensor, b: Tensor, c: Tensor, alpha: float, **kw
|
||||
|
||||
def multiply_difference(a: Tensor, b: Tensor, c: Tensor, alpha: float, beta: float, **kwargs) -> Tensor: # pylint: disable=unused-argument
|
||||
"""
|
||||
Similar to Add Difference but with geometric mean instead of arithmatic mean
|
||||
Similar to Add Difference but with geometric mean instead of arithmetic mean
|
||||
"""
|
||||
diff_a = torch.pow(torch.abs(a.float() - c), (1 - alpha))
|
||||
diff_b = torch.pow(torch.abs(b.float() - c), alpha)
|
||||
|
||||
@@ -17,7 +17,7 @@ def icbi(IM,ZK = 1,SZ = 8,PF = 1,ST = 20,TM = 100,TC = 50,SC = 1,TS = 100,AL = 1
|
||||
:param PF: Potential to be minimized (default:1)
|
||||
:param ST: Maximum number of iterations (default:20)
|
||||
:param TM: Maximum edge step (default:100)
|
||||
:param TC: Edge continuity threshold (deafult:50).
|
||||
:param TC: Edge continuity threshold (default:50).
|
||||
:param SC: Stopping criterion: 1 = change under threshold, 0 = ST iterations (default:1).
|
||||
:param TS: Threshold on image change for stopping iterations (default:100).
|
||||
:param AL: Weight for Curvature Continuity energy (default:1.0).
|
||||
|
||||
@@ -193,7 +193,7 @@ class SwinTransformerBlock(nn.Module):
|
||||
r""" Swin Transformer Block.
|
||||
Args:
|
||||
dim (int): Number of input channels.
|
||||
input_resolution (tuple[int]): Input resulotion.
|
||||
input_resolution (tuple[int]): Input resolution.
|
||||
num_heads (int): Number of attention heads.
|
||||
window_size (int): Window size.
|
||||
shift_size (int): Shift size for SW-MSA.
|
||||
|
||||
@@ -436,7 +436,7 @@ class YoloRestorer(Detailer):
|
||||
pc.init_images = [image]
|
||||
pc.image_mask = [item.mask]
|
||||
pc.overlay_images = []
|
||||
# explictly disable for detailer pass
|
||||
# explicitly disable for detailer pass
|
||||
pc.enable_hr = False
|
||||
pc.do_not_save_samples = True
|
||||
pc.do_not_save_grid = True
|
||||
|
||||
@@ -297,7 +297,7 @@ def process_hires(p: processing.StableDiffusionProcessing, output):
|
||||
output.images = processing_vae.vae_decode(latents=output.images, model=shared.sd_model, vae_type=p.vae_type, output_type='pil', width=p.width, height=p.height)
|
||||
if p.is_control and hasattr(p, 'task_args') and p.task_args.get('image', None) is not None:
|
||||
if hasattr(shared.sd_model, "vae") and output.images is not None and len(output.images) > 0:
|
||||
output.images = processing_vae.vae_decode(latents=output.images, model=shared.sd_model, vae_type=p.vae_type, output_type='pil', width=p.hr_upscale_to_x, height=p.hr_upscale_to_y) # controlnet cannnot deal with latent input
|
||||
output.images = processing_vae.vae_decode(latents=output.images, model=shared.sd_model, vae_type=p.vae_type, output_type='pil', width=p.hr_upscale_to_x, height=p.hr_upscale_to_y) # controlnet cannot deal with latent input
|
||||
update_sampler(p, shared.sd_model, second_pass=True)
|
||||
orig_denoise = p.denoising_strength
|
||||
p.denoising_strength = strength
|
||||
|
||||
@@ -270,7 +270,7 @@ def reconstruct_multicond_batch(c: MulticondLearnedConditioning, current_step):
|
||||
conds_for_batch.append((len(tensors), composable_prompt.weight))
|
||||
tensors.append(composable_prompt.schedules[target_index].cond)
|
||||
conds_list.append(conds_for_batch)
|
||||
# if prompts have wildly different lengths above the limit we'll get tensors fo different shapes and won't be able to torch.stack them. So this fixes that.
|
||||
# if prompts have wildly different lengths above the limit we'll get tensors of different shapes and won't be able to torch.stack them. So this fixes that.
|
||||
token_count = max([x.shape[0] for x in tensors])
|
||||
for i in range(len(tensors)):
|
||||
if tensors[i].shape[0] != token_count:
|
||||
|
||||
@@ -41,7 +41,7 @@ def get_prompts_tokens_with_weights(clip_tokenizer: CLIPTokenizer, prompt: str |
|
||||
text_tokens (list)
|
||||
A list contains token ids
|
||||
text_weight (list)
|
||||
A list contains the correspodent weight of token ids
|
||||
A list contains the correspondent weight of token ids
|
||||
|
||||
Example:
|
||||
import torch
|
||||
|
||||
@@ -437,7 +437,7 @@ class SwinTransformer(nn.Module):
|
||||
https://arxiv.org/pdf/2103.14030
|
||||
Args:
|
||||
pretrain_img_size (int): Input image size for training the pretrained model,
|
||||
used in absolute postion embedding. Default 224.
|
||||
used in absolute position embedding. Default 224.
|
||||
patch_size (int | tuple(int)): Patch size. Default: 4.
|
||||
in_chans (int): Number of input image channels. Default: 3.
|
||||
embed_dim (int): Number of linear projection output channels. Default: 96.
|
||||
|
||||
@@ -139,7 +139,7 @@ def msssim(img1, img2, window_size=11, size_average=True, val_range=None, normal
|
||||
return output
|
||||
|
||||
|
||||
# Classes to re-use window
|
||||
# Classes to reuse window
|
||||
class SSIM(torch.nn.Module):
|
||||
def __init__(self, window_size=11, size_average=True, val_range=None):
|
||||
super().__init__()
|
||||
|
||||
@@ -225,7 +225,7 @@ class DCSolverMultistepScheduler(SchedulerMixin, ConfigMixin):
|
||||
@property
|
||||
def step_index(self):
|
||||
"""
|
||||
The index counter for current timestep. It will increae 1 after each scheduler step.
|
||||
The index counter for current timestep. It will increase 1 after each scheduler step.
|
||||
"""
|
||||
return self._step_index
|
||||
|
||||
@@ -400,7 +400,7 @@ class DCSolverMultistepScheduler(SchedulerMixin, ConfigMixin):
|
||||
if len(args) > 1:
|
||||
sample = args[1]
|
||||
else:
|
||||
raise ValueError("missing `sample` as a required keyward argument")
|
||||
raise ValueError("missing `sample` as a required keyword argument")
|
||||
if timestep is not None:
|
||||
deprecate(
|
||||
"timesteps",
|
||||
@@ -474,12 +474,12 @@ class DCSolverMultistepScheduler(SchedulerMixin, ConfigMixin):
|
||||
if len(args) > 1:
|
||||
sample = args[1]
|
||||
else:
|
||||
raise ValueError(" missing `sample` as a required keyward argument")
|
||||
raise ValueError(" missing `sample` as a required keyword argument")
|
||||
if order is None:
|
||||
if len(args) > 2:
|
||||
order = args[2]
|
||||
else:
|
||||
raise ValueError(" missing `order` as a required keyward argument")
|
||||
raise ValueError(" missing `order` as a required keyword argument")
|
||||
if prev_timestep is not None:
|
||||
deprecate(
|
||||
"prev_timestep",
|
||||
@@ -606,17 +606,17 @@ class DCSolverMultistepScheduler(SchedulerMixin, ConfigMixin):
|
||||
if len(args) > 1:
|
||||
last_sample = args[1]
|
||||
else:
|
||||
raise ValueError(" missing`last_sample` as a required keyward argument")
|
||||
raise ValueError(" missing`last_sample` as a required keyword argument")
|
||||
if this_sample is None:
|
||||
if len(args) > 2:
|
||||
this_sample = args[2]
|
||||
else:
|
||||
raise ValueError(" missing`this_sample` as a required keyward argument")
|
||||
raise ValueError(" missing`this_sample` as a required keyword argument")
|
||||
if order is None:
|
||||
if len(args) > 3:
|
||||
order = args[3]
|
||||
else:
|
||||
raise ValueError(" missing`order` as a required keyward argument")
|
||||
raise ValueError(" missing`order` as a required keyword argument")
|
||||
if this_timestep is not None:
|
||||
deprecate(
|
||||
"this_timestep",
|
||||
|
||||
@@ -81,7 +81,7 @@ class TDDScheduler(DPMSolverSinglestepScheduler):
|
||||
|
||||
if algorithm_type != "dpmsolver++" and final_sigmas_type == "zero":
|
||||
raise ValueError(
|
||||
f"`final_sigmas_type` {final_sigmas_type} is not supported for `algorithm_type` {algorithm_type}. Please chooose `sigma_min` instead."
|
||||
f"`final_sigmas_type` {final_sigmas_type} is not supported for `algorithm_type` {algorithm_type}. Please choose `sigma_min` instead."
|
||||
)
|
||||
|
||||
# setable values
|
||||
@@ -288,7 +288,7 @@ class TDDScheduler(DPMSolverSinglestepScheduler):
|
||||
if len(args) > 2:
|
||||
sample = args[2]
|
||||
else:
|
||||
raise ValueError(" missing `sample` as a required keyward argument")
|
||||
raise ValueError(" missing `sample` as a required keyword argument")
|
||||
if timestep is not None:
|
||||
deprecate(
|
||||
"timesteps",
|
||||
@@ -327,7 +327,7 @@ class TDDScheduler(DPMSolverSinglestepScheduler):
|
||||
if len(args) > 2:
|
||||
sample = args[2]
|
||||
else:
|
||||
raise ValueError(" missing `sample` as a required keyward argument")
|
||||
raise ValueError(" missing `sample` as a required keyword argument")
|
||||
if timestep_list is not None:
|
||||
deprecate(
|
||||
"timestep_list",
|
||||
@@ -404,12 +404,12 @@ class TDDScheduler(DPMSolverSinglestepScheduler):
|
||||
if len(args) > 2:
|
||||
sample = args[2]
|
||||
else:
|
||||
raise ValueError(" missing`sample` as a required keyward argument")
|
||||
raise ValueError(" missing`sample` as a required keyword argument")
|
||||
if order is None:
|
||||
if len(args) > 3:
|
||||
order = args[3]
|
||||
else:
|
||||
raise ValueError(" missing `order` as a required keyward argument")
|
||||
raise ValueError(" missing `order` as a required keyword argument")
|
||||
if timestep_list is not None:
|
||||
deprecate(
|
||||
"timestep_list",
|
||||
@@ -465,7 +465,7 @@ class TDDScheduler(DPMSolverSinglestepScheduler):
|
||||
if len(args) > 1:
|
||||
sample = args[1]
|
||||
else:
|
||||
raise ValueError("missing `sample` as a required keyward argument")
|
||||
raise ValueError("missing `sample` as a required keyword argument")
|
||||
if timestep is not None:
|
||||
deprecate(
|
||||
"timesteps",
|
||||
|
||||
@@ -306,7 +306,7 @@ class FlowUniPCMultistepScheduler(SchedulerMixin, ConfigMixin):
|
||||
sample = args[1]
|
||||
else:
|
||||
raise ValueError(
|
||||
"missing `sample` as a required keyward argument")
|
||||
"missing `sample` as a required keyword argument")
|
||||
if timestep is not None:
|
||||
deprecate(
|
||||
"timesteps",
|
||||
@@ -381,13 +381,13 @@ class FlowUniPCMultistepScheduler(SchedulerMixin, ConfigMixin):
|
||||
sample = args[1]
|
||||
else:
|
||||
raise ValueError(
|
||||
" missing `sample` as a required keyward argument")
|
||||
" missing `sample` as a required keyword argument")
|
||||
if order is None:
|
||||
if len(args) > 2:
|
||||
order = args[2]
|
||||
else:
|
||||
raise ValueError(
|
||||
" missing `order` as a required keyward argument")
|
||||
" missing `order` as a required keyword argument")
|
||||
if prev_timestep is not None:
|
||||
deprecate(
|
||||
"prev_timestep",
|
||||
@@ -520,19 +520,19 @@ class FlowUniPCMultistepScheduler(SchedulerMixin, ConfigMixin):
|
||||
last_sample = args[1]
|
||||
else:
|
||||
raise ValueError(
|
||||
" missing`last_sample` as a required keyward argument")
|
||||
" missing`last_sample` as a required keyword argument")
|
||||
if this_sample is None:
|
||||
if len(args) > 2:
|
||||
this_sample = args[2]
|
||||
else:
|
||||
raise ValueError(
|
||||
" missing`this_sample` as a required keyward argument")
|
||||
" missing`this_sample` as a required keyword argument")
|
||||
if order is None:
|
||||
if len(args) > 3:
|
||||
order = args[3]
|
||||
else:
|
||||
raise ValueError(
|
||||
" missing`order` as a required keyward argument")
|
||||
" missing`order` as a required keyword argument")
|
||||
if this_timestep is not None:
|
||||
deprecate(
|
||||
"this_timestep",
|
||||
|
||||
@@ -214,13 +214,13 @@ def get_closest_checkpoint_match(s: str) -> CheckpointInfo | None:
|
||||
# direct hf url
|
||||
if s.startswith('https://huggingface.co/'):
|
||||
model_name = s.replace('https://huggingface.co/', '')
|
||||
checkpoint_info = CheckpointInfo(model_name) # create a virutal model info
|
||||
checkpoint_info = CheckpointInfo(model_name) # create a virtual model info
|
||||
checkpoint_info.type = 'huggingface'
|
||||
log.debug(f'Seach model: name="{s}" matched="{checkpoint_info.path}" type=huggingface')
|
||||
return checkpoint_info
|
||||
if s.startswith('huggingface/'):
|
||||
model_name = s.replace('huggingface/', '')
|
||||
checkpoint_info = CheckpointInfo(model_name) # create a virutal model info
|
||||
checkpoint_info = CheckpointInfo(model_name) # create a virtual model info
|
||||
checkpoint_info.type = 'huggingface'
|
||||
return checkpoint_info
|
||||
|
||||
|
||||
@@ -458,7 +458,7 @@ def apply_balanced_offload_to_module(module, op="apply", force:bool=False):
|
||||
module.balanced_offload_max_memory = max_memory
|
||||
module.offload_post = shared.sd_model_type in offload_post and module_name.startswith("text_encoder")
|
||||
if shared.opts.layerwise_quantization or getattr(module, 'quantization_method', None) == 'LayerWise':
|
||||
model_quant.apply_layerwise(module, quiet=True) # need to reapply since hooks were removed/readded
|
||||
model_quant.apply_layerwise(module, quiet=True) # need to reapply since hooks were removed/re-added
|
||||
devices.torch_gc(fast=True, force=True, reason='offload')
|
||||
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ dtype_dict = {
|
||||
"float3_e2m0fn": {"min": -4.0, "max": 4.0, "num_bits": 3, "sign": 1, "exponent": 2, "mantissa": 0, "min_normal": 1.0, "target_dtype": "fp3", "torch_dtype": torch.float32, "storage_dtype": torch.uint8, "is_unsigned": False, "is_integer": False, "is_packed": True},
|
||||
#
|
||||
"float2_e1m0fn": {"min": -2.0, "max": 2.0, "num_bits": 2, "sign": 1, "exponent": 1, "mantissa": 0, "min_normal": 2.0, "target_dtype": "fp2", "torch_dtype": torch.float32, "storage_dtype": torch.uint8, "is_unsigned": False, "is_integer": False, "is_packed": True},
|
||||
### Custom Usigned Floats
|
||||
### Custom Unsigned Floats
|
||||
"float16_e1m15fnu": {"min": 0, "max": 3.99993896484375, "num_bits": 16, "sign": 0, "exponent": 1, "mantissa": 15, "min_normal": 1.000030517578125, "target_dtype": "fp16", "torch_dtype": torch.float32, "storage_dtype": torch.uint16, "is_unsigned": True, "is_integer": False, "is_packed": True},
|
||||
"float16_e2m14fnu": {"min": 0, "max": 7.999755859375, "num_bits": 16, "sign": 0, "exponent": 2, "mantissa": 14, "min_normal": 0.500030517578125, "target_dtype": "fp16", "torch_dtype": torch.float32, "storage_dtype": torch.uint16, "is_unsigned": True, "is_integer": False, "is_packed": True},
|
||||
"float16_e3m13fnu": {"min": 0, "max": 31.998046875, "num_bits": 16, "sign": 0, "exponent": 3, "mantissa": 13, "min_normal": 0.1250152587890625, "target_dtype": "fp16", "torch_dtype": torch.float32, "storage_dtype": torch.uint16, "is_unsigned": True, "is_integer": False, "is_packed": True},
|
||||
|
||||
@@ -46,7 +46,7 @@ def load_streamer(files: list[str], state_dict: dict | None = None, key_mapping:
|
||||
|
||||
|
||||
def load_files(files: list[str], state_dict: dict | None = None, key_mapping: dict | None = None, device: torch.device = "cpu", method: str | None = None) -> dict:
|
||||
# note: files is list-of-files within a module for chunked loading, not accross model
|
||||
# note: files is list-of-files within a module for chunked loading, not across model
|
||||
if isinstance(files, str):
|
||||
files = [files]
|
||||
if method is None:
|
||||
|
||||
@@ -541,13 +541,13 @@ class SDNQQuantizer(DiffusersQuantizer, HfQuantizer):
|
||||
|
||||
def check_quantized_param(self, *args, **kwargs) -> bool:
|
||||
"""
|
||||
needed for transformers compatibilty, returns self.check_if_quantized_param
|
||||
needed for transformers compatibility, returns self.check_if_quantized_param
|
||||
"""
|
||||
return self.check_if_quantized_param(*args, **kwargs)
|
||||
|
||||
def param_needs_quantization(self, model, param_name: str, *args, **kwargs) -> bool:
|
||||
"""
|
||||
needed for transformers compatibilty, returns self.check_if_quantized_param
|
||||
needed for transformers compatibility, returns self.check_if_quantized_param
|
||||
"""
|
||||
return self.check_if_quantized_param(model, None, param_name, *args, **kwargs)
|
||||
|
||||
@@ -685,7 +685,7 @@ class SDNQQuantizer(DiffusersQuantizer, HfQuantizer):
|
||||
|
||||
def get_cuda_warm_up_factor(self):
|
||||
"""
|
||||
needed for transformers compatibilty, returns self.get_accelerator_warm_up_factor
|
||||
needed for transformers compatibility, returns self.get_accelerator_warm_up_factor
|
||||
"""
|
||||
return self.get_accelerator_warm_up_factor()
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ def exists(val):
|
||||
def default(val, d):
|
||||
return val if exists(val) else d
|
||||
|
||||
# broadcat, as tortoise-tts was using it
|
||||
# broadcast, as tortoise-tts was using it
|
||||
|
||||
def broadcat(tensors, dim = -1):
|
||||
def broadcast(tensors, dim = -1):
|
||||
broadcasted_tensors = broadcast_tensors(*tensors)
|
||||
return torch.cat(broadcasted_tensors, dim = dim)
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ class Sampler(ABC):
|
||||
f: Callable[[SamplerModelArgs], torch.Tensor],
|
||||
) -> torch.Tensor:
|
||||
"""
|
||||
Generate a new sample given the the intial sample x and score function f.
|
||||
Generate a new sample given the the initial sample x and score function f.
|
||||
"""
|
||||
|
||||
def get_next_timestep(
|
||||
|
||||
@@ -193,10 +193,10 @@ def gather_seq_scatter_heads_qkv(
|
||||
restore_shape: bool = True,
|
||||
):
|
||||
"""
|
||||
A func to sync splited qkv tensor
|
||||
A func to sync split qkv tensor
|
||||
qkv_tensor: the tensor we want to do alltoall with. The last dim must
|
||||
be the projection_idx, which we will split into 3 part. After
|
||||
spliting, the gather idx will be projecttion_idx + 1
|
||||
splitting, the gather idx will be projecttion_idx + 1
|
||||
seq_dim: gather_dim for all2all comm
|
||||
restore_shape: if True, output will has the same shape length as input
|
||||
"""
|
||||
|
||||
@@ -62,7 +62,7 @@ class AutoencoderSmall(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
|
||||
"""
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ def get_text_encoders():
|
||||
|
||||
def deref_tokenizers(tokens, tokenizers):
|
||||
"""
|
||||
Bundled embeddings may have the same name as a seperately loaded embedding, or there may be multiple LoRA with
|
||||
Bundled embeddings may have the same name as a separately loaded embedding, or there may be multiple LoRA with
|
||||
differing numbers of vectors. By editing the AddedToken objects, and deleting the dict keys pointing to them,
|
||||
we can ensure that a smaller embedding will not get tokenized as itself, plus the remaining vectors of the previous.
|
||||
"""
|
||||
@@ -212,7 +212,7 @@ class DirWithTextualInversionEmbeddings:
|
||||
def convert_embedding(tensor, text_encoder, text_encoder_2):
|
||||
"""
|
||||
Given a tensor of shape (b, embed_dim) and two text encoders whose tokenizers match, return a tensor with
|
||||
approximately mathcing meaning, or padding if the input tensor is dissimilar to any frozen text embed
|
||||
approximately matching meaning, or padding if the input tensor is dissimilar to any frozen text embed
|
||||
"""
|
||||
with torch.no_grad():
|
||||
vectors = []
|
||||
@@ -256,7 +256,7 @@ class EmbeddingDatabase:
|
||||
|
||||
def load_diffusers_embedding(self, filename: str | list[str] | None = None, data: dict | None = None):
|
||||
"""
|
||||
File names take precidence over bundled embeddings passed as a dict.
|
||||
File names take precedence over bundled embeddings passed as a dict.
|
||||
Bundled embeddings are automatically set to overwrite previous embeddings.
|
||||
"""
|
||||
with limit_errors("load_diffusers_embedding") as elimit:
|
||||
|
||||
@@ -245,7 +245,7 @@ def bipartite_soft_matching_random2d(metric: torch.Tensor,
|
||||
|
||||
class TokenMergeAttentionProcessor:
|
||||
def __init__(self):
|
||||
# priortize torch2's flash attention, if not fall back to xformers then regular attention
|
||||
# prioritize torch2's flash attention, if not fall back to xformers then regular attention
|
||||
if torch2_is_available:
|
||||
self.attn_method = "torch2"
|
||||
elif xformers_is_available:
|
||||
|
||||
@@ -91,7 +91,7 @@ class InputAccordion(gr.Checkbox): # unused
|
||||
return "checkbox"
|
||||
|
||||
|
||||
class ResizeHandleRow(gr.Row): # unusued
|
||||
class ResizeHandleRow(gr.Row): # unused
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.elem_classes.append("resize-handle-row")
|
||||
|
||||
@@ -474,7 +474,7 @@ def create_ui():
|
||||
list_extensions()
|
||||
gr.HTML('''<span style="color: var(--body-text-color)">
|
||||
<h2>Extension list</h2>
|
||||
- Refesh extension list to download latest list with status<br>
|
||||
- Refresh extension list to download latest list with status<br>
|
||||
- Check status of an extension by looking at status icon before installing it<br>
|
||||
- After any operation such as install/uninstall or enable/disable, please restart the server<br>
|
||||
</span>''')
|
||||
|
||||
Reference in New Issue
Block a user