mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
fix pipe detection when processing prompts
This commit is contained in:
Submodule extensions-builtin/sd-webui-controlnet updated: f77c5eb5fa...56d575e8dd
@@ -27,7 +27,7 @@
|
||||
--button-secondary-text-color: white;
|
||||
--button-secondary-background-fill: linear-gradient(to bottom right, var(--neutral-400), var(--neutral-700));
|
||||
--button-secondary-background-fill-hover: linear-gradient(to bottom right, var(--neutral-700), var(--neutral-400));
|
||||
--block-title-text-color: var(--neutral-900);
|
||||
--block-title-text-color: var(--neutral-300);
|
||||
--radius-sm: 2px;
|
||||
--radius-lg: 4px;
|
||||
--spacing-md: 4px;
|
||||
@@ -134,7 +134,7 @@ svg.feather.feather-image, .feather .feather-image { display: none }
|
||||
--background-fill-secondary: none;
|
||||
--border-color-accent: var(--background-color);
|
||||
--border-color-primary: var(--background-color);
|
||||
--link-text-color-active: var(--secondary-500);
|
||||
--link-text-color-active: var(--primary-500);
|
||||
--link-text-color: var(--secondary-500);
|
||||
--link-text-color-hover: var(--secondary-400);
|
||||
--link-text-color-visited: var(--secondary-600);
|
||||
|
||||
@@ -118,15 +118,15 @@ def compel_encode_prompt(
|
||||
is_refiner: bool = None,
|
||||
clip_skip: typing.Optional[int] = None,
|
||||
):
|
||||
if shared.sd_model_type not in {"sd", "sdxl"}:
|
||||
shared.log.warning(f"Prompt parser: Compel not supported: {type(pipeline).__name__}")
|
||||
if 'StableDiffusion' not in pipeline.__class__.__name__:
|
||||
shared.log.warning(f"Prompt parser: Compel not supported: {pipeline.__class__.__name__}")
|
||||
return (None, None, None, None)
|
||||
|
||||
if not is_refiner and shared.sd_model_type == "sdxl":
|
||||
if 'XL' in pipeline.__class__.__name__ and not is_refiner:
|
||||
embedding_type = ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED
|
||||
if clip_skip is not None and clip_skip > 1:
|
||||
shared.log.warning(f"Prompt parser SDXL unsupported: clip_skip={clip_skip}")
|
||||
elif is_refiner and shared.sd_refiner_type == "sdxl":
|
||||
elif 'XL' in pipeline.__class__.__name__ and is_refiner:
|
||||
embedding_type = ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED
|
||||
if clip_skip is not None and clip_skip > 1:
|
||||
shared.log.warning(f"Prompt parser SDXL unsupported: clip_skip={clip_skip}")
|
||||
|
||||
@@ -30,11 +30,11 @@ def single_sample_to_image(sample, approximation=None):
|
||||
elif approximation == 1:
|
||||
x_sample = sd_vae_approx.model()(sample.to(devices.device, devices.dtype).unsqueeze(0))[0].detach() * 0.5 + 0.5
|
||||
if shared.sd_model_type == "sdxl":
|
||||
x_sample = x_sample[[2,1,0],:,:] #BGR to RGB
|
||||
x_sample = x_sample[[2,1,0],:,:] # BGR to RGB
|
||||
elif approximation == 2:
|
||||
x_sample = sd_vae_approx.cheap_approximation(sample) * 0.5 + 0.5
|
||||
if shared.sd_model_type == "sdxl":
|
||||
x_sample = x_sample[[2,1,0],:,:] #BGR to RGB
|
||||
x_sample = x_sample[[2,1,0],:,:] # BGR to RGB
|
||||
elif approximation == 3:
|
||||
# x_sample = sample * 1.5
|
||||
# x_sample = sd_vae_taesd.model()(x_sample.to(devices.device, devices.dtype).unsqueeze(0))[0].detach()
|
||||
|
||||
@@ -121,10 +121,7 @@ class VanillaStableDiffusionSampler:
|
||||
return x, ts, cond, unconditional_conditioning
|
||||
|
||||
def update_step(self, last_latent):
|
||||
if self.mask is not None:
|
||||
self.last_latent = self.init_latent * self.mask + self.nmask * last_latent
|
||||
else:
|
||||
self.last_latent = last_latent
|
||||
self.last_latent = self.init_latent * self.mask + self.nmask * last_latent if self.mask is not None else last_latent
|
||||
sd_samplers_common.store_latent(self.last_latent)
|
||||
self.step += 1
|
||||
state.sampling_step = self.step
|
||||
|
||||
@@ -36,6 +36,7 @@ def model():
|
||||
global sd_vae_approx_model # pylint: disable=global-statement
|
||||
|
||||
if sd_vae_approx_model is None:
|
||||
from modules.shared import log
|
||||
model_path = os.path.join(paths.models_path, "VAE-approx", "model.pt")
|
||||
sd_vae_approx_model = VAEApprox()
|
||||
if not os.path.exists(model_path):
|
||||
@@ -43,13 +44,13 @@ def model():
|
||||
sd_vae_approx_model.load_state_dict(torch.load(model_path, map_location='cpu' if devices.device.type != 'cuda' else None))
|
||||
sd_vae_approx_model.eval()
|
||||
sd_vae_approx_model.to(devices.device, devices.dtype)
|
||||
log.info(f"Loaded VAE-approx model: {model_path}")
|
||||
|
||||
return sd_vae_approx_model
|
||||
|
||||
|
||||
def cheap_approximation(sample):
|
||||
# https://discuss.huggingface.co/t/decoding-latents-to-rgb-without-upscaling/23204/2
|
||||
|
||||
coefs = torch.tensor([
|
||||
[0.298, 0.207, 0.208],
|
||||
[0.187, 0.286, 0.173],
|
||||
|
||||
@@ -28,10 +28,12 @@ def model(model_class = 'sd', model_type = 'decoder'):
|
||||
model_path = os.path.join(paths_internal.models_path, "TAESD", f"tae{model_class}_{model_type}.pth")
|
||||
download_model(model_path)
|
||||
if os.path.exists(model_path):
|
||||
from modules.shared import log
|
||||
taesd_models[f'{model_class}-{model_type}'] = TAESD(decoder_path=model_path, encoder_path=None) if model_type == 'decoder' else TAESD(encoder_path=model_path, decoder_path=None)
|
||||
vae = taesd_models[f'{model_class}-{model_type}']
|
||||
vae.eval()
|
||||
vae.to(devices.device, devices.dtype_vae)
|
||||
log.info(f"Loaded VAE-approx model: {model_path}")
|
||||
else:
|
||||
raise FileNotFoundError('TAESD model not found')
|
||||
if vae is None:
|
||||
|
||||
Reference in New Issue
Block a user