aboutsummaryrefslogtreecommitdiff
path: root/modules/paths.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-09-30 08:21:05 +0300
committerAUTOMATIC <16777216c@gmail.com>2022-09-30 08:21:05 +0300
commitf80c3696f63a181f720105559d42ee53453ed0eb (patch)
treeeba52cf67d5a0fb202c10bb3e0310e29cc68f5f2 /modules/paths.py
parentf295d90971952a77033849da4f7db0ff8ccb50e8 (diff)
fix the sys not found error when importing sd_samplers that appeared after PR
Diffstat (limited to 'modules/paths.py')
-rw-r--r--modules/paths.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/modules/paths.py b/modules/paths.py
index df7b9d9a..484f04ca 100644
--- a/modules/paths.py
+++ b/modules/paths.py
@@ -15,21 +15,24 @@ for possible_sd_path in possible_sd_paths:
assert sd_path is not None, "Couldn't find Stable Diffusion in any of: " + str(possible_sd_paths)
path_dirs = [
- (sd_path, 'ldm', 'Stable Diffusion'),
- (os.path.join(sd_path, '../taming-transformers'), 'taming', 'Taming Transformers'),
- (os.path.join(sd_path, '../CodeFormer'), 'inference_codeformer.py', 'CodeFormer'),
- (os.path.join(sd_path, '../BLIP'), 'models/blip.py', 'BLIP'),
- (os.path.join(sd_path, '../latent-diffusion'), 'LDSR.py', 'LDSR'),
- (os.path.join(sd_path, '../k-diffusion'), 'k_diffusion/sampling.py', 'k_diffusion'),
+ (sd_path, 'ldm', 'Stable Diffusion', []),
+ (os.path.join(sd_path, '../taming-transformers'), 'taming', 'Taming Transformers', []),
+ (os.path.join(sd_path, '../CodeFormer'), 'inference_codeformer.py', 'CodeFormer', []),
+ (os.path.join(sd_path, '../BLIP'), 'models/blip.py', 'BLIP', []),
+ (os.path.join(sd_path, '../latent-diffusion'), 'LDSR.py', 'LDSR', []),
+ (os.path.join(sd_path, '../k-diffusion'), 'k_diffusion/sampling.py', 'k_diffusion', ["atstart"]),
]
paths = {}
-for d, must_exist, what in path_dirs:
+for d, must_exist, what, options in path_dirs:
must_exist_path = os.path.abspath(os.path.join(script_path, d, must_exist))
if not os.path.exists(must_exist_path):
print(f"Warning: {what} not found at path {must_exist_path}", file=sys.stderr)
else:
d = os.path.abspath(d)
- sys.path.append(d)
+ if "atstart" in options:
+ sys.path.insert(0, d)
+ else:
+ sys.path.append(d)
paths[what] = d