resolve LoCon/LoHA/LyCORIS poblem #18
Open
+36
−9
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.
Hello:
I found that errors occur (IndexError: list index out of range) when using both a LoRA model and a LoCon/LoHA/LyCORIS model simultaneously, and there are also issues with incomplete model loading when using the LoCon/LoHA/LyCORIS model.
This is because you used "_11_1_proj_out" and "_11_mlp_fc2" to determine if it's the last layer of the model, but the LoCon model happens to not have the "_11_1_proj_out" and "_11_mlp_fc2" layer. As a result, your "text_model_encoder_counter" and "diffusion_model_counter" counter will calculate incorrectly, leading to a failed model loading.
Therefore, this pull request starts by checking whether there has been "_11_1_proj_out" and "_11_mlp_fc2" at the beginning of each loop to determine if the model is a LoCon/LoHA/LyCORIS model. If it is, then it will correct the calculation of your "text_model_encoder_counter" and "diffusion_model_counter" counter to solve the problem.
Another issue is that when both sub-promote blocks use the same LoRA, there is a problem of duplicate accumulation of the LoRA weight. I have also made corrections, please review and thank you.