This commit is contained in:
huchenlei 2024-05-20 15:15:44 -04:00
parent 58b9cc0502
commit 902f12e0b7

View File

@ -3,7 +3,7 @@ import copy
import inspect import inspect
import logging import logging
import uuid import uuid
from typing import Callable, Protocol, TypedDict, Optional from typing import Callable, Protocol, TypedDict, Optional, List
import comfy.utils import comfy.utils
import comfy.model_management import comfy.model_management
@ -24,10 +24,14 @@ class UnetApplyConds(TypedDict):
class UnetParams(TypedDict): class UnetParams(TypedDict):
# Tensor of shape [B, C, H, W]
input: torch.Tensor input: torch.Tensor
# Tensor of shape [B]
timestep: torch.Tensor timestep: torch.Tensor
c: UnetApplyConds c: UnetApplyConds
cond_or_uncond: torch.Tensor # List of [0, 1], [0], [1], ...
# 0 means unconditional, 1 means conditional
cond_or_uncond: List[int]
UnetWrapperFunction = Callable[[UnetApplyFunction, UnetParams], torch.Tensor] UnetWrapperFunction = Callable[[UnetApplyFunction, UnetParams], torch.Tensor]