1
0
Fork 0

fix(api): pass txt2img dimensions in correct order

This commit is contained in:
Sean Sube 2023-01-19 22:07:31 -06:00
parent 86fb2ae28e
commit be16f33151
2 changed files with 5 additions and 5 deletions

View File

@ -37,7 +37,7 @@ def get_latents_from_seed(seed: int, size: Size) -> np.ndarray:
From https://www.travelneil.com/stable-diffusion-updates.html From https://www.travelneil.com/stable-diffusion-updates.html
''' '''
# 1 is batch size # 1 is batch size
latents_shape = (1, 4, size.width // 8, size.height // 8) latents_shape = (1, 4, size.height // 8, size.width // 8)
# Gotta use numpy instead of torch, because torch's randn() doesn't support DML # Gotta use numpy instead of torch, because torch's randn() doesn't support DML
rng = np.random.default_rng(seed) rng = np.random.default_rng(seed)
image_latents = rng.standard_normal(latents_shape).astype(np.float32) image_latents = rng.standard_normal(latents_shape).astype(np.float32)
@ -92,8 +92,8 @@ def run_txt2img_pipeline(
image = pipe( image = pipe(
params.prompt, params.prompt,
size.width, height=size.height,
size.height, width=size.width,
generator=rng, generator=rng,
guidance_scale=params.cfg, guidance_scale=params.cfg,
latents=latents, latents=latents,

View File

@ -21,7 +21,7 @@
"height": { "height": {
"default": 512, "default": 512,
"min": 64, "min": 64,
"max": 512, "max": 1024,
"step": 8 "step": 8
}, },
"model": { "model": {
@ -77,7 +77,7 @@
"width": { "width": {
"default": 512, "default": 512,
"min": 64, "min": 64,
"max": 512, "max": 1024,
"step": 8 "step": 8
} }
} }