Skip to content

Commit

Permalink
fix(api): pass txt2img dimensions in correct order
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Jan 20, 2023
1 parent 86fb2ae commit be16f33
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions api/onnx_web/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def get_latents_from_seed(seed: int, size: Size) -> np.ndarray:
From https://www.travelneil.com/stable-diffusion-updates.html
'''
# 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
rng = np.random.default_rng(seed)
image_latents = rng.standard_normal(latents_shape).astype(np.float32)
Expand Down Expand Up @@ -92,8 +92,8 @@ def run_txt2img_pipeline(

image = pipe(
params.prompt,
size.width,
size.height,
height=size.height,
width=size.width,
generator=rng,
guidance_scale=params.cfg,
latents=latents,
Expand Down
4 changes: 2 additions & 2 deletions api/params.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"height": {
"default": 512,
"min": 64,
"max": 512,
"max": 1024,
"step": 8
},
"model": {
Expand Down Expand Up @@ -77,7 +77,7 @@
"width": {
"default": 512,
"min": 64,
"max": 512,
"max": 1024,
"step": 8
}
}

0 comments on commit be16f33

Please sign in to comment.