Skip to content

Commit 7ee2157

Browse files
Merge branch 'master' into anapnoe_current
2 parents 3790bec + 0e0fbf8 commit 7ee2157

File tree

5 files changed

+56
-3
lines changed

5 files changed

+56
-3
lines changed

extensions-builtin/extra-options-section/scripts/extra_options_section.py

+1
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,4 @@ def before_process(self, p, *args):
7676
}))
7777

7878

79+

launch.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from modules import launch_utils
2+
import sympy
23

34
args = launch_utils.args
45
python = launch_utils.python

modules/cmd_args.py

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
parser.add_argument("--loglevel", type=str, help="log level; one of: CRITICAL, ERROR, WARNING, INFO, DEBUG", default=None)
2121
parser.add_argument("--do-not-download-clip", action='store_true', help="do not download CLIP model even if it's not included in the checkpoint")
2222
parser.add_argument("--data-dir", type=str, default=os.path.dirname(os.path.dirname(os.path.realpath(__file__))), help="base path where all user data is stored")
23+
parser.add_argument("--model-dir", type=str, default=os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))),'models'), help="base path where all user data is stored")
2324
parser.add_argument("--config", type=str, default=sd_default_config, help="path to config which constructs model",)
2425
parser.add_argument("--ckpt", type=str, default=sd_model_file, help="path to checkpoint of stable diffusion model; if specified, this checkpoint will be added to the list of checkpoints and loaded",)
2526
parser.add_argument("--ckpt-dir", type=str, default=None, help="Path to directory with stable diffusion checkpoints")

modules/paths_internal.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919

2020
# Parse the --data-dir flag first so we can use it as a base for our other argument default values
2121
parser_pre = argparse.ArgumentParser(add_help=False)
22-
parser_pre.add_argument("--data-dir", type=str, default=os.path.dirname(modules_path), help="base path where all user data is stored", )
22+
parser_pre.add_argument("--data-dir", type=str, default=os.path.dirname(os.path.dirname(os.path.realpath(__file__))), help="base path where all user data is stored",)
23+
parser_pre.add_argument("--model-dir", type=str, default=os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))),"models"), help="base path where all user data is stored",)
2324
cmd_opts_pre = parser_pre.parse_known_args()[0]
2425

2526
data_path = cmd_opts_pre.data_dir
27+
models_path = cmd_opts_pre.model_dir
2628

27-
models_path = os.path.join(data_path, "models")
29+
#models_path = os.path.join(data_path, "models")
2830
extensions_dir = os.path.join(data_path, "extensions")
2931
extensions_builtin_dir = os.path.join(script_path, "extensions-builtin")
3032
config_states_dir = os.path.join(script_path, "config_states")

modules/shared.py

+49-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,55 @@
2121

2222
weight_load_location = None
2323

24-
xformers_available = False
24+
if os.environ.get('IGNORE_CMD_ARGS_ERRORS', None) is None:
25+
cmd_opts = parser.parse_args()
26+
else:
27+
cmd_opts, _ = parser.parse_known_args()
28+
29+
30+
restricted_opts = {
31+
"samples_filename_pattern",
32+
"directories_filename_pattern",
33+
"outdir_samples",
34+
"outdir_txt2img_samples",
35+
"outdir_img2img_samples",
36+
"outdir_extras_samples",
37+
"outdir_grids",
38+
"outdir_txt2img_grids",
39+
"outdir_save",
40+
"outdir_init_images"
41+
}
42+
43+
# https://huggingface.co/datasets/freddyaboulton/gradio-theme-subdomains/resolve/main/subdomains.json
44+
gradio_hf_hub_themes = [
45+
"gradio/glass",
46+
"gradio/monochrome",
47+
"gradio/seafoam",
48+
"gradio/soft",
49+
"freddyaboulton/dracula_revamped",
50+
"gradio/dracula_test",
51+
"abidlabs/dracula_test",
52+
"abidlabs/pakistan",
53+
"dawood/microsoft_windows",
54+
"ysharma/steampunk"
55+
]
56+
57+
58+
cmd_opts.disable_extension_access = (cmd_opts.share or cmd_opts.listen or cmd_opts.server_name) and not cmd_opts.enable_insecure_extension_access
59+
60+
devices.device, devices.device_interrogate, devices.device_gfpgan, devices.device_esrgan, devices.device_codeformer = \
61+
(devices.cpu if any(y in cmd_opts.use_cpu for y in [x, 'all']) else devices.get_optimal_device() for x in ['sd', 'interrogate', 'gfpgan', 'esrgan', 'codeformer'])
62+
63+
devices.dtype = torch.float32 if cmd_opts.no_half else torch.float16
64+
devices.dtype_vae = torch.float32 if cmd_opts.no_half or cmd_opts.no_half_vae else torch.float16
65+
66+
device = devices.device
67+
weight_load_location = None if cmd_opts.lowram else "cpu"
68+
69+
batch_cond_uncond = cmd_opts.always_batch_cond_uncond or not (cmd_opts.lowvram or cmd_opts.medvram)
70+
parallel_processing_allowed = not cmd_opts.lowvram and not cmd_opts.medvram
71+
xformers_available = False
72+
config_filename = cmd_opts.ui_settings_file
2573

2674
hypernetworks = {}
2775

0 commit comments

Comments
 (0)