Skip to content

Commit

Permalink
do not stop working on failed hypernetwork load
Browse files Browse the repository at this point in the history
  • Loading branch information
AUTOMATIC1111 committed Oct 7, 2022
1 parent d15b3ec commit 97bc0b9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions modules/hypernetwork.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import glob
import os
import sys
import traceback

import torch
from modules import devices

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 97bc0b9

Please sign in to comment.