Skip to content

Commit 97bc0b9

Browse files
committed
do not stop working on failed hypernetwork load
1 parent d15b3ec commit 97bc0b9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

modules/hypernetwork.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import glob
22
import os
3+
import sys
4+
import traceback
5+
36
import torch
47
from modules import devices
58

@@ -36,8 +39,12 @@ def load_hypernetworks(path):
3639
res = {}
3740

3841
for filename in glob.iglob(path + '**/*.pt', recursive=True):
39-
hn = Hypernetwork(filename)
40-
res[hn.name] = hn
42+
try:
43+
hn = Hypernetwork(filename)
44+
res[hn.name] = hn
45+
except Exception:
46+
print(f"Error loading hypernetwork {filename}", file=sys.stderr)
47+
print(traceback.format_exc(), file=sys.stderr)
4148

4249
return res
4350

0 commit comments

Comments
 (0)