Comments (5)
@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:
- Ensure the mask is created using the
create_mask_from_bbox
method. - Pass the created mask to the
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.
from adetailer.
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.
from adetailer.
@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.
from adetailer.
@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]
from adetailer.
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.
from adetailer.
Related Issues (20)
- How do I create a mask but not optimize it? HOT 10
- [Feature Request]: Composite masking: subtract one mask from another HOT 1
- [Feature Request]: Recursive pass through, like LLM agents HOT 2
- [Bug]: setting live preview to 0 (real time update) breaks detection mask drawing HOT 1
- [Bug]: ADeatailer not working???? HOT 2
- [Bug]: ADtailer toolbar is not displayed even after restarting the web ui HOT 3
- [Feature Request]: Option to use hires fix settings HOT 2
- [Feature Request]: Add Use same sampler option HOT 2
- [Bug]: detection box color went from red to blue HOT 5
- [Bug]: Adetailer's inpainting conflicts with Tiled VAE HOT 2
- [Bug]: Inpainting - Use Separate Steps - not working HOT 2
- [Report]: what is going on with the output? HOT 2
- [Bug]: ADetailer act like it is Disabled HOT 5
- getting this weird error HOT 2
- [Feature Request]: Mask in shape of the face (not square) HOT 3
- [Feature Request]: Is requiring mediapipe>=0.10.13 too strict? HOT 4
- [Bug]: When Using [SEP] in Adetailer Prompt, only 1 face's prompt is added to the image metadata HOT 4
- [Feature Request]: how to use skip_img2img in webuiapi?skip_img2img is not in args
- [Feature Request]: How to use code with prompt instead of ComfyUI and SDA1111 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adetailer.