1
0
Fork 0

split steps before and after highres

This commit is contained in:
Sean Sube 2023-03-31 23:32:05 -05:00
parent cdaf1b8e5d
commit 66e938f9ab
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
2 changed files with 11 additions and 9 deletions

View File

@ -30,6 +30,11 @@ def run_txt2img_pipeline(
outputs: List[str], outputs: List[str],
upscale: UpscaleParams, upscale: UpscaleParams,
) -> None: ) -> None:
# TODO: add to params
highres_scale = 4
highres_steps = 15
highres_strength = 0.5
latents = get_latents_from_seed(params.seed, size, batch=params.batch) latents = get_latents_from_seed(params.seed, size, batch=params.batch)
(prompt, loras) = get_loras_from_prompt(params.prompt) (prompt, loras) = get_loras_from_prompt(params.prompt)
@ -60,7 +65,7 @@ def run_txt2img_pipeline(
latents=latents, latents=latents,
negative_prompt=params.negative_prompt, negative_prompt=params.negative_prompt,
num_images_per_prompt=params.batch, num_images_per_prompt=params.batch,
num_inference_steps=params.steps, num_inference_steps=highres_steps,
eta=params.eta, eta=params.eta,
callback=progress, callback=progress,
) )
@ -75,17 +80,13 @@ def run_txt2img_pipeline(
latents=latents, latents=latents,
negative_prompt=params.negative_prompt, negative_prompt=params.negative_prompt,
num_images_per_prompt=params.batch, num_images_per_prompt=params.batch,
num_inference_steps=params.steps, num_inference_steps=highres_steps,
eta=params.eta, eta=params.eta,
callback=progress, callback=progress,
) )
for image, output in zip(result.images, outputs): for image, output in zip(result.images, outputs):
highres_scale = 4 if highres_scale > 1:
highres_strength = 0.5
if params.highres > 1:
def highres(tile: Image.Image, dims): def highres(tile: Image.Image, dims):
highpipe = load_pipeline( highpipe = load_pipeline(
server, server,
@ -108,7 +109,7 @@ def run_txt2img_pipeline(
guidance_scale=params.cfg, guidance_scale=params.cfg,
negative_prompt=params.negative_prompt, negative_prompt=params.negative_prompt,
num_images_per_prompt=1, num_images_per_prompt=1,
num_inference_steps=params.steps, num_inference_steps=params.steps - highres_steps,
strength=highres_strength, strength=highres_strength,
eta=params.eta, eta=params.eta,
callback=progress, callback=progress,
@ -123,7 +124,7 @@ def run_txt2img_pipeline(
guidance_scale=params.cfg, guidance_scale=params.cfg,
negative_prompt=params.negative_prompt, negative_prompt=params.negative_prompt,
num_images_per_prompt=1, num_images_per_prompt=1,
num_inference_steps=params.steps, num_inference_steps=params.steps - highres_steps,
strength=highres_strength, strength=highres_strength,
eta=params.eta, eta=params.eta,
callback=progress, callback=progress,

View File

@ -35,6 +35,7 @@ bundle: build
COVER_OPTS := --all \ COVER_OPTS := --all \
--exclude ".eslintrc.js" \ --exclude ".eslintrc.js" \
--exclude "docs/**" \ --exclude "docs/**" \
--exclude "out/bundle/**" \
--exclude "out/coverage/**" \ --exclude "out/coverage/**" \
--exclude "vendor/**" \ --exclude "vendor/**" \
--reporter=text-summary \ --reporter=text-summary \