Skip to content

After executing ”python inference_realesrgan.py -n RealESRGAN_x4plus -i inputs” command, it gets stuck and there is no other information #905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Le1q opened this issue Mar 19, 2025 · 3 comments

Comments

@Le1q
Copy link

Le1q commented Mar 19, 2025

The environment is as follows:
(ml-env) PS C:\workspace\ml\Real-ESRGAN\Real-ESRGAN> pip list
Package Version Editable project location


absl-py 2.1.0
addict 2.4.0
autocommand 2.2.2
backports.tarfile 1.2.0
basicsr 1.4.2
certifi 2025.1.31
charset-normalizer 3.4.1
colorama 0.4.6
contourpy 1.3.1
cycler 0.12.1
facexlib 0.3.0
filelock 3.18.0
filterpy 1.4.5
fonttools 4.56.0
fsspec 2025.3.0
future 1.0.0
gfpgan 1.3.8
grpcio 1.71.0
idna 3.10
imageio 2.37.0
importlib_metadata 8.0.0
inflect 7.3.1
jaraco.collections 5.1.0
jaraco.context 5.3.0
jaraco.functools 4.0.1
jaraco.text 3.12.1
Jinja2 3.1.6
kiwisolver 1.4.8
lazy_loader 0.4
llvmlite 0.44.0
lmdb 1.6.2
Markdown 3.7
MarkupSafe 3.0.2
matplotlib 3.10.1
more-itertools 10.3.0
mpmath 1.3.0
networkx 3.4.2
numba 0.61.0
numpy 2.1.3
opencv-python 4.11.0.86
packaging 24.2
pillow 11.1.0
pip 25.0.1
platformdirs 4.3.6
protobuf 6.30.1
pyparsing 3.2.1
python-dateutil 2.9.0.post0
PyYAML 6.0.2
realesrgan 0.3.0 C:\workspace\ml\Real-ESRGAN\Real-ESRGAN
requests 2.32.3
scikit-image 0.25.2
scipy 1.15.2
setuptools 76.1.0
six 1.17.0
sympy 1.13.1
tb-nightly 2.20.0a20250318
tensorboard-data-server 0.7.2
tifffile 2025.3.13
tomli 2.0.1
torch 2.6.0
torchvision 0.21.0
tqdm 4.67.1
typeguard 4.3.0
typing_extensions 4.12.2
urllib3 2.3.0
Werkzeug 3.1.3
wheel 0.43.0
yapf 0.43.0
zipp 3.19.2

Execute the following command:
python inference_realesrgan.py -n RealESRGAN_x4plus -i inputs
Testing 0 00017_gray

Output after manual cancellation via ctrl+c:

Traceback (most recent call last):
File "C:\workspace\ml\Real-ESRGAN\Real-ESRGAN\inference_realesrgan.py", line 166, in
main()
File "C:\workspace\ml\Real-ESRGAN\Real-ESRGAN\inference_realesrgan.py", line 147, in main
output, _ = upsampler.enhance(img, outscale=args.outscale) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\workspace\ml\ml-env\Lib\site-packages\torch\utils_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\workspace\ml\Real-ESRGAN\Real-ESRGAN\realesrgan\utils.py", line 223, in enhance
self.process()
File "C:\workspace\ml\Real-ESRGAN\Real-ESRGAN\realesrgan\utils.py", line 115, in process
self.output = self.model(self.img)
^^^^^^^^^^^^^^^^^^^^
File "C:\workspace\ml\ml-env\Lib\site-packages\torch\nn\modules\module.py", line 1739, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\workspace\ml\ml-env\Lib\site-packages\torch\nn\modules\module.py", line 1750, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\workspace\ml\ml-env\Lib\site-packages\basicsr\archs\rrdbnet_arch.py", line 113, in forward
body_feat = self.conv_body(self.body(feat))
^^^^^^^^^^^^^^^
File "C:\workspace\ml\ml-env\Lib\site-packages\torch\nn\modules\module.py", line 1739, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\workspace\ml\ml-env\Lib\site-packages\torch\nn\modules\module.py", line 1750, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\workspace\ml\ml-env\Lib\site-packages\torch\nn\modules\container.py", line 250, in forward
input = module(input)
^^^^^^^^^^^^^
File "C:\workspace\ml\ml-env\Lib\site-packages\torch\nn\modules\module.py", line 1739, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\workspace\ml\ml-env\Lib\site-packages\torch\nn\modules\module.py", line 1750, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\workspace\ml\ml-env\Lib\site-packages\basicsr\archs\rrdbnet_arch.py", line 60, in forward
out = self.rdb2(out)
^^^^^^^^^^^^^^
File "C:\workspace\ml\ml-env\Lib\site-packages\torch\nn\modules\module.py", line 1739, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\workspace\ml\ml-env\Lib\site-packages\torch\nn\modules\module.py", line 1750, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\workspace\ml\ml-env\Lib\site-packages\basicsr\archs\rrdbnet_arch.py", line 35, in forward
x3 = self.lrelu(self.conv3(torch.cat((x, x1, x2), 1)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\workspace\ml\ml-env\Lib\site-packages\torch\nn\modules\module.py", line 1739, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\workspace\ml\ml-env\Lib\site-packages\torch\nn\modules\module.py", line 1750, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\workspace\ml\ml-env\Lib\site-packages\torch\nn\modules\conv.py", line 554, in forward
return self._conv_forward(input, self.weight, self.bias)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\workspace\ml\ml-env\Lib\site-packages\torch\nn\modules\conv.py", line 549, in _conv_forward
return F.conv2d(
^^^^^^^^^
KeyboardInterrupt

@Le1q
Copy link
Author

Le1q commented Mar 19, 2025

def process(self):
     self.output = self.model(self.img),

it stops here.

and model is exist.
I try print the info of the model. as follows:

RRDBNet(
  (conv_first): Conv2d(3, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))  (body): Sequential(
    (0): RRDB(
      (rdb1): ResidualDenseBlock(
        (conv1): Conv2d(64, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
        (conv2): Conv2d(96, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
        (conv3): Conv2d(128, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 
1))
        (conv4): Conv2d(160, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 
1))
        (conv5): Conv2d(192, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 
1))
        (lrelu): LeakyReLU(negative_slope=0.2, inplace=True)

@czdelete
Copy link

czdelete commented Apr 1, 2025

hello,is this issue already fixed?I also met it

@Joxterian
Copy link

Hi there,

I had this problem, and in my case, I did pip install -r requirements.txt which installs all dependencies listed in the requirements.txt, installing default torch version (not the cuda version), this version uses CPU as far as I understand, so it's significantly slower. In my case I have a NVIDIA and in order to solve it I had to install cuda version: pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121. Hope it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants