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