mirror of
https://github.com/vladmandic/automatic
synced 2026-08-26 23:20:59 +02:00
Fix diffusers clip_skip math
This commit is contained in:
@@ -182,6 +182,13 @@ def process_diffusers(p: processing.StableDiffusionProcessing):
|
||||
shared.log.error(f'Prompt parser encode: {e}')
|
||||
if os.environ.get('SD_PROMPT_DEBUG', None) is not None:
|
||||
errors.display(e, 'Prompt parser encode')
|
||||
if parser == 'Fixed attention':
|
||||
clip_skip = kwargs.pop("clip_skip", None)
|
||||
if clip_skip is not None:
|
||||
if 'XL' in model.__class__.__name__:
|
||||
args['clip_skip'] = clip_skip - 2
|
||||
else:
|
||||
args['clip_skip'] = clip_skip - 1
|
||||
if 'prompt' in possible:
|
||||
if hasattr(model, 'text_encoder') and 'prompt_embeds' in possible and len(p.prompt_embeds) > 0 and p.prompt_embeds[0] is not None:
|
||||
args['prompt_embeds'] = p.prompt_embeds[0]
|
||||
@@ -410,7 +417,7 @@ def process_diffusers(p: processing.StableDiffusionProcessing):
|
||||
denoising_start=0 if use_refiner_start else p.refiner_start if use_denoise_start else None,
|
||||
denoising_end=p.refiner_start if use_refiner_start else 1 if use_denoise_start else None,
|
||||
output_type='latent' if hasattr(shared.sd_model, 'vae') else 'np',
|
||||
clip_skip=p.clip_skip - 1,
|
||||
clip_skip=p.clip_skip,
|
||||
desc='Base',
|
||||
)
|
||||
update_sampler(shared.sd_model)
|
||||
@@ -487,7 +494,7 @@ def process_diffusers(p: processing.StableDiffusionProcessing):
|
||||
guidance_scale=p.image_cfg_scale if p.image_cfg_scale is not None else p.cfg_scale,
|
||||
guidance_rescale=p.diffusers_guidance_rescale,
|
||||
output_type='latent' if hasattr(shared.sd_model, 'vae') else 'np',
|
||||
clip_skip=p.clip_skip - 1,
|
||||
clip_skip=p.clip_skip,
|
||||
image=output.images,
|
||||
strength=p.denoising_strength,
|
||||
desc='Hires',
|
||||
@@ -546,7 +553,7 @@ def process_diffusers(p: processing.StableDiffusionProcessing):
|
||||
denoising_end=1 if p.refiner_start > 0 and p.refiner_start < 1 else None,
|
||||
image=image,
|
||||
output_type=output_type,
|
||||
clip_skip=p.clip_skip - 1,
|
||||
clip_skip=p.clip_skip,
|
||||
desc='Refiner',
|
||||
)
|
||||
shared.state.sampling_steps = refiner_args['num_inference_steps']
|
||||
|
||||
Reference in New Issue
Block a user