How to use layerdiffuse IN webui API
zhong540675755 opened this issue · 4 comments
How to use layerdiffuse IN webui API , thank you!
Have you solved this problem?
I found this in some other issue here:
"alwayson_scripts": {
"LayerDiffuse": {
"args": [
{
# "(SDXL) Only Generate Transparent Image (Attention Injection)"
"method": 4 # this number is the order the models are presented
}
]
}
}
but I did not yet get it working, after generating the image it throws some error about:
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 28 but got size 27 for tensor number 1 in the list.
anybody got it working? Do I miss something?
Also mentioned there is:
You can look at the script.py file and add then use the ui values as arguments.
what script.py is that?
This works for me:
{
"prompt": "a cat stalking a mouse",
"negative_prompt": "nsfw, ugly, text",
"seed": -1,
"batch_size": 1,
"steps": 50,
"cfg_scale": 7.0,
"sd_model_name": "dreamshaper_8",
"sampler_index": "Euler",
"width": 512,
"height": 512,
"save_images": true,
"alwayson_scripts": {
"LayerDiffuse": {
"args": [
true,
"(SD1.5) Only Generate Transparent Image (Attention Injection)",
1,
1,
null,
null,
null,
"Crop and Resize",
"",
"",
""
]
}
}
}
LayerDiffuse args keys and order:
layerdiffusion_enabled
layerdiffusion_method
layerdiffusion_weight
layerdiffusion_ending_step
layerdiffusion_fg_image
layerdiffusion_bg_image
layerdiffusion_blend_image
layerdiffusion_resize_mode
layerdiffusion_fg_additional_prompt
layerdiffusion_bg_additional_prompt
layerdiffusion_blend_additional_prompt
Make sure to change your batch_size as required as well as use the correct model version for the method (i.e SD1.5 model for SD1.5 method)
这对我有用:
{ "prompt": "a cat stalking a mouse", "negative_prompt": "nsfw, ugly, text", "seed": -1, "batch_size": 1, "steps": 50, "cfg_scale": 7.0, "sd_model_name": "dreamshaper_8", "sampler_index": "Euler", "width": 512, "height": 512, "save_images": true, "alwayson_scripts": { "LayerDiffuse": { "args": [ true, "(SD1.5) Only Generate Transparent Image (Attention Injection)", 1, 1, null, null, null, "Crop and Resize", "", "", "" ] } } }
LayerDiffuse 参数键和顺序:
layerdiffusion_enabled layerdiffusion_method layerdiffusion_weight layerdiffusion_ending_step layerdiffusion_fg_image layerdiffusion_bg_image layerdiffusion_blend_image layerdiffusion_resize_mode layerdiffusion_fg_additional_prompt layerdiffusion_bg_additional_prompt layerdiffusion_blend_additional_prompt
确保根据需要更改batch_size,并为方法使用正确的模型版本(即 SD1.5 方法的 SD1.5 模型)
Why did I encounter this error
File "/data1/SD/stable-diffusion-webui/modules/scripts.py", line 892, in process_before_every_sampling
script.process_before_every_sampling(p, *script_args, **kwargs)
File "/data1/SD/stable-diffusion-webui/extensions/sd-forge-layerdiffuse/scripts/forge_layerdiffusion.py", line 199, in process_before_every_sampling
fg_additional_prompt = fg_additional_prompt + ', ' + original_prompt if fg_additional_prompt != '' else None
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'