mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
(minor) Address a few small TODOs.
This commit is contained in:
parent
bd3b6ca11b
commit
8a43656cf9
@ -55,15 +55,14 @@ def crop_controlnet_data(control_data: ControlNetData, latent_region: TBLR) -> C
|
|||||||
title="Tiled Multi-Diffusion Denoise Latents",
|
title="Tiled Multi-Diffusion Denoise Latents",
|
||||||
tags=["upscale", "denoise"],
|
tags=["upscale", "denoise"],
|
||||||
category="latents",
|
category="latents",
|
||||||
# TODO(ryand): Reset to 1.0.0 right before release.
|
|
||||||
version="1.0.0",
|
version="1.0.0",
|
||||||
)
|
)
|
||||||
class TiledMultiDiffusionDenoiseLatents(BaseInvocation):
|
class TiledMultiDiffusionDenoiseLatents(BaseInvocation):
|
||||||
"""Tiled Multi-Diffusion denoising.
|
"""Tiled Multi-Diffusion denoising.
|
||||||
|
|
||||||
This node handles automatically tiling the input image. Future iterations of
|
This node handles automatically tiling the input image, and is primarily intended for global refinement of images
|
||||||
this node should allow the user to specify custom regions with different parameters for each region to harness the
|
in tiled upscaling workflows. Future Multi-Diffusion nodes should allow the user to specify custom regions with
|
||||||
full power of Multi-Diffusion.
|
different parameters for each region to harness the full power of Multi-Diffusion.
|
||||||
|
|
||||||
This node has a similar interface to the `DenoiseLatents` node, but it has a reduced feature set (no IP-Adapter,
|
This node has a similar interface to the `DenoiseLatents` node, but it has a reduced feature set (no IP-Adapter,
|
||||||
T2I-Adapter, masking, etc.).
|
T2I-Adapter, masking, etc.).
|
||||||
@ -85,10 +84,8 @@ class TiledMultiDiffusionDenoiseLatents(BaseInvocation):
|
|||||||
description=FieldDescriptions.latents,
|
description=FieldDescriptions.latents,
|
||||||
input=Input.Connection,
|
input=Input.Connection,
|
||||||
)
|
)
|
||||||
# TODO(ryand): Add multiple-of validation.
|
tile_height: int = InputField(default=64, gt=0, description="Height of the tiles in latent space.")
|
||||||
# TODO(ryand): Smaller defaults might make more sense.
|
tile_width: int = InputField(default=64, gt=0, description="Width of the tiles in latent space.")
|
||||||
tile_height: int = InputField(default=112, gt=0, description="Height of the tiles in latent space.")
|
|
||||||
tile_width: int = InputField(default=112, gt=0, description="Width of the tiles in latent space.")
|
|
||||||
tile_min_overlap: int = InputField(
|
tile_min_overlap: int = InputField(
|
||||||
default=16,
|
default=16,
|
||||||
gt=0,
|
gt=0,
|
||||||
@ -97,9 +94,8 @@ class TiledMultiDiffusionDenoiseLatents(BaseInvocation):
|
|||||||
)
|
)
|
||||||
steps: int = InputField(default=18, gt=0, description=FieldDescriptions.steps)
|
steps: int = InputField(default=18, gt=0, description=FieldDescriptions.steps)
|
||||||
cfg_scale: float | list[float] = InputField(default=6.0, description=FieldDescriptions.cfg_scale, title="CFG Scale")
|
cfg_scale: float | list[float] = InputField(default=6.0, description=FieldDescriptions.cfg_scale, title="CFG Scale")
|
||||||
# TODO(ryand): The default here should probably be 0.0.
|
|
||||||
denoising_start: float = InputField(
|
denoising_start: float = InputField(
|
||||||
default=0.65,
|
default=0.0,
|
||||||
ge=0,
|
ge=0,
|
||||||
le=1,
|
le=1,
|
||||||
description=FieldDescriptions.denoising_start,
|
description=FieldDescriptions.denoising_start,
|
||||||
@ -150,7 +146,7 @@ class TiledMultiDiffusionDenoiseLatents(BaseInvocation):
|
|||||||
self.config = FakeVae.FakeVaeConfig()
|
self.config = FakeVae.FakeVaeConfig()
|
||||||
|
|
||||||
return MultiDiffusionPipeline(
|
return MultiDiffusionPipeline(
|
||||||
vae=FakeVae(), # TODO: oh...
|
vae=FakeVae(),
|
||||||
text_encoder=None,
|
text_encoder=None,
|
||||||
tokenizer=None,
|
tokenizer=None,
|
||||||
unet=unet,
|
unet=unet,
|
||||||
@ -166,7 +162,6 @@ class TiledMultiDiffusionDenoiseLatents(BaseInvocation):
|
|||||||
_, _, latent_height, latent_width = latents.shape
|
_, _, latent_height, latent_width = latents.shape
|
||||||
|
|
||||||
# Calculate the tile locations to cover the latent-space image.
|
# Calculate the tile locations to cover the latent-space image.
|
||||||
# TODO(ryand): Add constraints on the tile params. Is there a multiple-of constraint?
|
|
||||||
tiles = calc_tiles_min_overlap(
|
tiles = calc_tiles_min_overlap(
|
||||||
image_height=latent_height,
|
image_height=latent_height,
|
||||||
image_width=latent_width,
|
image_width=latent_width,
|
||||||
@ -260,8 +255,8 @@ class TiledMultiDiffusionDenoiseLatents(BaseInvocation):
|
|||||||
callback=lambda x: None,
|
callback=lambda x: None,
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO(ryand): I copied this from DenoiseLatentsInvocation. I'm not sure if it's actually important.
|
|
||||||
result_latents = result_latents.to("cpu")
|
result_latents = result_latents.to("cpu")
|
||||||
|
# TODO(ryand): I copied this from DenoiseLatentsInvocation. I'm not sure if it's actually important.
|
||||||
TorchDevice.empty_cache()
|
TorchDevice.empty_cache()
|
||||||
|
|
||||||
name = context.tensors.save(tensor=result_latents)
|
name = context.tensors.save(tensor=result_latents)
|
||||||
|
Loading…
Reference in New Issue
Block a user