# This is a combination of 3 commits.
# This is the 1st commit message: pass size to txt2img stage # This is the commit message #2: pass highres and upscale params # This is the commit message #3: pass correct strength param
This commit is contained in:
parent
af416c252d
commit
7a951065e4
|
@ -64,7 +64,7 @@ def blend_img2img(
|
|||
image=source,
|
||||
negative_prompt=params.negative_prompt,
|
||||
num_inference_steps=params.steps,
|
||||
strength=params.strength,
|
||||
strength=strength,
|
||||
callback=callback,
|
||||
**pipe_params,
|
||||
)
|
||||
|
@ -81,7 +81,7 @@ def blend_img2img(
|
|||
image=source,
|
||||
negative_prompt=params.negative_prompt,
|
||||
num_inference_steps=params.steps,
|
||||
strength=params.strength,
|
||||
strength=strength,
|
||||
callback=callback,
|
||||
**pipe_params,
|
||||
)
|
||||
|
|
|
@ -8,7 +8,7 @@ from PIL import Image
|
|||
from ..diffusers.load import load_pipeline
|
||||
from ..diffusers.upscale import append_upscale_correction
|
||||
from ..diffusers.utils import parse_prompt
|
||||
from ..params import HighresParams, ImageParams, Size, StageParams, UpscaleParams
|
||||
from ..params import HighresParams, ImageParams, StageParams, UpscaleParams
|
||||
from ..server import ServerContext
|
||||
from ..worker import WorkerContext
|
||||
from ..worker.context import ProgressCallback
|
||||
|
@ -25,7 +25,6 @@ def upscale_highres(
|
|||
*,
|
||||
highres: HighresParams,
|
||||
upscale: UpscaleParams,
|
||||
size: Size,
|
||||
stage_source: Optional[Image.Image] = None,
|
||||
pipeline: Optional[Any] = None,
|
||||
callback: Optional[ProgressCallback] = None,
|
||||
|
@ -52,6 +51,7 @@ def upscale_highres(
|
|||
|
||||
scaled_size = (source.width * highres.scale, source.height * highres.scale)
|
||||
|
||||
# TODO: upscaling within the same stage prevents tiling from happening and causes OOM
|
||||
if highres.method == "bilinear":
|
||||
logger.debug("using bilinear interpolation for highres")
|
||||
source = source.resize(scaled_size, resample=Image.Resampling.BILINEAR)
|
||||
|
|
|
@ -42,7 +42,15 @@ def run_txt2img_pipeline(
|
|||
# prepare the chain pipeline and first stage
|
||||
chain = ChainPipeline()
|
||||
stage = StageParams()
|
||||
chain.append((source_txt2img, stage, None))
|
||||
chain.append(
|
||||
(
|
||||
source_txt2img,
|
||||
stage,
|
||||
{
|
||||
"size": size,
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
# apply upscaling and correction, before highres
|
||||
first_upscale, after_upscale = split_upscale(upscale)
|
||||
|
@ -55,7 +63,16 @@ def run_txt2img_pipeline(
|
|||
)
|
||||
|
||||
# apply highres
|
||||
chain.append((upscale_highres, stage, None))
|
||||
chain.append(
|
||||
(
|
||||
upscale_highres,
|
||||
stage,
|
||||
{
|
||||
"highres": highres,
|
||||
"upscale": upscale,
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
# apply upscaling and correction, after highres
|
||||
append_upscale_correction(
|
||||
|
@ -146,7 +163,16 @@ def run_img2img_pipeline(
|
|||
# highres, if selected
|
||||
if highres.iterations > 0:
|
||||
for _i in range(highres.iterations):
|
||||
chain.append((upscale_highres, stage, None))
|
||||
chain.append(
|
||||
(
|
||||
upscale_highres,
|
||||
stage,
|
||||
{
|
||||
"highres": highres,
|
||||
"upscale": upscale,
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
# apply upscaling and correction, after highres
|
||||
append_upscale_correction(
|
||||
|
@ -231,6 +257,7 @@ def run_inpaint_pipeline(
|
|||
stage,
|
||||
{
|
||||
"highres": highres,
|
||||
"upscale": upscale,
|
||||
},
|
||||
)
|
||||
)
|
||||
|
@ -293,7 +320,16 @@ def run_upscale_pipeline(
|
|||
)
|
||||
|
||||
# apply highres
|
||||
chain.append((upscale_highres, stage, None))
|
||||
chain.append(
|
||||
(
|
||||
upscale_highres,
|
||||
stage,
|
||||
{
|
||||
"highres": highres,
|
||||
"upscale": upscale,
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
# apply upscaling and correction, after highres
|
||||
append_upscale_correction(
|
||||
|
|
Loading…
Reference in New Issue