Open DiegoRRR opened 3 days ago
@DiegoRRR ¡Hola! Soy Dosu, un bot que puede ayudarte a solucionar errores, responder preguntas y convertirte en un colaborador. Estoy aquí para ayudarte mientras esperas a un mantenedor humano.
The NoneType
error in ADetailer is likely caused by the mask
parameter being None
in the StableDiffusionProcessingImg2Img
initialization within the get_i2i_p
method. This can happen if the mask is not properly set or generated.
To fix this issue, ensure that the mask is correctly created and passed to the StableDiffusionProcessingImg2Img
object. You can modify the get_i2i_p
method to include a valid mask. Here is a possible solution:
create_mask_from_bbox
method.StableDiffusionProcessingImg2Img
initialization.Here is the modified get_i2i_p
method:
def get_i2i_p(self, p, args: ADetailerArgs, image):
seed, subseed = self.get_seed(p)
width, height = self.get_width_height(p, args)
steps = self.get_steps(p, args)
cfg_scale = self.get_cfg_scale(p, args)
initial_noise_multiplier = self.get_initial_noise_multiplier(p, args)
sampler_name = self.get_sampler(p, args)
override_settings = self.get_override_settings(p, args)
version_args = {}
if schedulers:
version_args.update(self.get_scheduler(p, args))
# Create the mask
bboxes = self.get_bounding_boxes(p) # Assuming this method exists to get bounding boxes
mask = create_mask_from_bbox(bboxes, (width, height))
i2i = StableDiffusionProcessingImg2Img(
init_images=[image],
resize_mode=0,
denoising_strength=args.ad_denoising_strength,
mask=mask, # Pass the created mask here
mask_blur=args.ad_mask_blur,
inpainting_fill=1,
inpaint_full_res=args.ad_inpaint_only_masked,
inpaint_full_res_padding=args.ad_inpaint_only_masked_padding,
inpainting_mask_invert=0,
initial_noise_multiplier=initial_noise_multiplier,
sd_model=p.sd_model,
outpath_samples=p.outpath_samples,
outpath_grids=p.outpath_grids,
prompt="", # replace later
negative_prompt="",
styles=p.styles,
seed=seed,
subseed=subseed,
subseed_strength=p.subseed_strength,
seed_resize_from_h=p.seed_resize_from_h,
seed_resize_from_w=p.seed_resize_from_w,
sampler_name=sampler_name,
batch_size=1,
n_iter=1,
steps=steps,
cfg_scale=cfg_scale,
width=width,
height=height,
restore_faces=args.ad_restore_face,
tiling=p.tiling,
extra_generation_params=copy_extra_params(p.extra_generation_params),
do_not_save_samples=True,
do_not_save_grid=True,
override_settings=override_settings,
**version_args,
)
i2i.cached_c = [None, None]
i2i.cached_uc = [None, None]
i2i.scripts, i2i.script_args = self.script_filter(p, args)
i2i._ad_disabled = True
i2i._ad_inner = True
if args.ad_controlnet_model != "Passthrough" and controlnet_type != "forge":
self.disable_controlnet_units(i2i.script_args)
if args.ad_controlnet_model not in ["None", "Passthrough"]:
self.update_controlnet_args(i2i, args)
elif args.ad_controlnet_model == "None":
i2i.control_net_enabled = False
return i2i
This modification ensures that the mask
parameter is not None
, which should prevent the NoneType
error. The create_mask_from_bbox
function from the adetailer/common.py
file is used to generate the mask from bounding boxes [1][2].
To continue talking to Dosu, mention @dosu.
@dosu : Thanks. Ok, I edited the file "extensions\adetailer\scripts!adetailer.py" and replaced the definition of the get_i2i_p
method. Now I have this error:
Traceback (most recent call last):
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\gradio\ro
utes.py", line 488, in run_predict
output = await app.get_blocks().process_api(
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\gradio\bl
ocks.py", line 1429, in process_api
inputs = self.preprocess_data(fn_index, inputs, state)
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\gradio\bl
ocks.py", line 1239, in preprocess_data
processed_input.append(block.preprocess(inputs[i]))
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\gradio\co
mponents\image.py", line 273, in preprocess
assert isinstance(x, str)
AssertionError
Traceback (most recent call last):
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\gradio\ro
utes.py", line 488, in run_predict
output = await app.get_blocks().process_api(
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\gradio\bl
ocks.py", line 1431, in process_api
result = await self.call_function(
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\gradio\bl
ocks.py", line 1103, in call_function
prediction = await anyio.to_thread.run_sync(
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\anyio\to_
thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\anyio\_ba
ckends\_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\anyio\_ba
ckends\_asyncio.py", line 807, in run
result = context.run(func, *args)
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\gradio\ut
ils.py", line 707, in wrapper
response = f(*args, **kwargs)
File "D:\apps\stable-diffusion\Forge\webui\extensions-builtin\sd_forge_control
net\lib_controlnet\controlnet_ui\preset.py", line 257, in update_reset_button
infotext = ControlNetPresetUI.presets[preset_name]
KeyError: None
Traceback (most recent call last):
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\gradio\ro
utes.py", line 488, in run_predict
output = await app.get_blocks().process_api(
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\gradio\bl
ocks.py", line 1431, in process_api
result = await self.call_function(
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\gradio\bl
ocks.py", line 1103, in call_function
prediction = await anyio.to_thread.run_sync(
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\anyio\to_
thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\anyio\_ba
ckends\_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\anyio\_ba
ckends\_asyncio.py", line 807, in run
result = context.run(func, *args)
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\gradio\ut
ils.py", line 707, in wrapper
response = f(*args, **kwargs)
File "D:\apps\stable-diffusion\Forge\webui\extensions-builtin\sd_forge_control
net\lib_controlnet\controlnet_ui\controlnet_ui_group.py", line 1122, in <lambda>
fn=lambda x: gr.update(value=x + 1),
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
Traceback (most recent call last):
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\gradio\ro
utes.py", line 488, in run_predict
output = await app.get_blocks().process_api(
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\gradio\bl
ocks.py", line 1431, in process_api
result = await self.call_function(
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\gradio\bl
ocks.py", line 1077, in call_function
assert block_fn.fn, f"function with index {fn_index} not defined."
AssertionError: function with index 593 not defined.
Traceback (most recent call last):
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\gradio\ro
utes.py", line 488, in run_predict
output = await app.get_blocks().process_api(
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\gradio\bl
ocks.py", line 1431, in process_api
result = await self.call_function(
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\gradio\bl
ocks.py", line 1103, in call_function
prediction = await anyio.to_thread.run_sync(
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\anyio\to_
thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\anyio\_ba
ckends\_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\anyio\_ba
ckends\_asyncio.py", line 807, in run
result = context.run(func, *args)
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\gradio\ut
ils.py", line 707, in wrapper
response = f(*args, **kwargs)
File "D:\apps\stable-diffusion\Forge\webui\extensions-builtin\sd_forge_control
net\lib_controlnet\controlnet_ui\preset.py", line 257, in update_reset_button
infotext = ControlNetPresetUI.presets[preset_name]
KeyError: None
Traceback (most recent call last):
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\gradio\ro
utes.py", line 488, in run_predict
output = await app.get_blocks().process_api(
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\gradio\bl
ocks.py", line 1431, in process_api
result = await self.call_function(
File "D:\apps\stable-diffusion\Forge\system\python\lib\site-packages\gradio\bl
ocks.py", line 1077, in call_function
assert block_fn.fn, f"function with index {fn_index} not defined."
AssertionError: function with index 674 not defined.
To load target model SDXL
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) = 8994.23583984375
[Memory Management] Model Memory (MB) = 4897.086494445801
[Memory Management] Minimal Inference Memory (MB) = 1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) = 3073.149345397949
Moving model(s) has taken 1.78 seconds
100%|██████████████████████████████████████████| 20/20 [00:06<00:00, 3.04it/s]
To load target model AutoencoderKL█████████████| 20/20 [00:04<00:00, 3.96it/s]
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) = 3665.79736328125
[Memory Management] Model Memory (MB) = 159.55708122253418
[Memory Management] Minimal Inference Memory (MB) = 1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) = 2482.240282058716
Moving model(s) has taken 0.06 seconds
Total progress: 100%|██████████████████████████| 20/20 [00:05<00:00, 3.53it/s]
100%|██████████████████████████████████████████| 20/20 [00:05<00:00, 3.98it/s]
The new error you're encountering seems to be related to the mask
parameter and possibly other variables not being properly defined or passed. Let's ensure that all necessary variables and modules are properly defined and imported.
Here is the corrected get_i2i_p
method with the necessary imports and definitions:
from some_module import schedulers, controlnet_type # Ensure these are correctly imported from the appropriate module
def get_i2i_p(self, p, args: ADetailerArgs, image):
seed, subseed = self.get_seed(p)
width, height = self.get_width_height(p, args)
steps = self.get_steps(p, args)
cfg_scale = self.get_cfg_scale(p, args)
initial_noise_multiplier = self.get_initial_noise_multiplier(p, args)
sampler_name = self.get_sampler(p, args)
override_settings = self.get_override_settings(p, args)
version_args = {}
if schedulers:
version_args.update(self.get_scheduler(p, args))
# Create the mask
bboxes = self.get_bounding_boxes(p) # Assuming this method exists to get bounding boxes
mask = create_mask_from_bbox(bboxes, (width, height))
i2i = StableDiffusionProcessingImg2Img(
init_images=[image],
resize_mode=0,
denoising_strength=args.ad_denoising_strength,
mask=mask, # Pass the created mask here
mask_blur=args.ad_mask_blur,
inpainting_fill=1,
inpaint_full_res=args.ad_inpaint_only_masked,
inpaint_full_res_padding=args.ad_inpaint_only_masked_padding,
inpainting_mask_invert=0,
initial_noise_multiplier=initial_noise_multiplier,
sd_model=p.sd_model,
outpath_samples=p.outpath_samples,
outpath_grids=p.outpath_grids,
prompt="", # replace later
negative_prompt="",
styles=p.styles,
seed=seed,
subseed=subseed,
subseed_strength=p.subseed_strength,
seed_resize_from_h=p.seed_resize_from_h,
seed_resize_from_w=p.seed_resize_from_w,
sampler_name=sampler_name,
batch_size=1,
n_iter=1,
steps=steps,
cfg_scale=cfg_scale,
width=width,
height=height,
restore_faces=args.ad_restore_face,
tiling=p.tiling,
extra_generation_params=copy_extra_params(p.extra_generation_params),
do_not_save_samples=True,
do_not_save_grid=True,
override_settings=override_settings,
**version_args,
)
i2i.cached_c = [None, None]
i2i.cached_uc = [None, None]
i2i.scripts, i2i.script_args = self.script_filter(p, args)
i2i._ad_disabled = True
i2i._ad_inner = True
if args.ad_controlnet_model != "Passthrough" and controlnet_type != "forge":
self.disable_controlnet_units(i2i.script_args)
if args.ad_controlnet_model not in ["None", "Passthrough"]:
self.update_controlnet_args(i2i, args)
elif args.ad_controlnet_model == "None":
i2i.control_net_enabled = False
return i2i
Ensure that schedulers
and controlnet_type
are correctly imported or defined in your script. If they are part of another module, replace some_module
with the actual module name [1].
To continue talking to Dosu, mention @dosu.
@dosu :
I replaced the get_i2i_p
method.
I don't know python but I think schedulers
is defined in
from aaaaaa.conditional import create_binary_mask, schedulers
and controlnet_type
is defined in
from controlnet_ext import ( CNHijackRestore, ControlNetExt, cn_allow_script_control, controlnet_exists, controlnet_type, get_cn_models, )
There is no error anymore but it does nothing. I check the ADetailer checkbox. "face_yolov8n.pt" is selected. I leave all settings to default, and I generate. But the picture is exactly the same as without ADetailer, no improvement on the generated face.
The error you really should focus on is not the NoneType error, but rather the following:
RuntimeError: Couldn't load custom C++ ops. This can happen if your PyTorch and
torchvision versions are incompatible, or if you had errors while compiling torc
hvision from source. For further information on the compatible versions, check h
ttps://github.com/pytorch/vision#installation for the compatibility matrix. Plea
se check your PyTorch version with torch.__version__ and your torchvision versio
n with torchvision.__version__ and verify if they are compatible, and if not ple
ase reinstall torchvision so that it matches your PyTorch install.
This shows that there was a problem with the package installation. Try a clean reinstall.
Describe the bug
I just installed ADetailer and let it download its file. ADetailer crashes because of a NoneType error.
Steps to reproduce
Screenshots
No response
Console logs, from start to end.
List of installed extensions
LDSR built-in None
Lora built-in None
ScuNET built-in None
SwinIR built-in None
canvas-zoom-and-pan built-in None
extra-options-section built-in None
forge_legacy_preprocessors built-in None
forge_preprocessor_inpaint built-in None
forge_preprocessor_marigold built-in None
forge_preprocessor_normalbae built-in None
forge_preprocessor_recolor built-in None
forge_preprocessor_reference built-in None
forge_preprocessor_revision built-in None
forge_preprocessor_tile built-in None
mobile built-in None
prompt-bracket-checker built-in None
sd_forge_controlllite built-in None
sd_forge_controlnet built-in None
sd_forge_controlnet_example built-in None
sd_forge_dynamic_thresholding built-in None
sd_forge_fooocus_inpaint built-in None
sd_forge_freeu built-in None
sd_forge_hypertile built-in None
sd_forge_ipadapter built-in None
sd_forge_kohya_hrfix built-in None
sd_forge_latent_modifier built-in None
sd_forge_multidiffusion built-in None
sd_forge_neveroom built-in None
sd_forge_photomaker built-in None
sd_forge_sag built-in None
sd_forge_stylealign built-in None
sd_forge_svd built-in None
sd_forge_z123 built-in None
soft-inpainting built-in None
adetailer https://github.com/Bing-su/adetailer main a7d96113 2024-06-16 02:32:49 unknown sd-forge-layerdiffuse https://github.com/layerdiffusion/sd-forge-layerdiffuse main e4d5060e 2024-03-08 15:36:24 unknown