diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-12-31 01:38:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-31 01:38:43 +0300 |
commit | ce21840a042b9454a136372ab2971c1f21ec51e0 (patch) | |
tree | d4960972aa80b444137cd598ece5c63fc2a0d26e /modules/gfpgan_model.py | |
parent | ae124439c4b67755125bcf5d7ac6886501f4c11d (diff) | |
parent | 777af661a21821994993df3ef566b01df2bb61a0 (diff) |
Merge pull request #14477 from akx/spandrel-type-fix
Be more clear about Spandrel model nomenclature and types
Diffstat (limited to 'modules/gfpgan_model.py')
-rw-r--r-- | modules/gfpgan_model.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/modules/gfpgan_model.py b/modules/gfpgan_model.py index 48f8ad5e..445b0409 100644 --- a/modules/gfpgan_model.py +++ b/modules/gfpgan_model.py @@ -3,6 +3,8 @@ from __future__ import annotations import logging
import os
+import torch
+
from modules import (
devices,
errors,
@@ -25,7 +27,7 @@ class FaceRestorerGFPGAN(face_restoration_utils.CommonFaceRestoration): def get_device(self):
return devices.device_gfpgan
- def load_net(self) -> None:
+ def load_net(self) -> torch.Module:
for model_path in modelloader.load_models(
model_path=self.model_path,
model_url=model_url,
@@ -34,13 +36,13 @@ class FaceRestorerGFPGAN(face_restoration_utils.CommonFaceRestoration): ext_filter=['.pth'],
):
if 'GFPGAN' in os.path.basename(model_path):
- net = modelloader.load_spandrel_model(
+ model = modelloader.load_spandrel_model(
model_path,
device=self.get_device(),
expected_architecture='GFPGAN',
).model
- net.different_w = True # see https://github.com/chaiNNer-org/spandrel/pull/81
- return net
+ model.different_w = True # see https://github.com/chaiNNer-org/spandrel/pull/81
+ return model
raise ValueError("No GFPGAN model found")
def restore(self, np_image):
|