Skip to content

Commit 815db23

Browse files
authored
Make time_embed_dim of UNet2DModel changeable
1 parent f9d5a93 commit 815db23

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/diffusers/models/unets/unet_2d.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def __init__(
9797
out_channels: int = 3,
9898
center_input_sample: bool = False,
9999
time_embedding_type: str = "positional",
100+
time_embedding_dim: Optional[int] = None,
100101
freq_shift: int = 0,
101102
flip_sin_to_cos: bool = True,
102103
down_block_types: Tuple[str, ...] = ("DownBlock2D", "AttnDownBlock2D", "AttnDownBlock2D", "AttnDownBlock2D"),
@@ -122,7 +123,7 @@ def __init__(
122123
super().__init__()
123124

124125
self.sample_size = sample_size
125-
time_embed_dim = block_out_channels[0] * 4
126+
time_embed_dim = time_embedding_dim or block_out_channels[0] * 4
126127

127128
# Check inputs
128129
if len(down_block_types) != len(up_block_types):

0 commit comments

Comments
 (0)