aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordarnell8 <darnell8@gmail.com>2023-04-25 14:53:06 +0000
committerdarnell8 <darnell8@gmail.com>2023-04-25 14:53:06 +0000
commitbb426de1cd1380844eb048f242bca6aa254edf58 (patch)
tree746031c1c3239d1adc1757873f727b8c816b2291
parent22bcc7be428c94e9408f589966c2040187245d81 (diff)
downloadstable-diffusion-webui-gfx803-bb426de1cd1380844eb048f242bca6aa254edf58.tar.gz
stable-diffusion-webui-gfx803-bb426de1cd1380844eb048f242bca6aa254edf58.tar.bz2
stable-diffusion-webui-gfx803-bb426de1cd1380844eb048f242bca6aa254edf58.zip
Fix CLIP FileExistsError
-rw-r--r--modules/interrogate.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/interrogate.py b/modules/interrogate.py
index cbb80683..ecdb11bb 100644
--- a/modules/interrogate.py
+++ b/modules/interrogate.py
@@ -32,7 +32,8 @@ def download_default_clip_interrogate_categories(content_dir):
category_types = ["artists", "flavors", "mediums", "movements"]
try:
- os.makedirs(tmpdir)
+ if not os.path.exists(tmpdir):
+ os.makedirs(tmpdir)
for category_type in category_types:
torch.hub.download_url_to_file(f"https://raw.githubusercontent.com/pharmapsychotic/clip-interrogator/main/clip_interrogator/data/{category_type}.txt", os.path.join(tmpdir, f"{category_type}.txt"))
os.rename(tmpdir, content_dir)
@@ -41,7 +42,7 @@ def download_default_clip_interrogate_categories(content_dir):
errors.display(e, "downloading default CLIP interrogate categories")
finally:
if os.path.exists(tmpdir):
- os.remove(tmpdir)
+ os.removedirs(tmpdir)
class InterrogateModels: