Skip to content

Commit 58aa775

Browse files
BichidianFoundsheep
authored andcommitted
Make time_embed_dim of UNet2DModel changeable (huggingface#10262)
1 parent 52bf0d1 commit 58aa775

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
@@ -101,6 +101,7 @@ def __init__(
101101
out_channels: int = 3,
102102
center_input_sample: bool = False,
103103
time_embedding_type: str = "positional",
104+
time_embedding_dim: Optional[int] = None,
104105
freq_shift: int = 0,
105106
flip_sin_to_cos: bool = True,
106107
down_block_types: Tuple[str, ...] = ("DownBlock2D", "AttnDownBlock2D", "AttnDownBlock2D", "AttnDownBlock2D"),
@@ -128,7 +129,7 @@ def __init__(
128129
super().__init__()
129130

130131
self.sample_size = sample_size
131-
time_embed_dim = block_out_channels[0] * 4
132+
time_embed_dim = time_embedding_dim or block_out_channels[0] * 4
132133

133134
# Check inputs
134135
if len(down_block_types) != len(up_block_types):

0 commit comments

Comments
 (0)