Unverified Commit 405a1fac authored by Yuanhao Zhai's avatar Yuanhao Zhai Committed by GitHub
Browse files

fix: enable unet_3d_condition to support time_cond_proj_dim (#7364)


Co-authored-by: default avatarSayak Paul <spsayakpaul@gmail.com>
parent 3028089e
...@@ -91,6 +91,8 @@ class UNet3DConditionModel(ModelMixin, ConfigMixin, UNet2DConditionLoadersMixin) ...@@ -91,6 +91,8 @@ class UNet3DConditionModel(ModelMixin, ConfigMixin, UNet2DConditionLoadersMixin)
cross_attention_dim (`int`, *optional*, defaults to 1024): The dimension of the cross attention features. cross_attention_dim (`int`, *optional*, defaults to 1024): The dimension of the cross attention features.
attention_head_dim (`int`, *optional*, defaults to 64): The dimension of the attention heads. attention_head_dim (`int`, *optional*, defaults to 64): The dimension of the attention heads.
num_attention_heads (`int`, *optional*): The number of attention heads. num_attention_heads (`int`, *optional*): The number of attention heads.
time_cond_proj_dim (`int`, *optional*, defaults to `None`):
The dimension of `cond_proj` layer in the timestep embedding.
""" """
_supports_gradient_checkpointing = False _supports_gradient_checkpointing = False
...@@ -123,6 +125,7 @@ class UNet3DConditionModel(ModelMixin, ConfigMixin, UNet2DConditionLoadersMixin) ...@@ -123,6 +125,7 @@ class UNet3DConditionModel(ModelMixin, ConfigMixin, UNet2DConditionLoadersMixin)
cross_attention_dim: int = 1024, cross_attention_dim: int = 1024,
attention_head_dim: Union[int, Tuple[int]] = 64, attention_head_dim: Union[int, Tuple[int]] = 64,
num_attention_heads: Optional[Union[int, Tuple[int]]] = None, num_attention_heads: Optional[Union[int, Tuple[int]]] = None,
time_cond_proj_dim: Optional[int] = None,
): ):
super().__init__() super().__init__()
...@@ -174,6 +177,7 @@ class UNet3DConditionModel(ModelMixin, ConfigMixin, UNet2DConditionLoadersMixin) ...@@ -174,6 +177,7 @@ class UNet3DConditionModel(ModelMixin, ConfigMixin, UNet2DConditionLoadersMixin)
timestep_input_dim, timestep_input_dim,
time_embed_dim, time_embed_dim,
act_fn=act_fn, act_fn=act_fn,
cond_proj_dim=time_cond_proj_dim,
) )
self.transformer_in = TransformerTemporalModel( self.transformer_in = TransformerTemporalModel(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment