MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / setup

Method setup

diffusers/src/diffusers/models/attention_flax.py:153–163  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

151 dtype: jnp.dtype = jnp.float32
152
153 def setup(self):
154 inner_dim = self.dim_head * self.heads
155 self.scale = self.dim_head**-0.5
156
157 # Weights were exported with old names {to_q, to_k, to_v, to_out}
158 self.query = nn.Dense(inner_dim, use_bias=False, dtype=self.dtype, name="to_q")
159 self.key = nn.Dense(inner_dim, use_bias=False, dtype=self.dtype, name="to_k")
160 self.value = nn.Dense(inner_dim, use_bias=False, dtype=self.dtype, name="to_v")
161
162 self.proj_attn = nn.Dense(self.query_dim, dtype=self.dtype, name="to_out_0")
163 self.dropout_layer = nn.Dropout(rate=self.dropout)
164
165 def reshape_heads_to_batch_dim(self, tensor):
166 batch_size, seq_len, dim = tensor.shape

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected