diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-05-31 16:31:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-31 16:31:19 +0000 |
commit | 177d4b6828eee6a9aa1e9f2cf4877ad9ae8fcae4 (patch) | |
tree | 466c92812f7b978cf3a535187c18be78c4e26d37 /modules/hypernetworks/hypernetwork.py | |
parent | c1a5068ebea127412dfaaa6598795196a64200f1 (diff) | |
parent | 881de0df38c1fa6d0d61f7bc6fc93c100a9f35d0 (diff) | |
download | stable-diffusion-webui-gfx803-177d4b6828eee6a9aa1e9f2cf4877ad9ae8fcae4.tar.gz stable-diffusion-webui-gfx803-177d4b6828eee6a9aa1e9f2cf4877ad9ae8fcae4.tar.bz2 stable-diffusion-webui-gfx803-177d4b6828eee6a9aa1e9f2cf4877ad9ae8fcae4.zip |
Merge branch 'dev' into sync-req
Diffstat (limited to 'modules/hypernetworks/hypernetwork.py')
-rw-r--r-- | modules/hypernetworks/hypernetwork.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/modules/hypernetworks/hypernetwork.py b/modules/hypernetworks/hypernetwork.py index 570b5603..fcc1ef20 100644 --- a/modules/hypernetworks/hypernetwork.py +++ b/modules/hypernetworks/hypernetwork.py @@ -2,8 +2,6 @@ import datetime import glob
import html
import os
-import sys
-import traceback
import inspect
import modules.textual_inversion.dataset
@@ -12,6 +10,7 @@ import tqdm from einops import rearrange, repeat
from ldm.util import default
from modules import devices, processing, sd_models, shared, sd_samplers, hashes, sd_hijack_checkpoint
+from modules.errors import print_error
from modules.textual_inversion import textual_inversion, logging
from modules.textual_inversion.learn_schedule import LearnRateScheduler
from torch import einsum
@@ -325,17 +324,14 @@ def load_hypernetwork(name): if path is None:
return None
- hypernetwork = Hypernetwork()
-
try:
+ hypernetwork = Hypernetwork()
hypernetwork.load(path)
+ return hypernetwork
except Exception:
- print(f"Error loading hypernetwork {path}", file=sys.stderr)
- print(traceback.format_exc(), file=sys.stderr)
+ print_error(f"Error loading hypernetwork {path}", exc_info=True)
return None
- return hypernetwork
-
def load_hypernetworks(names, multipliers=None):
already_loaded = {}
@@ -770,7 +766,7 @@ Last saved image: {html.escape(last_saved_image)}<br/> </p>
"""
except Exception:
- print(traceback.format_exc(), file=sys.stderr)
+ print_error("Exception in training hypernetwork", exc_info=True)
finally:
pbar.leave = False
pbar.close()
|