diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-05-31 16:16:14 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-31 16:16:14 +0000 |
commit | d9bd7ada7675d3903181a6a65ba625d82cf88443 (patch) | |
tree | 30470f64d84cadc4140023c0bf34c35bb68f79b0 /modules/hypernetworks | |
parent | 78a602ae8c006077ca93913576335a3a33dba7cb (diff) | |
parent | 52b8752e6201e24c783f674f8dc0681027e10ea9 (diff) | |
download | stable-diffusion-webui-gfx803-d9bd7ada7675d3903181a6a65ba625d82cf88443.tar.gz stable-diffusion-webui-gfx803-d9bd7ada7675d3903181a6a65ba625d82cf88443.tar.bz2 stable-diffusion-webui-gfx803-d9bd7ada7675d3903181a6a65ba625d82cf88443.zip |
Merge pull request #10820 from akx/report-error
Add & use modules.errors.print_error
Diffstat (limited to 'modules/hypernetworks')
-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()
|