How skyworkai/skyreels-v3 works
Purpose and execution surface
SkyReels V3 is Python/CUDA inference code for multimodal diffusion-based video generation: reference-images-to-video, video extension, and portrait-plus-audio talking avatars. The primary CLI is generate_video.py; avatar convenience launchers are scripts/run_talking_avatar.sh and scripts/run_talking_avatar_low_vram.sh. Inputs may be local files or URLs; pretrained weights are obtained from Hugging Face by default or supplied through --model_id.
Task routing and pipeline boundary
generate_video.py selects a task-specific orchestration pipeline based on --task_type, keeping modality preparation and generation policies separate:
• Reference images and prompt: skyreels_v3/pipelines/reference_to_video_pipeline.py
• Video continuation and longer single-shot generation: skyreels_v3/pipelines/single_shot_extension_pipeline.py
• Cinematic shot-switching extension: skyreels_v3/pipelines/shot_switching_extension_pipeline.py
• Portrait/audio-driven generation: skyreels_v3/pipelines/talking_avatar_pipeline.py
Each pipeline is the principal boundary between user media/prompt inputs and model tensors, sampling, decoding, and output-video assembly.
Model and multimodal encoding stack
The model layer contains the video diffusion Transformer and modality encoders. Core Transformer variants are skyreels_v3/modules/transformer.py, skyreels_v3/modules/transformer_a2v.py, and skyreels_v3/modules/reference_to_video/transformer.py. Text conditioning is provided by T5/CLIP/XLM-R components in skyreels_v3/modules/t5.py, skyreels_v3/modules/clip.py, and skyreels_v3/modules/xlm_roberta.py. Avatar audio features use skyreels_v3/modules/wav2vec2.py; video/image latent encoding and reconstruction uses skyreels_v3/modules/vae.py.
Generation flow
For reference-to-video, up to four images plus text become multimodal conditioning for latent-video denoising. Extension pipelines ingest an existing video plus prompt, encode its temporal context, and generate continuation frames; their policy differs for continuous versus shot-transition output. Talking-avatar inference preprocesses a first-frame portrait and driving audio, extracts audio conditioning, then generates an audio-aligned video sequence. Shared attention behavior resides in skyreels_v3/modules/attention.py; iterative diffusion/flow sampling is scheduled by skyreels_v3/scheduler/fm_solvers_unipc.py.
Avatar-specific preparation
Avatar generation has an explicit media-conditioning stage before the generic model path: skyreels_v3/utils/avatar_preprocess.py and skyreels_v3/utils/avatar_util.py. This isolates portrait normalization, audio/video timing, and avatar-oriented conditioning from the main talking_avatar_pipeline.py orchestration.
Distributed and memory execution
The intended runtime is Python 3.12+ with CUDA 12.8+ and PyTorch GPU inference. Single-GPU execution can offload model blocks; low-VRAM mode uses FP8 weight-only quantization and block offload. Multi-GPU execution uses torchrun and xDiT USP-style context parallelism, separated by workload in skyreels_v3/distributed/context_parallel_for_reference.py, skyreels_v3/distributed/context_parallel_for_extension.py, and skyreels_v3/distributed/context_parallel_for_avatar.py.
Configuration and external dependencies
Shared runtime/model settings are centralized in skyreels_v3/config.py and skyreels_v3/configs/shared_config.py, with avatar model specialization in skyreels_v3/configs/talking_avatar_19B.py. External model distribution is Hugging Face or ModelScope; the repository also points to hosted playground/API offerings, but contains no service server implementation.
Main entry points: transformer.py Video diffusion Transformers · generate_video.py Generation CLI · talking_avatar_pipeline.py Talking avatar · reference_to_video_pipeline.py Reference-to-video
Components 18
Entry & inputs
- Media, prompts & URLs · Images, source video, portrait, audio, and text prompts.
- Generation CLI · Selects task orchestration from --task_type.
generate_video.py - Pretrained weights · Downloaded from Hugging Face or supplied with --model_id.
Task pipelines
- Reference-to-video · Builds image-and-text conditioning for up to four references.
skyreels_v3/pipelines/reference_to_video_pipeline.py - Single-shot extension · Encodes temporal context and generates continuous video continuation.
skyreels_v3/pipelines/single_shot_extension_pipeline.py - Shot-switch extension · Applies cinematic shot-transition extension policy.
skyreels_v3/pipelines/shot_switching_extension_pipeline.py - Talking avatar · Orchestrates portrait and audio-conditioned generation.
skyreels_v3/pipelines/talking_avatar_pipeline.py - Avatar media preparation · Normalizes portrait media and aligns audio/video timing.
skyreels_v3/utils/avatar_preprocess.py
Model & sampling
- Video diffusion Transformers · Task variants denoise latent video sequences.
skyreels_v3/modules/transformer.py - Text & audio encoders · T5, CLIP, XLM-R, and Wav2Vec2 produce conditioning features.
skyreels_v3/modules/t5.py - Video VAE · Encodes input media and reconstructs generated video frames.
skyreels_v3/modules/vae.py - Shared attention
skyreels_v3/modules/attention.py - Flow sampling scheduler · Schedules iterative diffusion/flow denoising.
skyreels_v3/scheduler/fm_solvers_unipc.py
Runtime scaling
- Shared settings · Centralizes runtime and model settings.
skyreels_v3/config.py - Avatar 19B settings
skyreels_v3/configs/talking_avatar_19B.py - Context parallelism · xDiT USP-style multi-GPU execution by workload.
skyreels_v3/distributed/context_parallel_for_reference.py - CUDA inference runtime · PyTorch GPU execution supports block offload and low-VRAM FP8 weights.
Other components
- Generated video · Decoded frames assembled as output video.
Connections 26
- Media, prompts & URLs → Generation CLI: arguments and media
- Pretrained weights → Generation CLI: model source
- Generation CLI → Reference-to-video: reference task
- Generation CLI → Single-shot extension: continuation task
- Generation CLI → Shot-switch extension: shot-switch task
- Generation CLI → Talking avatar: avatar task
- Media, prompts & URLs → Avatar media preparation: portrait and audio
- Avatar media preparation → Talking avatar: aligned conditioning
- Reference-to-video → Text & audio encoders: text/image conditioning
- Single-shot extension → Video VAE: encode source context
- Shot-switch extension → Video VAE: encode source context
- Talking avatar → Text & audio encoders: audio and text features
- Reference-to-video → Video diffusion Transformers: latent denoising
- Single-shot extension → Video diffusion Transformers: continuation denoising
- Shot-switch extension → Video diffusion Transformers: transition denoising
- Talking avatar → Video diffusion Transformers: audio-aligned denoising
- Text & audio encoders → Video diffusion Transformers: conditioning features
- Flow sampling scheduler → Video diffusion Transformers: sampling steps
- Shared attention → Video diffusion Transformers: attention behavior
- Video diffusion Transformers → Video VAE: generated latents
- Video VAE → Generated video: decoded frames
- Shared settings → Generation CLI: runtime settings
- Avatar 19B settings → Talking avatar: avatar specialization
- Context parallelism → Reference-to-video: multi-GPU reference workload
- Context parallelism → CUDA inference runtime: torchrun execution
- CUDA inference runtime → Video diffusion Transformers: CUDA, offload, FP8