diff options
author | AUTOMATIC <16777216c@gmail.com> | 2023-03-25 13:05:12 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2023-03-25 13:05:25 +0000 |
commit | 8c801362b43013a628c58f0c1276e076ee48227d (patch) | |
tree | 601abc1c2ed5d5129cccb1ef9bff3a17fa265437 /modules/paths_internal.py | |
parent | 3ec7e19f2b0ee520972d9c7f481a13f9bc21b9dc (diff) | |
download | stable-diffusion-webui-gfx803-8c801362b43013a628c58f0c1276e076ee48227d.tar.gz stable-diffusion-webui-gfx803-8c801362b43013a628c58f0c1276e076ee48227d.tar.bz2 stable-diffusion-webui-gfx803-8c801362b43013a628c58f0c1276e076ee48227d.zip |
split commandline args into its own file
make launch.py use the same command line argument parser as the main program
Diffstat (limited to 'modules/paths_internal.py')
-rw-r--r-- | modules/paths_internal.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/paths_internal.py b/modules/paths_internal.py new file mode 100644 index 00000000..926ec3bb --- /dev/null +++ b/modules/paths_internal.py @@ -0,0 +1,22 @@ +"""this module defines internal paths used by program and is safe to import before dependencies are installed in launch.py"""
+
+import argparse
+import os
+
+script_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
+
+sd_configs_path = os.path.join(script_path, "configs")
+sd_default_config = os.path.join(sd_configs_path, "v1-inference.yaml")
+sd_model_file = os.path.join(script_path, 'model.ckpt')
+default_sd_model_file = sd_model_file
+
+# Parse the --data-dir flag first so we can use it as a base for our other argument default values
+parser_pre = argparse.ArgumentParser(add_help=False)
+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",)
+cmd_opts_pre = parser_pre.parse_known_args()[0]
+
+data_path = cmd_opts_pre.data_dir
+
+models_path = os.path.join(data_path, "models")
+extensions_dir = os.path.join(data_path, "extensions")
+extensions_builtin_dir = os.path.join(script_path, "extensions-builtin")
|