use a torch rng
This commit is contained in:
parent
670bc1ced5
commit
b971b659e3
|
@ -200,8 +200,6 @@ def process_tiles(
|
|||
tiles_y = height // tile
|
||||
total = tiles_x * tiles_y
|
||||
|
||||
rng = random.RandomState(0)
|
||||
|
||||
for y in range(tiles_y):
|
||||
for x in range(tiles_x):
|
||||
idx = (y * tiles_x) + x
|
||||
|
|
|
@ -11,6 +11,7 @@ from realesrgan import RealESRGANer
|
|||
from typing import Literal, Union
|
||||
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
from .image import (
|
||||
process_tiles
|
||||
|
@ -146,8 +147,15 @@ def upscale_stable_diffusion(ctx: ServerContext, params: UpscaleParams, image: I
|
|||
# )
|
||||
# result = pipeline('', image=image)
|
||||
|
||||
generator = torch.manual_seed(0)
|
||||
seed = generator.initial_seed()
|
||||
|
||||
pipeline = StableDiffusionUpscalePipeline.from_pretrained('stabilityai/stable-diffusion-x4-upscaling')
|
||||
upscale = lambda i: pipeline('an astronaut eating a hamburger', image=i, rng=np.random.RandomState(0)).images[0]
|
||||
upscale = lambda i: pipeline(
|
||||
'an astronaut eating a hamburger',
|
||||
image=i,
|
||||
generator=torch.manual_seed(initial_seed),
|
||||
).images[0]
|
||||
result = process_tiles(image, 128, 4, [upscale])
|
||||
return result
|
||||
|
||||
|
|
Loading…
Reference in New Issue