(
self,
image_size,
in_channels,
model_channels,
hint_channels,
num_res_blocks,
dropout=0,
channel_mult=(1, 2, 4, 8),
conv_resample=True,
dims=2,
num_classes=None,
use_checkpoint=False,
dtype=torch.float32,
num_heads=-1,
num_head_channels=-1,
num_heads_upsample=-1,
use_scale_shift_norm=False,
resblock_updown=False,
use_new_attention_order=False,
use_spatial_transformer=False, # custom transformer support
transformer_depth=1, # custom transformer support
context_dim=None, # custom transformer support
n_embed=None, # custom support for prediction of discrete ids into codebook of first stage vq model
legacy=True,
disable_self_attentions=None,
num_attention_blocks=None,
disable_middle_self_attn=False,
use_linear_in_transformer=False,
adm_in_channels=None,
transformer_depth_middle=None,
transformer_depth_output=None,
use_spatial_context=False,
extra_ff_mix_layer=False,
merge_strategy="fixed",
merge_factor=0.5,
video_kernel_size=3,
device=None,
operations=comfy.ops.disable_weight_init,
**kwargs,
)
| 21 | |
| 22 | class SVDControlNet(nn.Module): |
| 23 | def __init__( |
| 24 | self, |
| 25 | image_size, |
| 26 | in_channels, |
| 27 | model_channels, |
| 28 | hint_channels, |
| 29 | num_res_blocks, |
| 30 | dropout=0, |
| 31 | channel_mult=(1, 2, 4, 8), |
| 32 | conv_resample=True, |
| 33 | dims=2, |
| 34 | num_classes=None, |
| 35 | use_checkpoint=False, |
| 36 | dtype=torch.float32, |
| 37 | num_heads=-1, |
| 38 | num_head_channels=-1, |
| 39 | num_heads_upsample=-1, |
| 40 | use_scale_shift_norm=False, |
| 41 | resblock_updown=False, |
| 42 | use_new_attention_order=False, |
| 43 | use_spatial_transformer=False, # custom transformer support |
| 44 | transformer_depth=1, # custom transformer support |
| 45 | context_dim=None, # custom transformer support |
| 46 | n_embed=None, # custom support for prediction of discrete ids into codebook of first stage vq model |
| 47 | legacy=True, |
| 48 | disable_self_attentions=None, |
| 49 | num_attention_blocks=None, |
| 50 | disable_middle_self_attn=False, |
| 51 | use_linear_in_transformer=False, |
| 52 | adm_in_channels=None, |
| 53 | transformer_depth_middle=None, |
| 54 | transformer_depth_output=None, |
| 55 | use_spatial_context=False, |
| 56 | extra_ff_mix_layer=False, |
| 57 | merge_strategy="fixed", |
| 58 | merge_factor=0.5, |
| 59 | video_kernel_size=3, |
| 60 | device=None, |
| 61 | operations=comfy.ops.disable_weight_init, |
| 62 | **kwargs, |
| 63 | ): |
| 64 | super().__init__() |
| 65 | assert use_spatial_transformer == True, "use_spatial_transformer has to be true" |
| 66 | if use_spatial_transformer: |
| 67 | assert context_dim is not None, 'Fool!! You forgot to include the dimension of your cross-attention conditioning...' |
| 68 | |
| 69 | if context_dim is not None: |
| 70 | assert use_spatial_transformer, 'Fool!! You forgot to use the spatial transformer for your cross-attention conditioning...' |
| 71 | # from omegaconf.listconfig import ListConfig |
| 72 | # if type(context_dim) == ListConfig: |
| 73 | # context_dim = list(context_dim) |
| 74 | |
| 75 | if num_heads_upsample == -1: |
| 76 | num_heads_upsample = num_heads |
| 77 | |
| 78 | if num_heads == -1: |
| 79 | assert num_head_channels != -1, 'Either num_heads or num_head_channels has to be set' |
| 80 |
nothing calls this directly
no test coverage detected