Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions hackable_diffusion/lib/architecture/mlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def __call__(
self,
x: DataArray,
conditioning_embeddings: dict[ConditioningMechanism, Float['batch ...']],
*,
is_training: bool,
) -> DataArray:
x_emb = jnp.reshape(x, shape=(x.shape[0], -1))
Expand All @@ -92,7 +93,7 @@ def __call__(
dropout_rate=self.dropout_rate,
dtype=self.dtype,
name='PreprocessMLP',
)(x_emb, is_training)
)(x_emb, is_training=is_training)

# The conditioning was already processed by the `conditioning_encoder`, so
# here we just need to concatenate it with the `x`.
Expand Down Expand Up @@ -125,7 +126,7 @@ def __call__(
dtype=self.dtype,
zero_init_output=self.zero_init_output,
name='PostprocessMLP',
)(emb, is_training)
)(emb, is_training=is_training)

output = jnp.reshape(output, shape=x.shape)
output = utils.optional_bf16_to_fp32(output)
Expand Down
2 changes: 1 addition & 1 deletion hackable_diffusion/lib/architecture/mlp_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class MLP(nn.Module):
@nn.compact
@typechecked
def __call__(
self, x: Float['batch num_inputs'], is_training: bool
self, x: Float['batch num_inputs'], *, is_training: bool
) -> Float['batch num_features']:
"""Applies MLP blocks to the input tensor.

Expand Down
1 change: 1 addition & 0 deletions hackable_diffusion/lib/architecture/unet.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ def __call__(
self,
x: Float["batch height width channels"],
conditioning_embeddings: dict[ConditioningMechanism, Float["batch ..."]],
*,
is_training: bool,
) -> Float["batch height width output_channels"]:

Expand Down
1 change: 1 addition & 0 deletions hackable_diffusion/lib/architecture/unet_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ def __call__(
self,
x: Float["batch height width channels"],
cross_attention_emb: Float["batch seq cond_dim2"] | None,
*,
is_training: bool,
) -> Float["batch height width channels"]:
skip = x
Expand Down