MCPcopy Create free account
hub / github.com/TencentARC/BrushNet / __init__

Method __init__

src/diffusers/models/unets/unet_motion_model.py:52–79  ·  view source on GitHub ↗
(
        self,
        in_channels: int,
        layers_per_block: int = 2,
        num_attention_heads: int = 8,
        attention_bias: bool = False,
        cross_attention_dim: Optional[int] = None,
        activation_fn: str = "geglu",
        norm_num_groups: int = 32,
        max_seq_length: int = 32,
    )

Source from the content-addressed store, hash-verified

50
51class MotionModules(nn.Module):
52 def __init__(
53 self,
54 in_channels: int,
55 layers_per_block: int = 2,
56 num_attention_heads: int = 8,
57 attention_bias: bool = False,
58 cross_attention_dim: Optional[int] = None,
59 activation_fn: str = "geglu",
60 norm_num_groups: int = 32,
61 max_seq_length: int = 32,
62 ):
63 super().__init__()
64 self.motion_modules = nn.ModuleList([])
65
66 for i in range(layers_per_block):
67 self.motion_modules.append(
68 TransformerTemporalModel(
69 in_channels=in_channels,
70 norm_num_groups=norm_num_groups,
71 cross_attention_dim=cross_attention_dim,
72 activation_fn=activation_fn,
73 attention_bias=attention_bias,
74 num_attention_heads=num_attention_heads,
75 attention_head_dim=in_channels // num_attention_heads,
76 positional_embeddings="sinusoidal",
77 num_positional_embeddings=max_seq_length,
78 )
79 )
80
81
82class MotionAdapter(ModelMixin, ConfigMixin):

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls 1

Tested by

no test coverage detected