aboutsummaryrefslogtreecommitdiffstats
path: root/modules/gfpgan_model.py
diff options
context:
space:
mode:
authorbrkirch <brkirch@users.noreply.github.com>2022-11-08 01:12:31 +0000
committerbrkirch <brkirch@users.noreply.github.com>2022-11-12 08:34:13 +0000
commitf4a488f585c09b420dc05199240e68f8fb74337f (patch)
treea686d85fa1f90d174e67396c1df22cd9ba2af45d /modules/gfpgan_model.py
parent804d9fb83d0c63ca3acd36378707ce47b8f12599 (diff)
downloadstable-diffusion-webui-gfx803-f4a488f585c09b420dc05199240e68f8fb74337f.tar.gz
stable-diffusion-webui-gfx803-f4a488f585c09b420dc05199240e68f8fb74337f.tar.bz2
stable-diffusion-webui-gfx803-f4a488f585c09b420dc05199240e68f8fb74337f.zip
Set device for facelib/facexlib and gfpgan
* FaceXLib/FaceLib doesn't pass the device argument to RetinaFace but instead chooses one itself and sets it to a global - in order to use a device other than its internally chosen default it is necessary to manually replace the default value * The GFPGAN constructor needs the device argument to work with MPS or a CUDA device ID that differs from the default
Diffstat (limited to 'modules/gfpgan_model.py')
-rw-r--r--modules/gfpgan_model.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/gfpgan_model.py b/modules/gfpgan_model.py
index a9452dce..1e2dbc32 100644
--- a/modules/gfpgan_model.py
+++ b/modules/gfpgan_model.py
@@ -36,7 +36,9 @@ def gfpgann():
else:
print("Unable to load gfpgan model!")
return None
- model = gfpgan_constructor(model_path=model_file, upscale=1, arch='clean', channel_multiplier=2, bg_upsampler=None)
+ if hasattr(facexlib.detection.retinaface, 'device'):
+ facexlib.detection.retinaface.device = devices.device_gfpgan
+ model = gfpgan_constructor(model_path=model_file, upscale=1, arch='clean', channel_multiplier=2, bg_upsampler=None, device=devices.device_gfpgan)
loaded_gfpgan_model = model
return model