Diffusers documentation
KandinskyS2VTransformer3DModel
KandinskyS2VTransformer3DModel
Kandinsky S2V 1.0 の Diffusion Transformer (DiT) は、参照フレームと音声トラックを条件として使用します。
KandinskyS2VTransformer3DModel
class diffusers.KandinskyS2VTransformer3DModel
< source >( in_visual_dim: int = 16out_visual_dim: int = 16in_text_dim: int = 3584in_text_dim2: int = 768in_audio_dim: int = 3584time_dim: int = 512patch_size: tuple[int, int, int] = (1, 2, 2)frame_buckets: tuple[int, int, int] = (2, 4, 24)enable_framepack: bool = Trueindex_rope_ref_image: int = 40patch_proj1x_coef: tuple[int, int, int] = (1, 1, 1)patch_proj2x_coef: tuple[int, int, int] = (2, 2, 2)patch_proj4x_coef: tuple[int, int, int] = (4, 4, 4)model_dim: int = 1792ff_dim: int = 7168num_text_blocks: int = 2num_audio_blocks: int = 2num_visual_blocks: int = 32axes_dims: tuple[int, int, int] = (16, 24, 24)audio_inject_layers: tuple[int, ...] = ()text_rope_max_pos: int = 4096 )
音声から動画への拡散トランスフォーマー。
パラメータ名は学習チェックポイントと一致しているため、変換済みの.safetensorsはキーの再マッピングなしで読み込むことができます。 推論はバッチサイズ1です。シーケンスはパックされ、音声クロスアテンションはフレーム単位でアラインされるため、forwardは先頭にバッチ軸1を受け取り、それをsqueezeします。
ビジュアルストリームは、1つのパックされたシーケンス[memory | ref | visual]です:
memory— 4x / 2x / 1x の時間方向ダウンサンプリングで取得した、前チャンクの FramePack コンテキスト。負の時間方向 RoPE 位置に配置されます。ref— 参照フレーム。時間軸 RoPE のインデックスindex_rope_ref_imageに固定されます。visual— 現在デノイジング処理中のノイズ付き潜在変数。
memory と ref はクリーンなため、t = 0 でモジュレーションが適用され、一方 visual は実際のタイムステップを使用します。モジュレーションは両方の行を保持し、インデックスによってトークンごとに選択されます。
forward
< source >( hidden_states: Tensorencoder_hidden_states: Tensoraudio_hidden_states: Tensorreference_hidden_states: Tensormemory_hidden_states: tuple[Tensor, Tensor, Tensor]timestep: Tensorpooled_projections: Tensorvisual_rope_pos: list[Tensor]reference_rope_pos: list[Tensor]memory_rope_pos: tuple[list[Tensor], list[Tensor], list[Tensor]]text_rope_pos: Tensoraudio_rope_pos: Tensorscale_factor: tuple[float, float, float] = (1.0, 1.0, 1.0)return_dict: bool = True ) → [~models.modeling_outputs.Transformer2DModelOutput] or tuple
パラメータ
- hidden_states — ノイジーな潜在変数、
(1, T, H, W, C)。 - encoder_hidden_states — テキスト埋め込み、
(1, S_text, in_text_dim)。 - audio_hidden_states — 音声特徴、
(1, S_audio, in_audio_dim)。 - reference_hidden_states — 参照フレームの潜在変数、
(1, 1, H, W, C)。 - memory_hidden_states — 4x / 2x / 1x の FramePack メモリ。それぞれ
(1, T_i, H_i, W_i, C)。 - timestep — 現在のタイムステップ、
(1,)。 - pooled_projections — プールされた CLIP テキスト埋め込み、
(1, in_text_dim2)。 - visual_rope_pos — ノイジー潜在変数の軸ごとの RoPE 位置。
- reference_rope_pos — 参照フレームの軸ごとの RoPE 位置。
- memory_rope_pos — 各 FramePack メモリースケールの軸ごとの RoPE 位置。
- text_rope_pos — テキストトークンの1次元RoPE位置。
- audio_rope_pos — 各音声トークンが属する潜在フレームです。
- scale_factor — 解像度バケットによって設定される、軸ごとの RoPE スケール。
- return_dict — タプルではなく
Transformer2DModelOutputを返します。
戻り値
[~models.modeling_outputs.Transformer2DModelOutput] または tuple
hidden_states と同じ形状の予測速度
1チャンクをデノイズします。
Batch sizeは1である必要があります。シーケンスはパックされており、音声クロスアテンションはフレーム単位でアラインされています。