stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: CLIP_stop_at_last_layers is changed permanently to a different value

Open dhwz opened this issue 2 years ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

The setting CLIP_stop_at_last_layers is changed permanently to a different value if a image is loaded e.g. via PNG Info and then send to e.g. txt2img.

That breaks the possibility to regenerate images as it's not reset to the default value 1 if you load another image and send it to txt2img.

Steps to reproduce the problem

load an image with Clip skip 2 in EXIF data and send it to txt2img, CLIP_stop_at_last_layers will change to 2 and thats permanent for any other image generated afterwards

What should have happened?

You load an image in PNG Info / Image Browser etc. and the value gets set back to 1 if it's not higher than 1 in the image EXIF data, or is completely missing in EXIF data.

Commit where the problem happens

b08698a09a257365238e43cc9023ce7cf9af73c4

What platforms do you use to access UI ?

Windows

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

No response

Additional information, context and logs

No response

dhwz avatar Nov 05 '22 22:11 dhwz

Permanently? That wording makes it sounds like you can't manually change the value back in the settings dialog at all. Don't think this is a bug but rather an oversight. I can see a feature request to include clip skip in generated metadata even if it's set to 1, then have that value respected when sending to txt2img/img2img from png info or the image browser. For some reason there's this commit that opts to not include clip skip values of 1 to parameter metadata. https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/8d340cfb884e1dbff5b6f477f4ecf7d104279115 I'd imagine you can revert that line change and generated metadata will specify if clip skip 1 was used and will presumably set clip skip to 1 when sent from png info/image browser. Line 403 currently in processing.py. As for older generations that don't include clip_skip in metadata, another change would need to be made to set clip skip to 1 if not specified.

rabidcopy avatar Nov 06 '22 15:11 rabidcopy

Yes sorry permanently sounds a bit wrong maybe, but you know what I mean it changes without users notice in the settings. And you've to manually edit it back (if you know you have to).

dhwz avatar Nov 06 '22 16:11 dhwz

a workaround you can add CLIP_stop_at_last_layers to Quicksettings list so you have quick access to the setting like so image

w-e-w avatar Nov 06 '22 17:11 w-e-w

I know I have this already. Just opened that issue for a general solution for any user.

dhwz avatar Nov 06 '22 17:11 dhwz