diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2022-10-04 12:20:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-04 12:20:10 +0000 |
commit | bc4d457de82f76f8ab9f2bedf933c06deb5d5ba9 (patch) | |
tree | 969e0e595bd36987ae9de9ae302085ef555bba15 /modules/bsrgan_model.py | |
parent | d5bba20a58f43a9f984bb67b4e17f48661f6b818 (diff) | |
parent | e9e2a7ec9ac704f133f586eb34176e388c93c87c (diff) | |
download | stable-diffusion-webui-gfx803-bc4d457de82f76f8ab9f2bedf933c06deb5d5ba9.tar.gz stable-diffusion-webui-gfx803-bc4d457de82f76f8ab9f2bedf933c06deb5d5ba9.tar.bz2 stable-diffusion-webui-gfx803-bc4d457de82f76f8ab9f2bedf933c06deb5d5ba9.zip |
Merge pull request #1616 from brkirch/cpu-cmdline-opt
Add --use-cpu command line option
Diffstat (limited to 'modules/bsrgan_model.py')
-rw-r--r-- | modules/bsrgan_model.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/bsrgan_model.py b/modules/bsrgan_model.py index e62c6657..3bd80791 100644 --- a/modules/bsrgan_model.py +++ b/modules/bsrgan_model.py @@ -8,7 +8,7 @@ import torch from basicsr.utils.download_util import load_file_from_url import modules.upscaler -from modules import shared, modelloader +from modules import devices, modelloader from modules.bsrgan_model_arch import RRDBNet from modules.paths import models_path @@ -44,13 +44,13 @@ class UpscalerBSRGAN(modules.upscaler.Upscaler): model = self.load_model(selected_file) if model is None: return img - model.to(shared.device) + model.to(devices.device_bsrgan) torch.cuda.empty_cache() img = np.array(img) img = img[:, :, ::-1] img = np.moveaxis(img, 2, 0) / 255 img = torch.from_numpy(img).float() - img = img.unsqueeze(0).to(shared.device) + img = img.unsqueeze(0).to(devices.device_bsrgan) with torch.no_grad(): output = model(img) output = output.squeeze().float().cpu().clamp_(0, 1).numpy() |