API: Script order on alwayson_scripts
matters
#8885
Replies: 1 comment 3 replies
-
Interesting, I'll have to take a look at the extensions code. If you want to, you can try out PR #8669. It should be stop scripts that you don't want to run from running but you will have to specify all alwayson_scripts that you want to run, even if they don't take args. One caveat though is that it can make some errors if the script is for some reason playing with the global ScriptRunners instead of the one passed in the processing object. There is also a more experimental change on one of the branches in my fork that does the changes above and arg list resizing but depending on what is happening I don't know if it's going to fix whatever Tiled Diffusion is doing. |
Beta Was this translation helpful? Give feedback.
-
I'm currently implementing several always on scripts, like ControlNet and Dynamic Prompts, using the newly added api parameter to pass in the required arguments. It's been working quite well just by following the
def process()
method signature of the script in question to define what arguments to send in the payload and in what order.Today I found a little peculiarity with this when trying to make MultiDiffusion's Tiled Diffusion work with Dynamic Prompts. Consider this payload example. The relevant part to notice here is the order in which Dynamic Prompts and Tiled Diffusion objects are sent. This payload will not trigger Dynamic Prompts, confirmed by the console log and the result itself.
This, however, will work just fine and reflect the same behavior from WebUI:
@Vespinian Have you noticed this during the development of the implementation? I'm really not sure why this happens and what's the root but I'm guessing there is something going on between the two scripts and how they are handled by the WebUI internally. In a remote case it might be something wrong with my installation.
In the end, this is not a problem by any means, I'm just spreading awareness that this might occur in other situations with other scripts save you some debug time.
EDIT: It seems like it might be the Tiled Diffusion script acting up, either by improper argument list passed in (the script still works) or perhaps it does something internally that messes the rest of the argument list when called from the api. Running it on it's own makes the
cutoff.py
script complain about missing parameters:TypeError: Script.process() missing 2 required positional arguments: 'intp' and 'debug'
This shouldn't happen because there is no reference to the Cutoff script in the payload, so it shouldn't be enabled by default and generating with the same parameters from the web ui doesn't exhibit this issue...Very weird behavior. Not sure if I should proceed discussion here or the script's own repo.
Perhaps the solution to this is to explicitly send the arguments to all the always on scripts installed setting the ones we don't want to use to false.
Beta Was this translation helpful? Give feedback.
All reactions