AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
143.63k stars 27.03k forks source link

fix missing infotext cased by conda cache #16677

Open w-e-w opened 5 days ago

w-e-w commented 5 days ago

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: