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 sd hijack infotext cased by conda cache #16673

Closed
wants to merge 3 commits into from

Conversation

w-e-w
Copy link
Collaborator

@w-e-w w-e-w commented Nov 23, 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 (TI hashes are combined from positive and negative prompts)
essentially you can't really cash the results but if we turn the results into actions (function) then we can cache the function object that will be use do add the necessary parameters
then after conda is calculated call all those actions to populate the generation parameters

in order to implement this was maintaining backwards compatibility
I created a custom class util.GenerationParamsState, when self.hijack.extra_generation_params is assigned with the value of this class, webui will store these with conda cache then execute them after conda is calculated

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
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