Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adjust clip skip default value from 1 to 2 #3011

Merged
merged 2 commits into from
May 26, 2024

Conversation

mashb1t
Copy link
Collaborator

@mashb1t mashb1t commented May 26, 2024

see #3003 (comment)

Background: Fooocus uses clip skip 2 by default, but the variable is called layer_idx and it works similar to ComfyUI, where skipped layers are counted down from -1 (no layer skipped) to infinity (set to last layer when loaded). Values > 12 are possible, they will somewhen reach a maximum of available layers, but are currently limited to 12 to prevent users from creating bad results.

The issues has been resolved by setting clip_skip to 2 by default instead of 1 and renaming the label to indicate the recommended default value.

Code references:

self.clip_l = sd1_clip.SDClipModel(layer="hidden", layer_idx=-2, device=device, dtype=dtype, layer_norm_hidden_state=False)

def clip_layer(self, layer_idx):
if abs(layer_idx) > self.num_layers:
self.layer = "last"
else:
self.layer = "hidden"
self.layer_idx = layer_idx

@mashb1t mashb1t changed the title fix: adjust clip skip default fix: adjust clip skip default value from 1 to 2 May 26, 2024
@mashb1t mashb1t merged commit dfff9b7 into lllyasviel:main May 26, 2024
@mashb1t mashb1t added this to the v2.4.1 milestone May 26, 2024
csokun pushed a commit to csokun/Fooocus that referenced this pull request Jun 16, 2024
* Revert "Revert "feat: add clip skip handling (lllyasviel#2999)" (lllyasviel#3008)"

This reverts commit 989a1ad.

* feat: use clip skip 2 as default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant