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

How to do the equivalent in this repo? #5

Open
alexblattner opened this issue Sep 14, 2023 · 2 comments
Open

How to do the equivalent in this repo? #5

alexblattner opened this issue Sep 14, 2023 · 2 comments

Comments

@alexblattner
Copy link

Hello @victorca25, I'd like to replicate highres fix, but am unsure how it works exactly. I mainly use diffusers so I must use your repo to replicate highres fix.

If I wanted to use 4x-UltraSharp, upscale it by 1.5, with 25 highres steps and a denoising of 0.4. What should the code look like?

this is how the default code looks like:

import torch
from PIL import Image
import numpy as np
from run import load_model, run

device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')

model = load_model('upscaler/4x-UltraSharp.pth', device)

path_to_image = 'img11.png'
image = Image.open(path_to_image).convert('RGB')
 
sr_image =run(model,image)
pil_image = Image.fromarray(sr_image)
pil_image.save('u3.png')

I hope you see my issue soon and thanks in advance for your time.

@victorca25
Copy link
Owner

Hello! Did you find a solution to your question?

The original idea with this repo was to run a model with many images in a directory directly from the command line, but making a script like the one you want to use for the Hires Fix with diffusers would be very simple, since it happens on the pixel-space.

@alexblattner
Copy link
Author

@victorca25 I haven't. I just upscale by 4 then shrink it as I need. I don't know enough about "since it happens on the pixel-space."

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