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

Visual artefacts present in upscaled images when device is set to 'mps' #13

Open
ericpesto opened this issue Feb 12, 2023 · 3 comments
Open

Comments

@ericpesto
Copy link

ericpesto commented Feb 12, 2023

To see the code, please refer to: https://github.com/ericpesto/stable-diffusion-mac-background-image-generator/blob/b1b14ea9b7fbefd1976478f4becfd5d529b2a956/main.py#L66-L74

@ericpesto ericpesto changed the title Visual artifacts present when upsaacledwhen device si set to use 'mps' Visual artefacts present in upscaled images when device is set to 'mps' Feb 12, 2023
@AeroDEmi
Copy link

AeroDEmi commented Mar 6, 2023

+1. I'm having the same problem. Did you find out how to solve it?

@AeroDEmi
Copy link

AeroDEmi commented Mar 6, 2023

Found a solution when using mps:
Inside the folder RealESRGAN in the main.py, you must first call cpu() and then clamp.

Code in the repo line 77:
sr_image = res.permute((0,2,3,1)).clamp_(0, 1).cpu()

New code:
sr_image = res.permute((0,2,3,1)).cpu().clamp_(0,1)

@ericpesto
Copy link
Author

ericpesto commented Mar 7, 2023

Can confirm, works for me too, nice find!

*I had to make the change in models.py

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

2 participants