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

FEAT: evaluate implementing "negative ADM guidance" #1217

Closed
tildebyte opened this issue Aug 14, 2023 · 5 comments
Closed

FEAT: evaluate implementing "negative ADM guidance" #1217

tildebyte opened this issue Aug 14, 2023 · 5 comments

Comments

@tildebyte
Copy link

WDYT? Worthwhile, or cargo-cult BS?

https://github.com/lllyasviel/Fooocus/blob/main/modules/adm_patch.py (implementation of bullet 2 from https://github.com/lllyasviel/Fooocus/tree/main#tech_list), to wit:

Negative ADM guidance. Because the highest resolution level of XL Base does not have cross attentions, the positive and negative signals for XL's highest resolution level cannot receive enough contrasts during the CFG sampling, causing the results look a bit plastic or overly smooth in certain cases. Fortunately, since the XL's highest resolution level is still conditioned on image aspect ratios (ADM), we can modify the adm on the positive/negative side to compensate for the lack of CFG contrast in the highest resolution level.

@tildebyte
Copy link
Author

Addl. info:

It really boils down to monkey-patching SDXL(BaseModel).encode_adm() with

    if kwargs.get("prompt_type", "") == "negative":
        width *= 0.8
        height *= 0.8
    elif kwargs.get("prompt_type", "") == "positive":
        width *= 1.5
        height *= 1.5

@comfyanonymous
Copy link
Owner

From our tests this doesn't seem to improve anything, it also directly contradicts the point number 6 on that repo.

@tildebyte
Copy link
Author

Yeah, I tried it locally... I was not impressed.

@FrancescoSaverioZuppichini

is there a paper for Negative ADM guidance I have no idea of what ADM is

@stephantual
Copy link

Given that "reimplementing fooocus in comfyUI" has become a bit of a rite of passage for a lot of us, I'm glad to report this thread is #1 on google when searching for "negative ADM guidance". Thank you @comfyanonymous for comfirming what we always suspected.

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

No branches or pull requests

4 participants