Download comfy/comfy_types.py from fotographerai/Zen-Style-Shape: direct link, hf CLI and curl.
- Browser
- Download file 909 Bytes
-
https://huggingface.co/spaces/fotographerai/Zen-Style-Shape/resolve/1e1fbeb6135765d0be77b04237eb90cd6ba0d1a0/comfy/comfy_types.py
- Command line
-
hf download hf://spaces/fotographerai/Zen-Style-Shape@1e1fbeb6135765d0be77b04237eb90cd6ba0d1a0/comfy/comfy_types.py
-
curl -L -o comfy_types.py https://huggingface.co/spaces/fotographerai/Zen-Style-Shape/resolve/1e1fbeb6135765d0be77b04237eb90cd6ba0d1a0/comfy/comfy_types.py
909 Bytes
| import torch | |
| from typing import Callable, Protocol, TypedDict, Optional, List | |
| class UnetApplyFunction(Protocol): | |
| """Function signature protocol on comfy.model_base.BaseModel.apply_model""" | |
| def __call__(self, x: torch.Tensor, t: torch.Tensor, **kwargs) -> torch.Tensor: | |
| pass | |
| class UnetApplyConds(TypedDict): | |
| """Optional conditions for unet apply function.""" | |
| c_concat: Optional[torch.Tensor] | |
| c_crossattn: Optional[torch.Tensor] | |
| control: Optional[torch.Tensor] | |
| transformer_options: Optional[dict] | |
| class UnetParams(TypedDict): | |
| # Tensor of shape [B, C, H, W] | |
| input: torch.Tensor | |
| # Tensor of shape [B] | |
| timestep: torch.Tensor | |
| c: UnetApplyConds | |
| # List of [0, 1], [0], [1], ... | |
| # 0 means conditional, 1 means conditional unconditional | |
| cond_or_uncond: List[int] | |
| UnetWrapperFunction = Callable[[UnetApplyFunction, UnetParams], torch.Tensor] | |