Type | Other |
Stats | 3,126 0 |
Reviews | (486) |
Published | Jun 23, 2023 |
Base Model | |
Hash | AutoV2 0C144A8DB9 |
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)
Discussion
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
---
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'""
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)
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'
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.
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?