mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 01:04:32 +02:00
fix mask missing options and system paths
This commit is contained in:
@@ -438,7 +438,6 @@ def list_available_networks():
|
||||
forbidden_network_aliases.clear()
|
||||
available_network_hash_lookup.clear()
|
||||
forbidden_network_aliases.update({"none": 1, "Addams": 1})
|
||||
os.makedirs(shared.cmd_opts.lora_dir, exist_ok=True)
|
||||
directories = []
|
||||
if os.path.exists(shared.cmd_opts.lora_dir):
|
||||
directories.append(shared.cmd_opts.lora_dir)
|
||||
|
||||
@@ -85,7 +85,7 @@ def control_run(units: List[unit.Unit], inputs, inits, mask, unit_type: str, is_
|
||||
n_iter = batch_count,
|
||||
batch_size = batch_size,
|
||||
inpaint_full_res = masking.opts.mask_only,
|
||||
inpaint_full_res_padding = masking.opts.mask_padding,
|
||||
# inpaint_full_res_padding = masking.opts.mask_padding,
|
||||
inpainting_mask_invert = 1 if masking.opts.invert else 0,
|
||||
inpainting_fill = 1,
|
||||
hdr_mode=hdr_mode, hdr_brightness=hdr_brightness, hdr_color=hdr_color, hdr_sharpen=hdr_sharpen, hdr_clamp=hdr_clamp,
|
||||
|
||||
+1
-1
@@ -385,7 +385,7 @@ def run_mask(input_image: gr.Image, input_mask: gr.Image = None, return_type: st
|
||||
|
||||
return_type = return_type or opts.preview_type
|
||||
|
||||
shared.log.debug(f'Mask: size={input_image.width}x{input_image.height} masked={mask_size}px area={area_size/total_size:.2f} auto={opts.auto_mask} type={return_type} time={t1-t0:.2f}')
|
||||
shared.log.debug(f'Mask: size={input_image.width}x{input_image.height} masked={mask_size}px area={area_size/total_size:.2f} auto={opts.auto_mask} blur={opts.mask_blur} erode={opts.mask_erode} dilate={opts.mask_dilate} type={return_type} time={t1-t0:.2f}')
|
||||
if return_type == 'None':
|
||||
return input_mask
|
||||
elif return_type == 'Binary':
|
||||
|
||||
@@ -199,9 +199,6 @@ def initialize_onnx():
|
||||
from modules.paths import models_path
|
||||
from modules.shared import opts
|
||||
from .execution_providers import ExecutionProvider, TORCH_DEVICE_TO_EP, available_execution_providers
|
||||
onnx_dir = os.path.join(models_path, "ONNX")
|
||||
if not os.path.isdir(onnx_dir):
|
||||
os.mkdir(onnx_dir)
|
||||
if devices.backend == "rocm":
|
||||
TORCH_DEVICE_TO_EP["cuda"] = ExecutionProvider.ROCm
|
||||
from .pipelines.onnx_stable_diffusion_pipeline import OnnxStableDiffusionPipeline
|
||||
|
||||
@@ -28,6 +28,7 @@ models_config = cli.models_dir or config.get('models_dir') or 'models'
|
||||
models_path = models_config if os.path.isabs(models_config) else os.path.join(data_path, models_config)
|
||||
extensions_dir = os.path.join(data_path, "extensions")
|
||||
extensions_builtin_dir = "extensions-builtin"
|
||||
onnx_dir = os.path.join(models_path, "ONNX")
|
||||
sd_configs_path = os.path.join(script_path, "configs")
|
||||
sd_default_config = os.path.join(sd_configs_path, "v1-inference.yaml")
|
||||
sd_model_file = cli.ckpt or os.path.join(script_path, 'model.ckpt') # not used
|
||||
@@ -94,6 +95,7 @@ def create_paths(opts):
|
||||
create_path(sd_configs_path)
|
||||
create_path(extensions_dir)
|
||||
create_path(extensions_builtin_dir)
|
||||
create_path(onnx_dir)
|
||||
create_path(fix_path('temp_dir'))
|
||||
create_path(fix_path('ckpt_dir'))
|
||||
create_path(fix_path('diffusers_dir'))
|
||||
|
||||
@@ -17,8 +17,11 @@ codeformer = None
|
||||
|
||||
|
||||
def setup_model(dirname):
|
||||
if not os.path.exists(model_path):
|
||||
os.makedirs(model_path)
|
||||
try:
|
||||
if not os.path.exists(model_path):
|
||||
os.makedirs(model_path)
|
||||
except Exception:
|
||||
pass
|
||||
path = modules.paths.paths.get("CodeFormer", None)
|
||||
if path is None:
|
||||
return
|
||||
|
||||
@@ -66,8 +66,11 @@ gfpgan_constructor = None
|
||||
|
||||
|
||||
def setup_model(dirname):
|
||||
if not os.path.exists(model_path):
|
||||
os.makedirs(model_path)
|
||||
try:
|
||||
if not os.path.exists(model_path):
|
||||
os.makedirs(model_path)
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
import gfpgan
|
||||
import facexlib
|
||||
|
||||
@@ -122,8 +122,6 @@ class NoWatermark:
|
||||
|
||||
|
||||
def setup_model():
|
||||
if not os.path.exists(model_path):
|
||||
os.makedirs(model_path, exist_ok=True)
|
||||
list_models()
|
||||
if shared.backend == shared.Backend.ORIGINAL:
|
||||
enable_midas_autodownload()
|
||||
|
||||
+2
-3
@@ -486,13 +486,12 @@ options_templates.update(options_section(('system-paths', "System Paths"), {
|
||||
"swinir_models_path": OptionInfo(os.path.join(paths.models_path, 'SwinIR'), "Folder with SwinIR models", folder=True),
|
||||
"ldsr_models_path": OptionInfo(os.path.join(paths.models_path, 'LDSR'), "Folder with LDSR models", folder=True),
|
||||
"clip_models_path": OptionInfo(os.path.join(paths.models_path, 'CLIP'), "Folder with CLIP models", folder=True),
|
||||
"onnx_cached_models_path": OptionInfo(os.path.join(paths.models_path, 'ONNX', 'cache'), "Folder with ONNX cached models", folder=True),
|
||||
|
||||
"other_paths_sep_options": OptionInfo("<h2>Other paths</h2>", "", gr.HTML),
|
||||
"openvino_cache_path": OptionInfo('cache', "Directory for OpenVINO cache", folder=True),
|
||||
"onnx_cached_models_path": OptionInfo(os.path.join(paths.models_path, 'ONNX', 'cache'), "Folder with ONNX cached models", folder=True),
|
||||
"onnx_temp_dir": OptionInfo(os.path.join(paths.models_path, 'ONNX', 'temp'), "Directory for ONNX conversion and Olive optimization process", folder=True),
|
||||
"temp_dir": OptionInfo("", "Directory for temporary images; leave empty for default", folder=True),
|
||||
"clean_temp_dir_at_start": OptionInfo(True, "Cleanup non-default temporary directory when starting webui"),
|
||||
"onnx_temp_dir": OptionInfo(os.path.join(paths.models_path, 'ONNX', 'temp'), "Directory for ONNX conversion and Olive optimization process", folder=True),
|
||||
}))
|
||||
|
||||
options_templates.update(options_section(('saving-images', "Image Options"), {
|
||||
|
||||
@@ -33,13 +33,16 @@ def initialize():
|
||||
masking.cache_dir = os.path.join(shared.opts.control_dir, 'segment')
|
||||
unit.default_device = devices.device
|
||||
unit.default_dtype = devices.dtype
|
||||
os.makedirs(shared.opts.control_dir, exist_ok=True)
|
||||
os.makedirs(controlnet.cache_dir, exist_ok=True)
|
||||
os.makedirs(xs.cache_dir, exist_ok=True)
|
||||
os.makedirs(lite.cache_dir, exist_ok=True)
|
||||
os.makedirs(t2iadapter.cache_dir, exist_ok=True)
|
||||
os.makedirs(processors.cache_dir, exist_ok=True)
|
||||
os.makedirs(masking.cache_dir, exist_ok=True)
|
||||
try:
|
||||
os.makedirs(shared.opts.control_dir, exist_ok=True)
|
||||
os.makedirs(controlnet.cache_dir, exist_ok=True)
|
||||
os.makedirs(xs.cache_dir, exist_ok=True)
|
||||
os.makedirs(lite.cache_dir, exist_ok=True)
|
||||
os.makedirs(t2iadapter.cache_dir, exist_ok=True)
|
||||
os.makedirs(processors.cache_dir, exist_ok=True)
|
||||
os.makedirs(masking.cache_dir, exist_ok=True)
|
||||
except Exception:
|
||||
pass
|
||||
scripts.scripts_current = scripts.scripts_control
|
||||
scripts.scripts_current.initialize_scripts(is_img2img=True)
|
||||
|
||||
|
||||
+5
-2
@@ -44,8 +44,11 @@ class Upscaler:
|
||||
shared.log.info(f'Upscaler create: folder="{self.user_path}"')
|
||||
if self.model_path is None and self.name:
|
||||
self.model_path = os.path.join(shared.models_path, self.name)
|
||||
if self.model_path and create_dirs:
|
||||
os.makedirs(self.model_path, exist_ok=True)
|
||||
try:
|
||||
if self.model_path and create_dirs:
|
||||
os.makedirs(self.model_path, exist_ok=True)
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
import cv2 # pylint: disable=unused-import
|
||||
self.can_tile = True
|
||||
|
||||
+1
-1
Submodule wiki updated: fa981144c0...581d85a87f
Reference in New Issue
Block a user