AUTOMATIC1111 / stable-diffusion-webui

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

[Feature Request]: Migrate Web-UI to Accelerate #4518

Open papuSpartan opened 1 year ago

papuSpartan commented 1 year ago

Is there an existing issue for this?

What would your feature do ?

Migrating to accelerate could alleviate certain problems within the project:

  1. Memory management

    234

    3250

    2082

    3045

While optimizations like --medvram and --lowvram do their job, it would be much more efficient for the end user if this was handled without requiring a restart. Especially when making this change requires editing webui-user.bat/sh (which also can be overwritten by updating/git pull). Accelerate internally uses toma, which does things like automatically lower batch size in the case of an OOM exception.


  1. Offload burden of device detection/specific support (such as with M1 Macs) from the project itself.

    3427

Less time could be spent dealing with hardware specific bugs and more time spent on resolving hardware agnostic ones.


  1. Allow for distributed computing

distributed computing with pytorch example https://pytorch.org/tutorials/intermediate/dist_tuto.html#collective-communication

This would allow users to use physically separate machines working in tandem in order to generate outputs. It could be a game changer for those that have a lower spec device but might still have additional applicable hardware in a separate system. For that reason, I think it may be naive to think that distributed computing is reserved only for large companies or organizations. The average user might be able to appreciate the opportunity to turn their otherwise useless collection of old family computers into a stable diffusion compute cluster.

Regardless

Even if Accelerate doesn't fit this project, I still think that the three subjects I listed above should be addressed.

This is a FR and not a draft for a reason. I do not claim to currently have a very deep understanding of the already existing implementation of some of the project components listed above.

Proposed workflow

  1. Use the webui as normal (according to user)

Additional information

No response

mariaWitch commented 1 year ago

Looking for ANY sort of update or progress on this from any contributor.

papuSpartan commented 1 year ago

Looking for ANY sort of update or progress on this from any contributor.

I think @d8ahazard's dream-booth extension would probably be the most relevant example to look towards for integrating it. I think there were also a few commits merged in order to support it as well.

I don't know if anyone else is currently working on it. If all you want is concurrent inference though, I made an extension for that.