r""" Initialize the diffusion model backbone. Args: model_type (`str`, *optional*, defaults to 't2v'): Model variant - 't2v' (text-to-video) or 'i2v' (image-to-video) or 'flf2v' (first-last-frame-to-video) or 'vace' patch_size (`tuple`, *optio
(self,
model_type='t2v',
patch_size=(1, 2, 2),
text_len=512,
in_dim=16,
dim=2048,
ffn_dim=8192,
freq_dim=256,
text_dim=4096,
out_dim=16,
num_heads=16,
num_layers=32,
window_size=(-1, -1),
qk_norm=True,
cross_attn_norm=True,
eps=1e-6)
| 377 | |
| 378 | @register_to_config |
| 379 | def __init__(self, |
| 380 | model_type='t2v', |
| 381 | patch_size=(1, 2, 2), |
| 382 | text_len=512, |
| 383 | in_dim=16, |
| 384 | dim=2048, |
| 385 | ffn_dim=8192, |
| 386 | freq_dim=256, |
| 387 | text_dim=4096, |
| 388 | out_dim=16, |
| 389 | num_heads=16, |
| 390 | num_layers=32, |
| 391 | window_size=(-1, -1), |
| 392 | qk_norm=True, |
| 393 | cross_attn_norm=True, |
| 394 | eps=1e-6): |
| 395 | r""" |
| 396 | Initialize the diffusion model backbone. |
| 397 | |
| 398 | Args: |
| 399 | model_type (`str`, *optional*, defaults to 't2v'): |
| 400 | Model variant - 't2v' (text-to-video) or 'i2v' (image-to-video) or 'flf2v' (first-last-frame-to-video) or 'vace' |
| 401 | patch_size (`tuple`, *optional*, defaults to (1, 2, 2)): |
| 402 | 3D patch dimensions for video embedding (t_patch, h_patch, w_patch) |
| 403 | text_len (`int`, *optional*, defaults to 512): |
| 404 | Fixed length for text embeddings |
| 405 | in_dim (`int`, *optional*, defaults to 16): |
| 406 | Input video channels (C_in) |
| 407 | dim (`int`, *optional*, defaults to 2048): |
| 408 | Hidden dimension of the transformer |
| 409 | ffn_dim (`int`, *optional*, defaults to 8192): |
| 410 | Intermediate dimension in feed-forward network |
| 411 | freq_dim (`int`, *optional*, defaults to 256): |
| 412 | Dimension for sinusoidal time embeddings |
| 413 | text_dim (`int`, *optional*, defaults to 4096): |
| 414 | Input dimension for text embeddings |
| 415 | out_dim (`int`, *optional*, defaults to 16): |
| 416 | Output video channels (C_out) |
| 417 | num_heads (`int`, *optional*, defaults to 16): |
| 418 | Number of attention heads |
| 419 | num_layers (`int`, *optional*, defaults to 32): |
| 420 | Number of transformer blocks |
| 421 | window_size (`tuple`, *optional*, defaults to (-1, -1)): |
| 422 | Window size for local attention (-1 indicates global attention) |
| 423 | qk_norm (`bool`, *optional*, defaults to True): |
| 424 | Enable query/key normalization |
| 425 | cross_attn_norm (`bool`, *optional*, defaults to False): |
| 426 | Enable cross-attention normalization |
| 427 | eps (`float`, *optional*, defaults to 1e-6): |
| 428 | Epsilon value for normalization layers |
| 429 | """ |
| 430 | |
| 431 | super().__init__() |
| 432 | |
| 433 | assert model_type in ['t2v', 'i2v', 'flf2v', 'vace', 'i2v_v2', 'ti2v'] |
| 434 | self.model_type = model_type |
| 435 | |
| 436 | self.patch_size = patch_size |
nothing calls this directly
no test coverage detected