aboutsummaryrefslogtreecommitdiffstats
path: root/modules/upscaler_utils.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-12-31 19:33:32 +0000
committerGitHub <noreply@github.com>2023-12-31 19:33:32 +0000
commitbe5f1acc8f6e5bfc7f8234fd570d663b2fde9c27 (patch)
treea07510354ce2dddf0afaf37ba256eba6d820900d /modules/upscaler_utils.py
parentf3af8c8d04d6be58ddb3b55f77d8006241dca8f6 (diff)
parent5768afc776a66bb94e77a9c1daebeea58fa731d5 (diff)
downloadstable-diffusion-webui-gfx803-be5f1acc8f6e5bfc7f8234fd570d663b2fde9c27.tar.gz
stable-diffusion-webui-gfx803-be5f1acc8f6e5bfc7f8234fd570d663b2fde9c27.tar.bz2
stable-diffusion-webui-gfx803-be5f1acc8f6e5bfc7f8234fd570d663b2fde9c27.zip
Merge pull request #14478 from akx/dtype-inspect
Add utility to inspect a model's dtype/device
Diffstat (limited to 'modules/upscaler_utils.py')
-rw-r--r--modules/upscaler_utils.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/upscaler_utils.py b/modules/upscaler_utils.py
index 8e413854..c60e3beb 100644
--- a/modules/upscaler_utils.py
+++ b/modules/upscaler_utils.py
@@ -7,6 +7,7 @@ import tqdm
from PIL import Image
from modules import images, shared
+from modules.torch_utils import get_param
logger = logging.getLogger(__name__)
@@ -17,8 +18,8 @@ def upscale_without_tiling(model, img: Image.Image):
img = np.ascontiguousarray(np.transpose(img, (2, 0, 1))) / 255
img = torch.from_numpy(img).float()
- model_weight = next(iter(model.model.parameters()))
- img = img.unsqueeze(0).to(device=model_weight.device, dtype=model_weight.dtype)
+ param = get_param(model)
+ img = img.unsqueeze(0).to(device=param.device, dtype=param.dtype)
with torch.no_grad():
output = model(img)