Diffusers documentation

KandinskyS2VTransformer3DModel

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v0.42.1).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

KandinskyS2VTransformer3DModel

Kandinsky S2V 1.0의 Diffusion Transformer (DiT)는 참조 프레임과 음성 트랙에 조건부입니다.

KandinskyS2VTransformer3DModel

클래스 diffusers.KandinskyS2VTransformer3DModel

< >

( 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인 리딩 배치 축을 받아 이를 스퀴즈합니다.

시각 스트림은 하나의 패킹된 시퀀스 [memory | ref | visual]입니다:

  • memory — 4x / 2x / 1x 시간적 다운샘플링을 적용한 이전 청크의 FramePack 컨텍스트로, 음의 시간적 RoPE 위치에 배치됩니다;
  • ref — 시간적 RoPE 인덱스 index_rope_ref_image에 고정된 참조 프레임입니다;
  • visual — 노이즈가 제거되는 노이즈가 포함된 잠재 변수(latent).

memory와 ref는 클린(clean) 상태이므로 t = 0로 변조(modulated)되고, visual은 실제 타임스텝을 사용합니다. 변조는 두 행을 모두 포함하며, 인덱스가 토큰별로 선택합니다.

forward

< >

( 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 — reference frame latent, (1, 1, H, W, C).
  • memory_hidden_states — 4x / 2x / 1x의 FramePack 메모리, 각각 (1, T_i, H_i, W_i, C).
  • timestep — 현재 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 — 각 음성 토큰이 속하는 latent frame입니다.
  • scale_factor — 해상도 버킷에 의해 설정되는 축별 RoPE 스케일입니다.
  • return_dict — tuple 대신 Transformer2DModelOutput를 반환합니다.

반환값

[~models.modeling_outputs.Transformer2DModelOutput] 또는 tuple

hidden_states와 동일한 모양을 가진 예측 속도입니다.

하나의 청크를 디노이즈합니다.

Batch size는 1이어야 합니다: 시퀀스가 패킹되며 음성 크로스 어텐션은 프레임에 정렬됩니다.

Update on GitHub