AutoChar is a custom script for Stable Diffusion WebUI by Automatic1111 (1.6.0+) made to help beginners and enthusiasts alike achieve great pictures with less effort. Basically, it's automation of my basic SD workflow for illustrations (check 'em here: https://t.me/dreamforge_tg)
GitHub Page:
https://github.com/alexv0iceh/AutoChar
Please check my new guide for it on YouTube that explain all basic functions and pipeline:
For text description of scripts' basic idea check 0.9 version tab.
Installation
Just put script and .onnx face recognition model in your stable-diffusion-webui/scripts folder
PLEASE, don't try to install via URL, it's not an extension, it won't be visible this way!
Also I highly recommend to download 4x-UltraSharp Upscaler (https://mega.nz/folder/qZRBmaIY#nIG8KyWFcGNTuMX_XNbJ_g) and put in /modes/ESRGAN folder
How to use, in short
1. Go to your txt2img tab
2. Write prompt, select basic parameters as usual (you don't need highres fix, since it's included in the algorithm)
3. Select "AutoChar 0.9.5" in dropdown menu Scripts in the lower part of page
4. Click "Generate" and enjoy
0.9.5 changes:
Fully revamped interface:
Info added for all crucial parameters, containing tips for usage and clarification for not-so-obvious functions
Upscaler choosing changed from check panels to dropdowns to reduce distraction
Function and slider groups divided to different blocks with clarification headers
True img2img mode: edit existing pictures with SD upscale and automatic face&eyes inpaint
Additional Advanced options!
Brand new Really Advanced options tab for brave enthusiasts willing to take complete control of AutoChar's generation pipeline and maximize their creativity
Various fixes:
Fixed infamous bug with OpenCV on inpaint step (If you STILL have it, do this: please download archive again, I made changes to the code which helped people!)
Fixed inpaint only masked padding, drastically improving results on some artstyles and checkpoints
Fixed High-Res Fix upscalers' list, now it shows all available upscalers as it should
Styles from Styles Menu are now working properly
Many small fixes in code's logic and parameters
Comprehensive description of Advanced and Really Advanced options and tips for their usage:
Advanced options:
Quality functions:
Filtering function: sharpens and applies denoising filter to image after High-Res Fix to improve quality and reduce the number of necessary img2img steps. May negatively impact desired result on "noisy" and blurry artstyles. On by default
Inpaint only the biggest face on the image: does what it says, can be great to prevent undesired face detection and inpaint of background or body parts. May cause problems on images with small character head (full-height pictures and landscapes). In this case, either increase Face Recognition minimum confidence or disable this options. Also disable for pictures with two or more characters. On by default
Lower LoRA strength for face inpaint. Helps avoid burnout with strong LORAs: does what it says. On by default
Use DDIM sampler for better inpaint. Will use chosen in interface otherwise: better for detailed faces. Note that from SD WebUi's version 1.6.0+ denoising strength works differently for DMP++ samplers, so if you're disabling this option because of possible mask residue issues, consider increasing denoising strength for inpaint steps. On by default
Lower CFG for face inpaint. Helps avoid burning with multiple LoRAs: does what it says. Off by default
Algorithm-alterting functions:
Make face inpaint box larger to inpaint hair along with the face: does what it says. It can become quite VRAM heavy, so consider lowering Scaling factor for face inpainting if you're running into issues with it. Off by default
Do face inpaint after hair inpaint: does what it says. Off by default
Attempt mid-uspcale inpainting with chosen options: does what it says. Can be helpful for adding an additional level of detail. Off by default
Use plain Image2Image instead of SD Upscale: does what it says. Off by default
Don't use SD upscale and inpaint HRfix result. Great for weak GPUs: besides stated reason to use it, it can be useful to people accustomed to High-Res Fix-only pipeline. Off by default
Regulate denoise for each step:
All needed info is already in UI, but i would like to add that rom SD WebUi's version 1.6.0+ necessary denoise for DPM++ samplers is like x2 from DDIM denoise up to 0.5; E.g. 0.2 on DDIM is roughly the same as 0.4 on DPM++ 2M Karras
Sliders for parameters:
High-Res Fix scale factor: all info in UI
trength of Filtering: intensity of Filtering function's effect. 0.3-0.5 works best, higher is tricky, but can be helpful for some artstyles
Multiplier for LoRA strength lowering: does what it says. Increase if you want to preserve more of artstyle from your LoRAs
Face Recognition minimum confidence: increase for stricter face detection, decrease if having problems on more anime-like artstyles
Really advanced options:
Tile Overlap parameter for SD Upscale, Scaling factor for face inpainting, Scaling factor for eyes inpainting: all info in UI
Algorithm's steps' settings:
Checkpoint: allows you to choose different one of your checkpoints to be used on this step. Great for mixing artstyles and combining best qualities of each checkpoint!
Sampler: obvious
Clip Skip: my use case is to generate base image on Сlip Skip 2 but work with it on later steps on Clip Skip 1 for better realism
Steps: obvious
Prompt & Negative prompt: allows you to use different prompts and LoRAs for each step. Like, using object or content LoRAs and exclude them from later steps, replacing with LoRAs that have great style, but negatively impact image's content if used in txt2img generation
Coming in 1.0:
Release as full extension.
ControlNet integration.
More face recognition models (including anime-friendly)
Description
AutoChar is a custom script for Stable Diffusion WebUI by Automatic1111 (1.6.0+) made to help beginners and enthusiasts alike achieve great pictures with less effort. Basically, it's automation of my basic SD workflow for illustrations (check 'em here: https://t.me/dreamforge_tg)
GitHub Page:
https://github.com/alexv0iceh/AutoChar
Please check my new guide for it on YouTube that explain all basic functions and pipeline: https://www.youtube.com/watch?v=jNUMHtH1U6E
For text description of scripts' basic idea check 0.9 version tab.
### Installation
Just put script and .onnx face recognition model in your stable-diffusion-webui/scripts folder
PLEASE, don't try to install via URL, it's not an extension, it won't be visible this way!
Also I highly recommend to download 4x-UltraSharp Upscaler (https://mega.nz/folder/qZRBmaIY#nIG8KyWFcGNTuMX_XNbJ_g) and put in /modes/ESRGAN folder
### How to use, in short
1. Go to your txt2img tab
2. Write prompt, select basic parameters as usual (you don't need highres fix, since it's included in the algorithm)
3. Select "AutoChar 0.9.5" in dropdown menu Scripts in the lower part of page
4. Click "Generate" and enjoy
### 0.9.5 changes:
Fully revamped interface:
Info added for all crucial parameters, containing tips for usage and clarification for not-so-obvious functions
Upscaler choosing changed from check panels to dropdowns to reduce distraction
Function and slider groups divided to different blocks with clarification headers
True img2img mode: edit existing pictures with SD upscale and automatic face&eyes inpaint
Additional Advanced options!
Brand new Really Advanced options tab for brave enthusiasts willing to take complete control of AutoChar's generation pipeline and maximize their creativity
Various fixes:
Fixed infamous bug with OpenCV on inpaint step
Fixed inpaint only masked padding, drastically improving results on some artstyles and checkpoints
Fixed High-Res Fix upscalers' list, now it shows all available upscalers as it should
Styles from Styles Menu are now working properly
Many small fixes in code's logic and parameters
### Comprehensive description of Advanced and Really Advanced options and tips for their usage:
Advanced options:
Quality functions:
Filtering function: sharpens and applies denoising filter to image after High-Res Fix to improve quality and reduce the number of necessary img2img steps. May negatively impact desired result on "noisy" and blurry artstyles. On by default
Inpaint only the biggest face on the image: does what it says, can be great to prevent undesired face detection and inpaint of background or body parts. May cause problems on images with small character head (full-height pictures and landscapes). In this case, either increase Face Recognition minimum confidence or disable this options. Also disable for pictures with two or more characters. On by default
Lower LoRA strength for face inpaint. Helps avoid burnout with strong LORAs: does what it says
Use DDIM sampler for better inpaint. Will use chosen in interface otherwise: better for detailed faces. Note that from SD WebUi's version 1.6.0+ denoising strength works differently for DMP++ samplers, so if you're disabling this option because of possible mask residue issues, consider increasing denoising strength for inpaint steps. On by default
Lower CFG for face inpaint. Helps avoid burning with multiple LoRAs: does what it says. Off by default
Algorithm-alterting functions:
Make face inpaint box larger to inpaint hair along with the face: does what it says. It can become quite VRAM heavy, so consider lowering Scaling factor for face inpainting if you're running into issues with it. Off by default
Do face inpaint after hair inpaint: does what it says. Off by default
Attempt mid-uspcale inpainting with chosen options: does what it says. Can be helpful for adding an additional level of detail. Off by default
Use plain Image2Image instead of SD Upscale: does what it says. Off by default
Don't use SD upscale and inpaint HRfix result. Great for weak GPUs: besides stated reason to use it, it can be useful to people accustomed to High-Res Fix-only pipeline. Off by default
Regulate denoise for each step:
All needed info is already in UI, but i would like to add that rom SD WebUi's version 1.6.0+ necessary denoise for DPM++ samplers is like x2 from DDIM denoise up to 0.5; E.g. 0.2 on DDIM is roughly the same as 0.4 on DPM++ 2M Karras
Sliders for parameters:
High-Res Fix scale factor: all info in UI
Strength of Filtering: intensity of Filtering function's effect. 0.3-0.5 works best, higher is tricky, but can be helpful for some artstyles
Multiplier for LoRA strength lowering: does what it says. Increase if you want to preserve more of artstyle from your LoRAs
Face Recognition minimum confidence: increase for stricter face detection, decrease if having problems on more anime-like artstyles
Really advanced options:
Tile Overlap parameter for SD Upscale, Scaling factor for face inpainting, Scaling factor for eyes inpainting: all info in UI
Algorithm's steps' settings:
Checkpoint: allows you to choose different one of your checkpoints to be used on this step. Great for mixing artstyles and combining best qualities of each checkpoint!
Sampler: obvious
Clip Skip: my use case is to generate base image on Сlip Skip 2 but work with it on later steps on Clip Skip 1 for better realism
Steps: obvious
Prompt & Negative prompt: allows you to use different prompts and LoRAs for each step. Like, using object or content LoRAs and exclude them from later steps, replacing with LoRAs that have great style, but negatively impact image's content if used in txt2img generation
## Coming in 1.0:
Release as full extension.
ControlNet integration.
More face recognition models (including anime-friendly)
FAQ
Comments (45)
Guys, if you're still having OpenCV issue on 1.6.0+, please download archive again, i made changes to the code which helped people!
I redownloaded it about five hours after this post. Same issue as before.
*** Error completing request 1.09it/s]
*** Arguments: ('task(pm6tyg0pakiiwvh)', 'Joan Crawford ', '', [], 30, 'DPM++ 2M Karras', 1, 1, 7, 512, 512, True, 0.5, 1.25, '4x-UltraSharp', 12, 0, 0, 'Use same checkpoint', 'Use same sampler', '', '', ['Token merging ratio hr: 0.2'], <gradio.routes.Request object at 0x0000023A718A39D0>, 1, False, '', 0.8, 2427594179, False, -1, 0, 0, 0, True, False, True, False, False, True, False, False, False, {'ad_model': 'face_yolov8n.pt', 'ad_prompt': '', 'ad_negative_prompt': '', 'ad_confidence': 0.3, 'ad_mask_k_largest': 0, 'ad_mask_min_ratio': 0, 'ad_mask_max_ratio': 1, 'ad_x_offset': 0, 'ad_y_offset': 0, 'ad_dilate_erode': 4, 'ad_mask_merge_invert': 'None', 'ad_mask_blur': 4, 'ad_denoising_strength': 0.4, 'ad_inpaint_only_masked': True, 'ad_inpaint_only_masked_padding': 32, 'ad_use_inpaint_width_height': False, 'ad_inpaint_width': 512, 'ad_inpaint_height': 512, 'ad_use_steps': False, 'ad_steps': 28, 'ad_use_cfg_scale': False, 'ad_cfg_scale': 7, 'ad_use_checkpoint': False, 'ad_checkpoint': 'Use same checkpoint', 'ad_use_vae': False, 'ad_vae': 'Use same VAE', 'ad_use_sampler': False, 'ad_sampler': 'DPM++ 2M Karras', 'ad_use_noise_multiplier': False, 'ad_noise_multiplier': 1, 'ad_use_clip_skip': False, 'ad_clip_skip': 1, 'ad_restore_face': False, 'ad_controlnet_model': 'None', 'ad_controlnet_module': 'None', 'ad_controlnet_weight': 1, 'ad_controlnet_guidance_start': 0, 'ad_controlnet_guidance_end': 1, 'is_api': ()}, {'ad_model': 'None', 'ad_prompt': '', 'ad_negative_prompt': '', 'ad_confidence': 0.3, 'ad_mask_k_largest': 0, 'ad_mask_min_ratio': 0, 'ad_mask_max_ratio': 1, 'ad_x_offset': 0, 'ad_y_offset': 0, 'ad_dilate_erode': 4, 'ad_mask_merge_invert': 'None', 'ad_mask_blur': 4, 'ad_denoising_strength': 0.4, 'ad_inpaint_only_masked': True, 'ad_inpaint_only_masked_padding': 32, 'ad_use_inpaint_width_height': False, 'ad_inpaint_width': 512, 'ad_inpaint_height': 512, 'ad_use_steps': False, 'ad_steps': 28, 'ad_use_cfg_scale': False, 'ad_cfg_scale': 7, 'ad_use_checkpoint': False, 'ad_checkpoint': 'Use same checkpoint', 'ad_use_vae': False, 'ad_vae': 'Use same VAE', 'ad_use_sampler': False, 'ad_sampler': 'DPM++ 2M Karras', 'ad_use_noise_multiplier': False, 'ad_noise_multiplier': 1, 'ad_use_clip_skip': False, 'ad_clip_skip': 1, 'ad_restore_face': False, 'ad_controlnet_model': 'None', 'ad_controlnet_module': 'None', 'ad_controlnet_weight': 1, 'ad_controlnet_guidance_start': 0, 'ad_controlnet_guidance_end': 1, 'is_api': ()}, False, 'keyword prompt', 'keyword1, keyword2', 'None', 'textual inversion first', 'None', '0.7', 'None', False, 7, 100, 'Constant', 0, 'Constant', 0, 4, True, 'MEAN', 'AD', 1, UiControlNetUnit(enabled=False, module='none', model='None', weight=1, image=None, resize_mode='Crop and Resize', low_vram=False, processor_res=-1, threshold_a=-1, threshold_b=-1, guidance_start=0, guidance_end=1, pixel_perfect=False, control_mode='Balanced', save_detected_map=True), UiControlNetUnit(enabled=False, module='none', model='None', weight=1, image=None, resize_mode='Crop and Resize', low_vram=False, processor_res=-1, threshold_a=-1, threshold_b=-1, guidance_start=0, guidance_end=1, pixel_perfect=False, control_mode='Balanced', save_detected_map=True), UiControlNetUnit(enabled=False, module='none', model='None', weight=1, image=None, resize_mode='Crop and Resize', low_vram=False, processor_res=-1, threshold_a=-1, threshold_b=-1, guidance_start=0, guidance_end=1, pixel_perfect=False, control_mode='Balanced', save_detected_map=True), False, 'Styles\\duchaitenDarkniji_v133.safetensors [bbf26a639f]', 'None', 3, '', {'calcmodes': ('Normal', 'Normal', 'Normal'), 'save_settings': ['fp16', 'prune', 'safetensors']}, True, False, False, 'None', 'None', 'None', 'Sum', 'Sum', 'Sum', 0.5, 0.5, 0.5, True, True, True, [], [], [], [], [], [], '0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5', '0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5', '0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5', False, False, False, '', '', '', True, True, True, 'Space', 'Dash', True, 0.3, 'Latent (bicubic antialiased)', 0.5, 0.3, 0.3, 0.3, ['Automatic face inpaint', 'Automatic eyes inpaint'], 'Txt2Img', False, 2, 1.25, False, True, True, 14, 64, False, 0.35, 0.7, False, False, True, False, '', '', '', '', '', '', 12, 'DPM++ 2M Karras', 12, 'DPM++ 2M Karras', 12, 'DPM++ 2M Karras', 'Use same checkpoint', 'Use same checkpoint', 'Use same checkpoint', 2.5, 1.5, 1, 1, False, False, 'positive', 'comma', 0, False, False, '', 1, '', [], 0, '', [], 0, '', [], True, False, False, False, 0, False, 'General', True, False, '', '', '', '', '', 'Reset ALL General', 'Not set', 'Not set', 'Not set', 1, 'Not set', 'Disabled', 1.3, 'Not set', 1, 'Not set', 'Not set', 1.3, 1.3, 'Not set', False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, 'Not set', 'Disabled', 1.3, 'Not set', 'Not set', 1.3, 'Not set', 'Disabled', 1, 'Not set', 1.3, 'Not set', 'Not set', 1, 1.3, 'Not set', 'Not set', 'Not set', 'Not set', 'Not set', 'Not set', 'Disabled', 'Not set', 1.3, 1.3, 1.3, 1.3, 'Not set', 'Not set', 1, True, True, 'Not set', 'Not set', 1, 'Not set', 'Disabled', 'Not set', 'Disabled', 1, 1, 1, 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 'Not set', 'Not set', 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1.3, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 1, 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Disabled', 1, 'Not set', 'Disabled', 1, 'Not set', 'Not set', 1, 'Not set', 'Disabled', 'Not set', 'Disabled', 1, 1, 'Not set', 1, 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Disabled', 1, 'Not set', 'Disabled', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 1, 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Disabled', 1, 'Not set', 1, 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Not set', 1, 'Not set', 'Disabled', 1, 'Not set', 1, None, None, False, None, None, False, None, None, False, 50) {}
Traceback (most recent call last):
File "H:\stable-diffusion-webui-directml\modules\call_queue.py", line 57, in f
res = list(func(*args, **kwargs))
File "H:\stable-diffusion-webui-directml\modules\call_queue.py", line 36, in f
res = func(*args, **kwargs)
File "H:\stable-diffusion-webui-directml\modules\txt2img.py", line 61, in txt2img
processed = modules.scripts.scripts_txt2img.run(p, *args)
File "H:\stable-diffusion-webui-directml\modules\scripts.py", line 601, in run
processed = script.run(p, *script_args)
File "H:\stable-diffusion-webui-directml\scripts\AutoChar.py", line 839, in run
last_image_batch.images[0] = enhance_image(last_image_batch, strength)
File "H:\stable-diffusion-webui-directml\scripts\AutoChar.py", line 367, in enhance_image
blended = cv2.addWeighted(dst, 0.6, dst2, 0.4, 0)
cv2.error: OpenCV(4.8.1) D:\a\opencv-python\opencv-python\opencv\modules\core\src\arithm.cpp:650: error: (-209:Sizes of input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in function 'cv::arithm_op'
@mageofthesands279 oh, so it's two step after all!
so yeah, in addition to this please try doing this:
1. Run in terminal %path to your sd folder%\venv\Scripts\activate.bat
2. Then when it shows <venv> run pip install opencv-python==4.7.0.72
3. Reload SD
please report back when you're done! I've got people do both things separately and together, one or two of it seems to fix it.
@alexv0iceh l do that and reload.
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: 1.6.0
Commit hash: 6197993f573b91f8b06889fcd09efd5353dc2cb9
Installing sd-webui-controlnet requirement: changing opencv-python version from 4.7.0.72 to 4.8.0
Yo, this shit is pretty fly. Works for me on 1.6. Excellent Results. A+
If I hadn't already gotten well adjusted to the Automatic1111 flow of things, I'd probably find this to be a great tool. Let me rephrase that. It is a great tool. The workflow is completely different from Automatic1111 but that's a good thing. For those who are not beginners to Stable Diffusion, but are just moving into an intermediate level, this could be a real powerhouse. It's an area where most tools (whether with regard to Stable Diffusion or to anything else in the world) fall short. Things are made either for beginners or for pro/advanced level, with so little in between.
Default settings and face's fucked up, changed only upscaler setting. Attached generation in gallery
How to fix?
error: OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\net_impl.cpp:275: error: (-204:Requested object was not found) Layer with requested id=-1 not found in function 'cv::dnn::dnn4_v20221220::Net::Impl::getLayerData'
No idea, it's worked well few weeks ago, and now:
File "C:\stable-diffusion-webui\scripts\AutoChar.py", line 397, in mask_create face_detector = cv2.FaceDetectorYN_create(weights, "", (0, 0), face_confidence_threshold) cv2.error: OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\onnx\onnx_importer.cpp:270: error: (-5:Bad argument) Can't read ONNX file: C:\stable-diffusion-webui\scripts\face_detection_yunet_2023mar.onnx in function 'cv::dnn::dnn4_v20221220::ONNXImporter::ONNXImporter'automatic1111 on win, tryed openCV 4.7.0 and latest. Tryed to comment part of update OpenCV script. Fresh archive. Any idea?
How to fix this ?
*** Error loading script: AutoChar.py
Traceback (most recent call last):
File "F:\Stable-diffusion\stable-diffusion-webui-master\modules\scripts.py", line 274, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "F:\Stable-diffusion\stable-diffusion-webui-master\modules\script_loading.py", line 10, in load_module
module_spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in callwith_frames_removed
File "F:\Stable-diffusion\stable-diffusion-webui-master\scripts\AutoChar.py", line 9, in <module>
from modules.shared_state import State
ModuleNotFoundError: No module named 'modules.shared_state'
Update A1111 to latest version.
Is it possible to fix only a specific face? Tried with inpaint sketch but the script processes the whole image.
That would require point-and-click segmentation, will try to add it to i2i mode in 1.0, but it's a really hard thing to implement properly.
Amazing extension! IS there a way to generate more than one image at a time without it saving as a grid?
Follow up: Can this be used with xyz prompts?
Thanks! This feature will be added in the upcoming 1.0 version.
For the follow up: impossible for now, will be working after converting to extension in 1.0
0.9.5 is amazing! This is my favorite SD add-on
Thanks!
Now with the LCM Sampler and LowSteps coming up, any chance to get a tutorial which settings to use in the brain damage section? or a version 1.0 maybe? I still love this tool !
Thanks! Yeah, there's an in-depth guide coming up.
Is there a way to have this script work on multiple faces? sometimes it works sometimes it doesn't :(
Try lowering Face recognition minimum confidence, assuming you've already unchecked Inpaint only the biggest face on the image
A1111 version: 1.7.0 (currently latest)
getting error with 0.9.5 and 0.9
0.8 working with 0 issues
Error loading script: AutoChar.py
Traceback (most recent call last):
File "D:\sd.webui\webui\modules\scripts.py", line 469, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "D:\sd.webui\webui\modules\script_loading.py", line 10, in load_module
module_spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in callwith_frames_removed
File "D:\sd.webui\webui\scripts\AutoChar.py", line 35, in <module>
update_opencv()
File "D:\sd.webui\webui\scripts\AutoChar.py", line 26, in update_opencv
subprocess.check_call(["python", '-m', 'pip', 'install', '--upgrade', 'opencv-python'])
File "subprocess.py", line 369, in check_call
subprocess.CalledProcessError: Command '['python', '-m', 'pip', 'install', '--upgrade', 'opencv-python']' returned non-zero exit status 1.
All my faces are greyish and desaturated. Any way to fix this?
Do you use any VAE? No VAE can cause such effect on any i2i
Hi, newbie here, where/how to get the onxx model?
It's in archive with .py script
Привет! Как настроить скрипт что бы он сохранял только конечную генерацию?
Hi! How do I configure the script so that it saves only the final generation?
На данный момент это не реализовано, но в целом это можно изменить в коде, если разобраться. Сохранение изначальной генерации нужно для воспроизводимости, т.к. конечная сохраняет в себе параметры последнего инпеинта, а не изначальной генерации.
Is there any possible way to get the hires fix pass in img2img back to running its number of steps? Now it skips them but says 'HR fix complete' before inpainting or SDUpscale.
Autochar's filter and corrections are still being made and look great. It's really more my own preference/obstacle. Back when it ran the batch of hires steps on my img2img generations, I liked the output I was getting more. It was also convenient to let the HR pass add its part in conjuction with Autochar. Versus adding initial steps or running changes on the initial image or looping it back with less denoise.
I'm using multidiffusion upscaler and trying to add in Adetailer or the 'CustomHiresFix' extension to see if the Autochar HRfix steps will appear or be applied in the way Autochar does them.
Any settings in SD I can change? Or options in the 'algorithm-altering functions' section of Autochar?
sadly i dont think there is a way since HRfix is intergrated to Autochar its made so that none of the HRfixes including custom HRfix are needed but ADetailer Should Work and the author would know if its possible but as far as i can say it wouldnt work it would pretty much Break Autochar or mess up your own Files etc
Hey, I keep getting this error "AssertionError: bad sampler name: DPM++ 2M Karras", no matter what sampler I choose, it's always that bug and SD can't generate anything when using Autochar.
Same here :(
I just found a solution. I imagine you are using the sampler 'Euler a' to generate your images normally without this add-on.
Well, go into the tab 'Advanced Options' and then into 'Really Advanced Options'.
In there you will find 'High-Res Fix sampler', 'SD Upscale sampler', 'Inpaint sampler'. By default they are set to the sampler 'DPM++ 2M Karras' which is causing this issue.
Solution: Simply change the sampler from 'DPM++ 2M Karras" to 'Euler a' in each one of them: 'High-Res Fix sampler', 'SD Upscale sampler', 'Inpaint sampler'. That should fix your issue. It fixed mine.
Good luck!
@nyaan_chan_ai Thanks. That's one issue down. Now I've got to find out what the ONNXImporter is and why the script register a bad argument. It can't read the ONNX file.
The script is throwing this error: error: OpenCV(4.9.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\onnx\onnx_importer.cpp:275: error: (-5:Bad argument) Can't read ONNX file: C:\Users\denni\pinokio\api\automatic1111.git\app\scripts\face_detection_yunet_2022mar.onnx in function 'cv::dnn::dnn4_v20231225::ONNXImporter::ONNXImporter'
Getting 'NoneType' object is not iterable error in Forge :(
I just found a solution. I imagine you are using the sampler 'Euler a' to generate your images normally without this add-on.
Well, go into the tab 'Advanced Options' and then into 'Really Advanced Options'.
In there you will find 'High-Res Fix sampler', 'SD Upscale sampler', 'Inpaint sampler'. By default they are set to the sampler 'DPM++ 2M Karras' which is causing this issue.
Solution: Simply change the sampler from 'DPM++ 2M Karras" to 'Euler a' in each one of them: 'High-Res Fix sampler', 'SD Upscale sampler', 'Inpaint sampler'. That should fix your issue. It fixed mine.
Good luck!
_____
i did what he told and work fine, for now
@Youpokes thank you I am using DPM++ 2M Karras by default! I will check it then :)
hi, my problem is - error and does not enlarge the image.
Hello i get this error in my command windows,
Launching Web UI with arguments: --xformers
*** Error loading script: AutoChar.py
Traceback (most recent call last):
File "D:\Games\SDWEb\WebUI\webui\modules\scripts.py", line 508, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "D:\Games\SDWEb\WebUI\webui\modules\script_loading.py", line 13, in load_module
module_spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 879, in exec_module
File "<frozen importlib._bootstrap_external>", line 1017, in get_code
File "<frozen importlib._bootstrap_external>", line 947, in source_to_code
File "<frozen importlib._bootstrap>", line 241, in callwith_frames_removed
File "D:\Games\SDWEb\WebUI\webui\scripts\AutoChar.py", line 106
<title>AutoChar/AutoChar.py at main · alexv0iceh/AutoChar · GitHub</title>
^
SyntaxError: invalid character '·' (U+00B7)
Hey, after installing this in the script folder, I've got this error. Removing Autochar didn't fix the problem; I had to completely remove Forge and reinstall it from scratch. Now, I'm kind of hesitant to try again. Any idea what might be the culprit here? "File "E:\AI\webui_forge_cu121_torch21\webui\launch.py", line 51, in <module> main() File "E:\AI\webui_forge_cu121_torch21\webui\launch.py", line 47, in main start() File "E:\AI\webui_forge_cu121_torch21\webui\modules\launch_utils.py", line 541, in start import webui File "E:\AI\webui_forge_cu121_torch21\webui\webui.py", line 19, in <module> initialize.imports() File "E:\AI\webui_forge_cu121_torch21\webui\modules\initialize.py", line 53, in imports from modules import processing, gradio_extensons, ui # noqa: F401 File "E:\AI\webui_forge_cu121_torch21\webui\modules\processing.py", line 31, in <module> from ldm.data.util import AddMiDaS File "E:\AI\webui_forge_cu121_torch21\webui\repositories\stable-diffusion-stability-ai\ldm\data\util.py", line 3, in <module> from ldm.modules.midas.api import load_midas_transform File "E:\AI\webui_forge_cu121_torch21\webui\repositories\stable-diffusion-stability-ai\ldm\modules\midas\api.py", line 11, in <module> from ldm.modules.midas.midas.transforms import Resize, NormalizeImage, PrepareForNet File "E:\AI\webui_forge_cu121_torch21\webui\repositories\stable-diffusion-stability-ai\ldm\modules\midas\midas\transforms.py", line 6, in <module> def apply_min_size(sample, size, image_interpolation_method=cv2.INTER_AREA): AttributeError: module 'cv2' has no attribute 'INTER_AREA'""
It's not intended to be compatible with Forge and is not said to be so. Any errors there are mystery to me, sad to say.
No longer works with Stable Diffusion ReForge
Moving model(s) has taken 0.35 seconds
Traceback (most recent call last):
File "D:\Programme\Stable Diffussion ReForge\modules_forge\main_thread.py", line 37, in loop
File "D:\Programme\Stable Diffussion ReForge\modules_forge\main_thread.py", line 26, in work
self.result = self.func(*self.args, **self.kwargs)
File "D:\Programme\Stable Diffussion ReForge\modules\txt2img.py", line 111, in txt2img_function
processed = modules.scripts.scripts_txt2img.run(p, *p.script_args)
File "D:\Programme\Stable Diffussion ReForge\modules\scripts.py", line 791, in run
processed = script.run(p, *script_args)
File "D:\Programme\Stable Diffussion ReForge\scripts\AutoChar.py", line 884, in run
last_image_batch = sd_upscale(last_image_batch, scale_factor, is_last,overlap, ui_upscaler_2)
File "D:\Programme\Stable Diffussion ReForge\scripts\AutoChar.py", line 719, in sd_upscale
sd_upscale_output = sd_up_run.run(self, instance_sd_upscale, None , overlap_func, ui_upscaler_2_func, sd_upscale_scale_factor)
File "D:\Programme\Stable Diffussion ReForge\scripts\sd_upscale.py", line 79, in run
processed = processing.process_images(p)
File "D:\Programme\Stable Diffussion ReForge\modules\processing.py", line 823, in process_images
res = process_images_inner(p)
File "D:\Programme\Stable Diffussion ReForge\modules\processing.py", line 961, in process_images_inner
advanced_model_sampling_script = next((x for x in p.scripts.alwayson_scripts if x.name == 'advanced model sampling for reforge (backported)'), None)
AttributeError: 'NoneType' object has no attribute 'alwayson_scripts'
'NoneType' object has no attribute 'alwayson_scripts'
*** Error completing request
*** Arguments: ('task(qfmvlrihx57wr63)', <gradio.routes.Request object at 0x000002151E054550>, '(masterpiece:1.2, best quality) score_9, score_8_up, score_7_up, score_6_up, source_anime, upper body, front view, standing, bar,\n1girl, (adult), (mature face), emerald green eyes, red hair, ((very long hair)), curly hair, (2 braids), small breasts, navel, belly, freckles, vampire fangs, \n(black off-shoulder crop hoodie), oversized clothes,', 'Negative prompt: ((((ugly)))), (((duplicate))), ((morbid)), ((mutilated)), [out of frame], extra fingers, mutated hands, ((poorly drawn hands)), ((poorly drawn face)), ((((fused bodies)))), (((mutation))), (((deformed))), blurry, ((bad anatomy)), (((bad proportions))), ((extra limbs)), cloned face, (((disfigured))), gross proportions, (malformed limbs), ((missing arms)), ((missing legs)), (((extra arms))), (((extra legs))), (fused fingers), (too many fingers), (((long neck))), ((multible belly buttons)), text, textbubble, bad_prompt_version2, bad_prompt_version2-neg, easynegative, bad-hands-5, verybadimagenegative_v1.3, child, young face\n', [], 1, 1, 7, 1024, 768, False, 0.7, 2, 'Latent', 0, 0, 0, 'Use same checkpoint', 'Use same sampler', 'Use same scheduler', '', '', [], 1, 30, 'DPM++ 3M SDE', 'Automatic', False, '', 0.8, -1, False, -1, 0, 0, 0, False, False, False, 'SDXL', '', 'Equal Weights', 832, 1216, False, False, {'ad_model': 'face_yolov8n.pt', 'ad_model_classes': '', 'ad_tab_enable': True, 'ad_prompt': '', 'ad_negative_prompt': '', 'ad_confidence': 0.3, 'ad_mask_filter_method': 'Area', 'ad_mask_k': 0, 'ad_mask_min_ratio': 0, 'ad_mask_max_ratio': 1, 'ad_x_offset': 0, 'ad_y_offset': 0, 'ad_dilate_erode': 4, 'ad_mask_merge_invert': 'None', 'ad_mask_blur': 4, 'ad_denoising_strength': 0.4, 'ad_inpaint_only_masked': True, 'ad_inpaint_only_masked_padding': 32, 'ad_use_inpaint_width_height': False, 'ad_inpaint_width': 512, 'ad_inpaint_height': 512, 'ad_use_steps': False, 'ad_steps': 28, 'ad_use_cfg_scale': False, 'ad_cfg_scale': 7, 'ad_use_checkpoint': False, 'ad_checkpoint': 'Use same checkpoint', 'ad_use_vae': False, 'ad_vae': 'Use same VAE', 'ad_use_sampler': False, 'ad_sampler': 'DPM++ 2M', 'ad_scheduler': 'Use same scheduler', 'ad_use_noise_multiplier': False, 'ad_noise_multiplier': 1, 'ad_use_clip_skip': False, 'ad_clip_skip': 1, 'ad_restore_face': False, 'ad_controlnet_model': 'None', 'ad_controlnet_module': 'None', 'ad_controlnet_weight': 1, 'ad_controlnet_guidance_start': 0, 'ad_controlnet_guidance_end': 1, 'is_api': ()}, {'ad_model': 'None', 'ad_model_classes': '', 'ad_tab_enable': True, 'ad_prompt': '', 'ad_negative_prompt': '', 'ad_confidence': 0.3, 'ad_mask_filter_method': 'Area', 'ad_mask_k': 0, 'ad_mask_min_ratio': 0, 'ad_mask_max_ratio': 1, 'ad_x_offset': 0, 'ad_y_offset': 0, 'ad_dilate_erode': 4, 'ad_mask_merge_invert': 'None', 'ad_mask_blur': 4, 'ad_denoising_strength': 0.4, 'ad_inpaint_only_masked': True, 'ad_inpaint_only_masked_padding': 32, 'ad_use_inpaint_width_height': False, 'ad_inpaint_width': 512, 'ad_inpaint_height': 512, 'ad_use_steps': False, 'ad_steps': 28, 'ad_use_cfg_scale': False, 'ad_cfg_scale': 7, 'ad_use_checkpoint': False, 'ad_checkpoint': 'Use same checkpoint', 'ad_use_vae': False, 'ad_vae': 'Use same VAE', 'ad_use_sampler': False, 'ad_sampler': 'DPM++ 2M', 'ad_scheduler': 'Use same scheduler', 'ad_use_noise_multiplier': False, 'ad_noise_multiplier': 1, 'ad_use_clip_skip': False, 'ad_clip_skip': 1, 'ad_restore_face': False, 'ad_controlnet_model': 'None', 'ad_controlnet_module': 'None', 'ad_controlnet_weight': 1, 'ad_controlnet_guidance_start': 0, 'ad_controlnet_guidance_end': 1, 'is_api': ()}, {'ad_model': 'None', 'ad_model_classes': '', 'ad_tab_enable': True, 'ad_prompt': '', 'ad_negative_prompt': '', 'ad_confidence': 0.3, 'ad_mask_filter_method': 'Area', 'ad_mask_k': 0, 'ad_mask_min_ratio': 0, 'ad_mask_max_ratio': 1, 'ad_x_offset': 0, 'ad_y_offset': 0, 'ad_dilate_erode': 4, 'ad_mask_merge_invert': 'None', 'ad_mask_blur': 4, 'ad_denoising_strength': 0.4, 'ad_inpaint_only_masked': True, 'ad_inpaint_only_masked_padding': 32, 'ad_use_inpaint_width_height': False, 'ad_inpaint_width': 512, 'ad_inpaint_height': 512, 'ad_use_steps': False, 'ad_steps': 28, 'ad_use_cfg_scale': False, 'ad_cfg_scale': 7, 'ad_use_checkpoint': False, 'ad_checkpoint': 'Use same checkpoint', 'ad_use_vae': False, 'ad_vae': 'Use same VAE', 'ad_use_sampler': False, 'ad_sampler': 'DPM++ 2M', 'ad_scheduler': 'Use same scheduler', 'ad_use_noise_multiplier': False, 'ad_noise_multiplier': 1, 'ad_use_clip_skip': False, 'ad_clip_skip': 1, 'ad_restore_face': False, 'ad_controlnet_model': 'None', 'ad_controlnet_module': 'None', 'ad_controlnet_weight': 1, 'ad_controlnet_guidance_start': 0, 'ad_controlnet_guidance_end': 1, 'is_api': ()}, {'ad_model': 'None', 'ad_model_classes': '', 'ad_tab_enable': True, 'ad_prompt': '', 'ad_negative_prompt': '', 'ad_confidence': 0.3, 'ad_mask_filter_method': 'Area', 'ad_mask_k': 0, 'ad_mask_min_ratio': 0, 'ad_mask_max_ratio': 1, 'ad_x_offset': 0, 'ad_y_offset': 0, 'ad_dilate_erode': 4, 'ad_mask_merge_invert': 'None', 'ad_mask_blur': 4, 'ad_denoising_strength': 0.4, 'ad_inpaint_only_masked': True, 'ad_inpaint_only_masked_padding': 32, 'ad_use_inpaint_width_height': False, 'ad_inpaint_width': 512, 'ad_inpaint_height': 512, 'ad_use_steps': False, 'ad_steps': 28, 'ad_use_cfg_scale': False, 'ad_cfg_scale': 7, 'ad_use_checkpoint': False, 'ad_checkpoint': 'Use same checkpoint', 'ad_use_vae': False, 'ad_vae': 'Use same VAE', 'ad_use_sampler': False, 'ad_sampler': 'DPM++ 2M', 'ad_scheduler': 'Use same scheduler', 'ad_use_noise_multiplier': False, 'ad_noise_multiplier': 1, 'ad_use_clip_skip': False, 'ad_clip_skip': 1, 'ad_restore_face': False, 'ad_controlnet_model': 'None', 'ad_controlnet_module': 'None', 'ad_controlnet_weight': 1, 'ad_controlnet_guidance_start': 0, 'ad_controlnet_guidance_end': 1, 'is_api': ()}, False, True, 'Basic', '', 'Horizontal', 'None', 0.5, [[0, 0.5, 0, 1, 1], [0.5, 1, 0, 1, 1]], '{ }', False, <scripts.animatediff_ui.AnimateDiffProcess object at 0x000002151E0560B0>, False, False, 'Matrix', 'Columns', 'Mask', 'Prompt', '1,1', '0.2', False, False, False, 'Attention', [False], '0', '0', '0.4', None, '0', '0', False, False, False, 0, None, [], 0, False, [], [], False, 0, 1, False, False, 0, None, [], -2, False, [], False, 0, None, None, ControlNetUnit(input_mode=<InputMode.SIMPLE: 'simple'>, use_preview_as_input=False, batch_image_dir='', batch_mask_dir='', batch_input_gallery=[], batch_mask_gallery=[], multi_inputs_gallery=[], generated_image=None, mask_image=None, hr_option=<HiResFixOption.BOTH: 'Both'>, enabled=False, module='None', model='None', weight=1, image=None, resize_mode=<ResizeMode.INNER_FIT: 'Crop and Resize'>, processor_res=-1, threshold_a=-1, threshold_b=-1, guidance_start=0, guidance_end=1, pixel_perfect=False, control_mode=<ControlMode.BALANCED: 'Balanced'>, advanced_weighting=None, save_detected_map=True), ControlNetUnit(input_mode=<InputMode.SIMPLE: 'simple'>, use_preview_as_input=False, batch_image_dir='', batch_mask_dir='', batch_input_gallery=[], batch_mask_gallery=[], multi_inputs_gallery=[], generated_image=None, mask_image=None, hr_option=<HiResFixOption.BOTH: 'Both'>, enabled=False, module='None', model='None', weight=1, image=None, resize_mode=<ResizeMode.INNER_FIT: 'Crop and Resize'>, processor_res=-1, threshold_a=-1, threshold_b=-1, guidance_start=0, guidance_end=1, pixel_perfect=False, control_mode=<ControlMode.BALANCED: 'Balanced'>, advanced_weighting=None, save_detected_map=True), ControlNetUnit(input_mode=<InputMode.SIMPLE: 'simple'>, use_preview_as_input=False, batch_image_dir='', batch_mask_dir='', batch_input_gallery=[], batch_mask_gallery=[], multi_inputs_gallery=[], generated_image=None, mask_image=None, hr_option=<HiResFixOption.BOTH: 'Both'>, enabled=False, module='None', model='None', weight=1, image=None, resize_mode=<ResizeMode.INNER_FIT: 'Crop and Resize'>, processor_res=-1, threshold_a=-1, threshold_b=-1, guidance_start=0, guidance_end=1, pixel_perfect=False, control_mode=<ControlMode.BALANCED: 'Balanced'>, advanced_weighting=None, save_detected_map=True), False, False, 7, 1, 'Constant', 0, 'Constant', 0, 1, 'enable', 'MEAN', 'AD', 1, False, 1.01, 1.02, 0.99, 0.95, False, 0.5, 2, False, 256, 2, 0, False, False, 3, 2, 0, 0.35, True, 'bicubic', 'bicubic', False, 0.5, 0.18, 15, 1, False, 0.7, False, 'Discrete', 'v_prediction', True, 'v_prediction', 120, 0.002, False, 'MultiDiffusion', 768, 768, 64, 4, False, False, True, 0.3, 'Latent (bicubic antialiased)', 0.5, 0.3, 0.3, 0.3, ['Automatic face inpaint', 'Automatic eyes inpaint'], 'Txt2Img', False, 2, 1.25, False, True, True, 9, 64, False, 0.35, 0.7, False, False, True, False, '', '', '', '', '', '', 12, 'DPM++ 2M Karras', 12, 'DPM++ 2M Karras', 12, 'DPM++ 2M Karras', 'Use same checkpoint', 'Use same checkpoint', 'Use same checkpoint', 2.5, 1.5, 1, 1, False, False, 'positive', 'comma', 0, False, False, 'start', '', 1, '', [], 0, '', [], 0, '', [], True, False, 0, False, False, False, False, False, False, 0, False, [], 30, '', 4, [], 1, '', '', '', '') {}
Traceback (most recent call last):
File "D:\Programme\Stable Diffussion ReForge\modules\call_queue.py", line 74, in f
res = list(func(*args, **kwargs))
TypeError: 'NoneType' object is not iterable
---
Please, new version........ ???
this unfortunately crashed my system



