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 missing infotext cased by conda cache #16677

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

w-e-w
Copy link
Collaborator

@w-e-w w-e-w commented Nov 24, 2024

Description

fix: missing infotext cased by conda cache
some generation params such as TI hashes or Emphasis is added in sd_hijack / sd_hijack_clip
if conda are fetche from cache sd_hijack_clip will not be executed and it won't have a chance to to add generation params

fix: generation params will also be missing if webui is in non low-vram mode because the hijack.extra_generation_params was never read after calculate_hr_conds

simply put if you generate multiple images with the exact same prompt and embedding, only the first image will have TI hashes in infotext
same when your are using non Original emphasis modes, only the first image will have the correct info


in order to fix this the generation parameters from sd_hijack will also has to be cahched along with conda cache
unfortunately caching generation parameters is not straightforward as sd_hijack could be called multiple times and in some cases
later calles will modify or add to existing generation parameters essentially you can't really cache the resules as the rules are mixed (TI hashes are combined from positive and negative prompts)

but if we change the way the info is writternm by using callable, we can cache the callable for later use

in order to achive I implement a new class GenerationParametersList
when a infotext needs to be created in sd_hijack / sd_hijack_clip, instead of directly writing `to sd_hijack.extra_generation parameters create a GenerationParametersList or a custom
this class extracted and cached after cond is calcated and apply to StableDiffusionProcessing..extra_generation parameters when the cached is retrived

the should be minimum compatible issues
the only potential risk is if an extention would interact with extra_generation_params['TI hashes'] or extra_generation_params['Emphasis'], which is unlikey and I was not able to find any extenton that do so
in the enven that dose happen, in most case the worst case it it will just fallback to what it was like before, I implement interaction with the new GenerationParametersList with str types


another implementation but decide to no go with it


Checklist:

some generation params such as TI hashes or Emphasis is added in sd_hijack / sd_hijack_clip
if conda are fetche from cache sd_hijack_clip will not be executed and it won't have a chance to to add generation params

the generation params will also be missing if in non low-vram mode because the hijack.extra_generation_params was never read after calculate_hr_conds
@w-e-w w-e-w marked this pull request as draft November 24, 2024 09:46
@w-e-w w-e-w force-pushed the method-3-fix-sd_hijack-infotext-cased-by-conda-cache branch from 541d5e8 to fb6a050 Compare November 24, 2024 11:12
clears any generation parameters that are with the attribute to_be_clear_before_batch = True
prevent buildup of some parameters
@w-e-w w-e-w force-pushed the method-3-fix-sd_hijack-infotext-cased-by-conda-cache branch from fb6a050 to ac8c053 Compare November 24, 2024 11:17
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