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/codeformer_model.py | |
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/codeformer_model.py')
-rw-r--r-- | modules/codeformer_model.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/modules/codeformer_model.py b/modules/codeformer_model.py index ececdbae..76143e9f 100644 --- a/modules/codeformer_model.py +++ b/modules/codeformer_model.py @@ -1,6 +1,4 @@ import os
-import sys
-import traceback
import cv2
import torch
@@ -8,6 +6,7 @@ import torch import modules.face_restoration
import modules.shared
from modules import shared, devices, modelloader
+from modules.errors import print_error
from modules.paths import models_path
# codeformer people made a choice to include modified basicsr library to their project which makes
@@ -105,8 +104,8 @@ def setup_model(dirname): restored_face = tensor2img(output, rgb2bgr=True, min_max=(-1, 1))
del output
torch.cuda.empty_cache()
- except Exception as error:
- print(f'\tFailed inference for CodeFormer: {error}', file=sys.stderr)
+ except Exception:
+ print_error('Failed inference for CodeFormer', exc_info=True)
restored_face = tensor2img(cropped_face_t, rgb2bgr=True, min_max=(-1, 1))
restored_face = restored_face.astype('uint8')
@@ -135,7 +134,6 @@ def setup_model(dirname): shared.face_restorers.append(codeformer)
except Exception:
- print("Error setting up CodeFormer:", file=sys.stderr)
- print(traceback.format_exc(), file=sys.stderr)
+ print_error("Error setting up CodeFormer", exc_info=True)
# sys.path = stored_sys_path
|