Fix generations that trigger LoRA loads not applying text encoders of the just loaded LoRAs on themselves #4005
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The text encoder parts of LoRAs are not applied correctly on the image generation that triggered the same LoRAs to load. This results in the first usage of a LoRA to never use the LoRA fully, as only the UNET part will be applied.
The following two methods are two different ways of triggering the same bug (both methods assume all generation parameters and the seed stay the same):
METHOD 1
- Disable everything "special" e.g. any quantization, model compile, hidiffusion, PAG, any caching (fastercache, teacache etc.), FreeU, TOME... you name it.
- Make sure nothing is checked under "LoRA" in System -> Networks.
- Likewise, nothing should be checked under System -> Text Encoder.
- Despite everything being exactly the same, the image is drastically different and the LoRAs seem to work much better now.
METHOD 2
- The output will change significantly. The result will be almost exactly the same as with the "fixed" result from Method 1 step 6 (aside minor changes from the added letter and maybe missing determinism).
- The image changes significantly again and falls back to generating the exact same image as from step 2, again not generating what would be expected if the LoRAs and triggerwords had been applied correctly.
TL;DR
The order of these two is wrong:
This is confirmed by:
WORKAROUNDS
One workaround is to set "Text encoder cache size" in System -> Text Encoder to 0.
It will still generate the first image wrong, but one can now just generate the same image again (without any changes) to fix it.