mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
added a few comments to document design choices
This commit is contained in:
parent
f13427e3f4
commit
493f81788c
@ -919,6 +919,10 @@ class DenoiseLatentsInvocation(BaseInvocation):
|
|||||||
else:
|
else:
|
||||||
ip_adapters = [self.ip_adapter]
|
ip_adapters = [self.ip_adapter]
|
||||||
|
|
||||||
|
# If there are IP adapters, the following line runs the adapters' CLIPVision image encoders to return
|
||||||
|
# a series of image conditioning embeddings. This is being done here rather than in the
|
||||||
|
# big model context below in order to use less VRAM on low-VRAM systems.
|
||||||
|
# The image prompts are then passed to prep_ip_adapter_data().
|
||||||
image_prompts = self.prep_ip_adapter_image_prompts(context=context, ip_adapters=ip_adapters)
|
image_prompts = self.prep_ip_adapter_image_prompts(context=context, ip_adapters=ip_adapters)
|
||||||
|
|
||||||
# get the unet's config so that we can pass the base to dispatch_progress()
|
# get the unet's config so that we can pass the base to dispatch_progress()
|
||||||
|
@ -25,9 +25,9 @@ class RectangleMaskInvocation(BaseInvocation, WithMetadata):
|
|||||||
|
|
||||||
def invoke(self, context: InvocationContext) -> MaskOutput:
|
def invoke(self, context: InvocationContext) -> MaskOutput:
|
||||||
mask = torch.zeros((1, self.height, self.width), dtype=torch.bool)
|
mask = torch.zeros((1, self.height, self.width), dtype=torch.bool)
|
||||||
mask[:, self.y_top : self.y_top + self.rectangle_height, self.x_left : self.x_left + self.rectangle_width] = (
|
mask[
|
||||||
True
|
:, self.y_top : self.y_top + self.rectangle_height, self.x_left : self.x_left + self.rectangle_width
|
||||||
)
|
] = True
|
||||||
|
|
||||||
mask_tensor_name = context.tensors.save(mask)
|
mask_tensor_name = context.tensors.save(mask)
|
||||||
return MaskOutput(
|
return MaskOutput(
|
||||||
|
@ -62,7 +62,8 @@ Provide a generic type to `TEvent` to specify the payload type.
|
|||||||
|
|
||||||
|
|
||||||
class FastAPIEventFunc(Protocol, Generic[TEvent]):
|
class FastAPIEventFunc(Protocol, Generic[TEvent]):
|
||||||
def __call__(self, event: FastAPIEvent[TEvent]) -> Optional[Coroutine[Any, Any, None]]: ...
|
def __call__(self, event: FastAPIEvent[TEvent]) -> Optional[Coroutine[Any, Any, None]]:
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
def register_events(events: set[type[TEvent]] | type[TEvent], func: FastAPIEventFunc[TEvent]) -> None:
|
def register_events(events: set[type[TEvent]] | type[TEvent], func: FastAPIEventFunc[TEvent]) -> None:
|
||||||
|
@ -17,7 +17,8 @@ class MigrateCallback(Protocol):
|
|||||||
See :class:`Migration` for an example.
|
See :class:`Migration` for an example.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __call__(self, cursor: sqlite3.Cursor) -> None: ...
|
def __call__(self, cursor: sqlite3.Cursor) -> None:
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
class MigrationError(RuntimeError):
|
class MigrationError(RuntimeError):
|
||||||
|
Loading…
Reference in New Issue
Block a user