udon-universe / stable-diffusion-webui-extension-templates

a template of stable-diffusion-webui extension
Apache License 2.0
72 stars 22 forks source link

multiple files under scripts/ #3

Open ljleb opened 1 year ago

ljleb commented 1 year ago

Hi! I really like this repo as it helps people get started faster.

Just a note, putting more than one file under scripts/ will lead to issues. For example in the controlnet repo, they are stuck with dozens of files that all get executed multiple times because the webui will compile and run each of them. It's not possible to remove the files themselves (but it's possible to move the content of the files presumably) because other extensions depend on these to be placed exactly at that location.

A better project structure is to create a custom directory named i.e. lib_[extension_name] and then import from that directory the python modules you need to keep things tidy.

See for example how I did it for one of my extension: https://github.com/ljleb/prompt-fusion-extension

See more tips here: https://github.com/vladmandic/automatic/wiki/Extensions#common-mistakes

marcsyp commented 1 year ago

Appreciate the comment here as I am just getting started trying to build an AlwaysOn extension. I will update my repository the way you have described here.

While I'm here -- any idea why I can't get my extension to hit any breakpoints on Generate, either in the run() or process() functions I have defined (the latter I modeled after other working extensions whose breakpoints are hit properly). I am using basically the lightly modfied code from this repo and my accordian is showing up properly in the UI...

Thanks!

ljleb commented 1 year ago

If you have a link to some code I can have a look. Otherwise you can hop in auto's discord server and ask for help there I think!

marcsyp commented 1 year ago

I found the problem -- I hadn't passed all the parameters from the UI into the run() and process() functions. Didn't know about the discord server -- will definitely join there!

Thanks.

marcsyp commented 1 year ago

Can't find the discord server -- do you have a link? thx

I've made progress with my extension but I'm trying to get metadata info from an image a user has place in ControlNet. I can get the image from the script but I suspect that it's the preprocessor image and anyway it's in a NumPy format that does not play nice with the image class. I'm not even sure what I'm trying to do is possible and I'd like to chat with other devs about it, because I'm thinking there may be some workarounds for what I'm trying to do.

ljleb commented 1 year ago

here you go: https://discord.com/invite/Zw69ExBg