Skip to content

Conversation

tolgacangoz
Copy link
Contributor

@tolgacangoz tolgacangoz commented Aug 17, 2025

Skywork/SkyReels-V2-DF-1.3B-540P
seed=0
main: ~14 min. Wan's RoPE
main.mp4
Wan.s_RoPE.mp4
Wan's RoPE + compile_repeated_blocks(fullgraph=True): ~12 min. Wan's RoPE + compile_repeated_blocks(fullgraph=True) + "_native_cudnn" for attn1 and "flash" for attn2, FA=2.8.3: ~8 min.
Wan.s_RoPE+regional.mp4
Wan.s_RoPE+regional+FA.mp4
Reproducer
!uv pip install git+https://github.com/tolgacangoz/diffusers.git@update-skyreels-v2

import torch, os
from diffusers import AutoModel, SkyReelsV2DiffusionForcingPipeline, UniPCMultistepScheduler
from diffusers.utils import export_to_video

# For faster loading into the GPU
os.environ["HF_ENABLE_PARALLEL_LOADING"] = "YES"

model_id = "Skywork/SkyReels-V2-DF-1.3B-540P-Diffusers"
vae = AutoModel.from_pretrained(model_id,
                                subfolder="vae",
                                torch_dtype=torch.float32,
                                device_map="cuda")
pipeline = SkyReelsV2DiffusionForcingPipeline.from_pretrained(
    model_id,
    vae=vae,
    torch_dtype=torch.bfloat16,
    device_map="cuda"
)
flow_shift = 8.0  # 8.0 for T2V, 5.0 for I2V
pipeline.scheduler = UniPCMultistepScheduler.from_config(pipeline.scheduler.config, flow_shift=flow_shift)

# Some acceleration helpers
# Be sure to install Flash Attention: https://github.com/Dao-AILab/flash-attention#installation-and-features
#for block in pipeline.transformer.blocks:
#    block.attn1.set_attention_backend("_native_cudnn")
#    block.attn2.set_attention_backend("flash")
#pipeline.transformer.compile_repeated_blocks(fullgraph=True)

prompt = "A cat and a dog baking a cake together in a kitchen. The cat is carefully measuring flour, while the dog is stirring the batter with a wooden spoon. The kitchen is cozy, with sunlight streaming through the window."

output = pipeline(
    prompt=prompt,
    num_inference_steps=30,
    height=544,  # 720 for 720P
    width=960,   # 1280 for 720P
    num_frames=97,
    base_num_frames=97,  # 121 for 720P
    ar_step=5,  # Controls asynchronous inference (0 for synchronous mode)
    causal_block_size=5,  # Number of frames in each block for asynchronous processing
    overlap_history=None,  # Number of frames to overlap for smooth transitions in long videos; 17 for long video generations
    addnoise_condition=20,  # Improves consistency in long video generation
    generator=torch.Generator("cpu").manual_seed(0)
).frames[0]
export_to_video(output, "T2V.mp4", fps=24, quality=8)
Environment
- 🤗 Diffusers version: 0.35.0 or this branch
- Platform: Linux-4.4.0-x86_64-with-glibc2.36
- Running on Google Colab?: No
- Python version: 3.12.6
- PyTorch version (GPU?): 2.8.0+cu126 (True)
- Flax version (CPU?/GPU?/TPU?): 0.11.0 (gpu)
- Jax version: 0.7.0
- JaxLib version: 0.7.0
- Huggingface_hub version: 0.34.3
- Transformers version: 4.55.0
- Accelerate version: 1.9.0
- PEFT version: not installed
- Bitsandbytes version: not installed
- Safetensors version: 0.6.1
- xFormers version: not installed
- Accelerator: NVIDIA A100-SXM4-40GB, 40960 MiB

@a-r-r-o-w @yiyixuxu @stevhliu

tolgacangoz and others added 12 commits August 17, 2025 22:28
Wraps the visual demonstration section in a Markdown code block.

This change corrects the rendering of ASCII diagrams and examples, improving the overall readability of the document.
Improves the readability of the `step_matrix` examples by replacing long sequences of repeated numbers with a more compact `value×count` notation.

This change makes the underlying data patterns in the examples easier to understand at a glance.
@tolgacangoz tolgacangoz marked this pull request as draft August 20, 2025 15:20
@tolgacangoz tolgacangoz changed the title Propose to update SkyReels-V2 Propose to update & upgrade SkyReels-V2 Aug 21, 2025
@tolgacangoz tolgacangoz marked this pull request as ready for review August 21, 2025 12:59
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Member

@stevhliu stevhliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for improving the docs!

@tolgacangoz tolgacangoz requested a review from stevhliu August 22, 2025 12:03
Copy link
Member

@stevhliu stevhliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the docs LGTM!

Let's wait for @a-r-r-o-w to chime in on the other changes before we merge :)

@tolgacangoz
Copy link
Contributor Author

Alright, thanks for your review!

Copy link
Member

@a-r-r-o-w a-r-r-o-w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice @tolgacangoz! Thanks for propagating the attention backend changes to SkyReels

@tolgacangoz tolgacangoz requested a review from a-r-r-o-w August 23, 2025 08:49
Copy link
Member

@a-r-r-o-w a-r-r-o-w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

Just one last change similar to the following:

class WanAttnProcessor2_0:
def __new__(cls, *args, **kwargs):
deprecation_message = (
"The WanAttnProcessor2_0 class is deprecated and will be removed in a future version. "
"Please use WanAttnProcessor instead. "
)
deprecate("WanAttnProcessor2_0", "1.0.0", deprecation_message, standard_warn=False)
return WanAttnProcessor(*args, **kwargs)

Could you add a deprecation message by creating a dummy SkyReelsV2AttnProcessor2_0 class for BC?

@tolgacangoz
Copy link
Contributor Author

tolgacangoz commented Aug 26, 2025

Right, I missed realizing the previous code was in the released version.

@tolgacangoz tolgacangoz requested a review from a-r-r-o-w August 26, 2025 06:35
@a-r-r-o-w a-r-r-o-w merged commit 5fcd5f5 into huggingface:main Aug 26, 2025
11 checks passed
@tolgacangoz
Copy link
Contributor Author

Thanks for the reviews and merging!

@tolgacangoz tolgacangoz deleted the update-skyreels-v2 branch August 26, 2025 07:30
@stevhliu
Copy link
Member

@sayakpaul , looks like it was merged but feel free to leave any comments and we can iterate on it further!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants