diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-10-07 10:22:50 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-10-07 10:22:50 +0000 |
commit | 97bc0b9504572d2df80598d0b694703bcd626de6 (patch) | |
tree | 7b6596cdede32c95098fff7de87246523de7aab5 | |
parent | d15b3ec0013c10f02f0fb80e8448bac8872a151f (diff) | |
download | stable-diffusion-webui-gfx803-97bc0b9504572d2df80598d0b694703bcd626de6.tar.gz stable-diffusion-webui-gfx803-97bc0b9504572d2df80598d0b694703bcd626de6.tar.bz2 stable-diffusion-webui-gfx803-97bc0b9504572d2df80598d0b694703bcd626de6.zip |
do not stop working on failed hypernetwork load
-rw-r--r-- | modules/hypernetwork.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/modules/hypernetwork.py b/modules/hypernetwork.py index 9ed1eed9..c5cf4afa 100644 --- a/modules/hypernetwork.py +++ b/modules/hypernetwork.py @@ -1,5 +1,8 @@ import glob
import os
+import sys
+import traceback
+
import torch
from modules import devices
@@ -36,8 +39,12 @@ def load_hypernetworks(path): res = {}
for filename in glob.iglob(path + '**/*.pt', recursive=True):
- hn = Hypernetwork(filename)
- res[hn.name] = hn
+ try:
+ hn = Hypernetwork(filename)
+ res[hn.name] = hn
+ except Exception:
+ print(f"Error loading hypernetwork {filename}", file=sys.stderr)
+ print(traceback.format_exc(), file=sys.stderr)
return res
|