Skip to content
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

error when running Real ESRGAN x4 models with x2 scale #152

Closed
ssube opened this issue Feb 16, 2023 · 1 comment
Closed

error when running Real ESRGAN x4 models with x2 scale #152

ssube opened this issue Feb 16, 2023 · 1 comment
Labels
model/upscaling status/fixed issues that have been fixed and released type/bug broken features
Milestone

Comments

@ssube
Copy link
Owner

ssube commented Feb 16, 2023

While not strictly supported, this should not crash the job:

[2023-02-16 01:00:16,333] INFO: onnx_web.chain.upscale_resrgan: upscaling image with Real ESRGAN: x4                                                                      
EP Error using [('CUDAExecutionProvider', {'device_id': 0})]
Falling back to ['CUDAExecutionProvider', 'CPUExecutionProvider'] and retrying.
[2023-02-16 01:00:16,489] INFO: werkzeug: 10.2.2.16 - - [16/Feb/2023 01:00:16] "GET /api/ready?output=upscale_1434952017_1641dbbc27dade5d93110f18e956e44b6707f773dff34380b5a64976d570e7b2_1676509216.png HTTP/1.1" 200 -                                                                                                                                              
[2023-02-16 01:00:21,541] INFO: werkzeug: 10.2.2.16 - - [16/Feb/2023 01:00:21] "GET /api/ready?output=upscale_1434952017_1641dbbc27dade5d93110f18e956e44b6707f773dff34380b5a64976d570e7b2_1676509216.png HTTP/1.1" 200 -                                                                                                                                                
        Tile 1/1                                                                                                                                                                    
[2023-02-16 01:00:21,687] WARNING: onnx_web.server.device_pool: job upscale_1434952017_1641dbbc27dade5d93110f18e956e44b6707f773dff34380b5a64976d570e7b2_1676509216.png failed with an error: ['

Traceback (most recent call last):
', '  File "/home/ssube/onnx-web/api/onnx_web/server/device_pool.py", line 243, in job_done
    f.result()
', '  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 451, in result
    return self.__get_result()
', '  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
', '  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
', '  File "/home/ssube/onnx-web/api/onnx_web/diffusion/run.py", line 221, in run_upscale_pipeline
    image = run_upscale_correction(
', '  File "/home/ssube/onnx-web/api/onnx_web/server/upscale.py", line 61, in run_upscale_correction
    return chain(
', '  File "/home/ssube/onnx-web/api/onnx_web/chain/base.py", line 147, in __call__
    image = stage_pipe(
', '  File "/home/ssube/onnx-web/api/onnx_web/chain/upscale_resrgan.py", line 112, in upscale_resrgan
    output, _ = upsampler.enhance(output, outscale=upscale.outscale)
', '  File "/home/ssube/onnx-web/api/onnx_env/lib/python3.10/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
', '  File "/home/ssube/onnx-web/api/onnx_env/lib/python3.10/site-packages/realesrgan/utils.py", line 221, in enhance
    self.tile_process()
', '  File "/home/ssube/onnx-web/api/onnx_env/lib/python3.10/site-packages/realesrgan/utils.py", line 178, in tile_process
    self.output[:, :, output_start_y:output_end_y,
', 'RuntimeError: The expanded size of the tensor (2048) must match the existing size (1024) at non-singleton dimension 3.  Target sizes: [1, 3, 2048, 2048].  Tensor sizes: [3, 1024, 1024]

']
@ssube ssube added status/new issues that have not been confirmed yet type/bug broken features labels Feb 16, 2023
@ssube ssube added this to the v0.8 milestone Feb 16, 2023
@ssube ssube added model/upscaling status/fixed issues that have been fixed and released and removed status/new issues that have not been confirmed yet labels Feb 18, 2023
@ssube
Copy link
Owner Author

ssube commented Feb 18, 2023

This does not occur in txt2img mode, and seems to be working correctly in upscaling mode for my test inputs:

  • 512x512
  • 256x256
  • 1024x768

It does end up being cut off, because of the mismatch between model scale and parameters scale/outscale:

image

image

@ssube ssube closed this as completed Feb 18, 2023
@ssube ssube mentioned this issue Mar 5, 2023
99 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
model/upscaling status/fixed issues that have been fixed and released type/bug broken features
Projects
None yet
Development

No branches or pull requests

1 participant