stable-diffusion-webui
stable-diffusion-webui copied to clipboard
add callback after_extra_networks_activate
Description
this mainly affected extensions that needs to modify extra network after it's been activated such as lora block weights and in my opinion the actual solution to the issue that https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/11477 describes quote
this has affected several scripts, particularly causing issues in relation to LoRA
the following is mostly a repost of my Discord message on this topic
we might need to add a an extra process_batch or a new call back for hi-pass https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/10944
I propose to add a new callback in extra_network.activate
, a post extra_network_activate
callback
I think this is the best place to add operations that need to happen after activation of extra network but before setup_conds()
normally for img2img process_batch is enough but the issue is that for txt2img with hirse-fix there are multiple activations of extra networks
extensions that need to inject themselves between extra network activation and conds shoud switch to use the new call back
the key difference between process_batch only proposed new callback post_extra_network_activate is that process_batch called only once per batch whiles post_extra_network_activate maybe called multiple times (when hires-fix)
also some extensions actually activate after networks for ther own use example https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111/blob/main/tile_methods/multidiffusion.py#L206
if the this call back is implemented
process_batch should be moved after conds
and they can be a minor optimization for conds calculation for --lowvram mode
which would also entail moving scripts.process_batch
after conds
this would cause a breaking change this is not implemented in this PR
this can be implemented later after this PR has been merged and those extension that would be affected has time to migrate to the new callback, making the migration more smooth
Screenshots/videos:
Checklist:
- [ ] I have read contributing wiki page
- [ ] I have performed a self-review of my own code
- [ ] My code follows the style guidelines
- [ ] My code passes tests