AbdBarho / stable-diffusion-webui-docker

Easy Docker setup for Stable Diffusion with user-friendly UI
Other
6.78k stars 1.13k forks source link

Handling extensions properly #172

Closed DevilaN closed 2 years ago

DevilaN commented 2 years ago

I think it's about time to think of proper method to handle extensions. AUTOMATIC1111 writes some of webui plugins as external repository scripts (like aesthetic gradients). Right now there is no easy possibility to install selected extensions inside docker without going inside container and play with some tools to install requirements for extension plugin.

Is there anything planned to address this issue?

AbdBarho commented 2 years ago

There is nothing currently, unfortunately, I am unable to keep up-to-date with all the stuff that is happening, can you tell me a bit more about them? or maybe where I can read more?

if it is a useful feature we should add it!

wilcockj commented 2 years ago

I am also having issues with extensions, https://github.com/AUTOMATIC1111/stable-diffusion-webui-aesthetic-gradients is one example. This is the documentation on extensions from AUTOMATIC1111, https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Extensions . They should be installed by copying to the extensions directory, but I have not been able to get that to work with the docker container. I have tried putting them in data/extensions/ and also tried in the root directory of this repo and haven't been able to get it to work. I would very much love to get this working. Thank you for your work on this repo!

wilcockj commented 2 years ago

For anyone trying to solve this in the future I was being dumb, just need to add the following line to services/AUTOMATIC1111/mount.sh

MOUNTS["${ROOT}/extensions"]="/data/extensions"

then i could simply clone the extension directory to data/extensions and it works. If you want me to make a pull request i can just don't know how extensions work for the other UIs

AbdBarho commented 2 years ago

@wilcockj checkout the discussion in #148

DevilaN commented 2 years ago

This is only "a tip of the iceberg". Some of extensions require installing additional software to run (there is requirements.txt file for deforum plugin: https://github.com/deforum-art/deforum-for-automatic1111-webui/blob/automatic1111-webui/requirements.txt ). Maintaining extensions that way is a big pain in the a$$, because some of them may require conflicting versions of software. We can install some of requirements beforehand but there is no guarantee that it will continue to work and probably only for most popular or official extensions mentioned in A1111 wiki (https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Extensions). This would cover most, but not all usecases. Also because of software is released like a waterfall and docker caches it's layers (this is good), then there is a problem when running software install procedure later, as some of currently installed and working packages may be upgraded in second wave of install, and this might cause some bugs which are difficult to debug, as it strongly depends on point of time packages were cached / installed. Normally this is resolved by using strict version of packages installed, but no extension repository is doing this that way and no one cares. In the end it will probably be like a @AbdBarho doing nothing else but maintaining this app with extensions and responding to issues caused by this very situation.

Maybe there is solution for this problem, but right now I don't know anything which would not involve additional work and / or human resources to maintain it.

AbdBarho commented 2 years ago

@DevilaN thanks, this mirrors my opinion very strongly, and repeating what I said in https://github.com/AbdBarho/stable-diffusion-webui-docker/issues/148#issuecomment-1291165208, I consider adding support for extensions, but installing, updating, and managing the extensions will be left entirely to the user, no support will be provided.

AbdBarho commented 2 years ago

@DevilaN I already have some basic support for extensions in #176, since you created this issue, I would like get your opinion.

In summary, there will be a new script data/config/auto/startup.sh that would run on startup, so users can install whatever they want (missing dependencies for scripts, etc...)

DevilaN commented 2 years ago

OK, I've seen entrypoint prototype. I've got mixed feelings about running it as sourced script instead of subshell, but this is a matter of good explanation in README. And let's hope that there will be no conflicting shell variables used by extension instalation scripts, that override by accident base app environment variables. Bug issue template should have info about mandatory checking for bugs with startup script disabled.

Startup script method has some basic inconveniences that right now we probably should only be aware of. Each time upgrade is made all downloaded files disappear with new base image for auto service. Also changing anything in environment (like new param in docker-compose.override.yml) would create new container and reinstalling of requirements for extensions will start from scratch.

This extensions ecosystem created by A1111 is "a bit messy", so probably best thing we can do is to start with https://github.com/AbdBarho/stable-diffusion-webui-docker/pull/176 and gather user feedback later so we can adapt better.