Skip to content

Add convert_diffusers_to_cogvideox.py reverse conversion script - #14034

Open
Allure2233 wants to merge 2 commits into
huggingface:mainfrom
Allure2233:main
Open

Add convert_diffusers_to_cogvideox.py reverse conversion script#14034
Allure2233 wants to merge 2 commits into
huggingface:mainfrom
Allure2233:main

Conversation

@Allure2233

@Allure2233 Allure2233 commented Jun 22, 2026

Copy link
Copy Markdown

This script converts a HF Diffusers saved CogVideoX pipeline back to the original CogVideoX checkpoint format. It handles:

  • Transformer: reverses key mappings (QKV merge, adaLN modulation merge, dense_4h_to_h, attention/mlp block renames)
  • VAE: reverses key mappings (up_blocks index reversal, mid_block handling, resnets/block renames)
  • Supports both safetensors and PyTorch (.bin) output formats
  • Supports fp16/bf16 dtype casting

Closes #10076

What does this PR do?

Fixes # (issue)

Before submitting

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

This script converts a HF Diffusers saved CogVideoX pipeline back to the
original CogVideoX checkpoint format. It handles:

- Transformer: reverses key mappings (QKV merge, adaLN modulation merge,
  dense_4h_to_h, attention/mlp block renames)
- VAE: reverses key mappings (up_blocks index reversal, mid_block handling,
  resnets/block renames)
- Supports both safetensors and PyTorch (.bin) output formats
- Supports fp16/bf16 dtype casting

Closes huggingface#10076
@github-actions github-actions Bot added fixes-issue size/L PR with diff > 200 LOC labels Jun 22, 2026
@Allure2233

Copy link
Copy Markdown
Author

👋 @yiyixuxu @hlky — gentle ping, is there anything I can do to help move this forward? Happy to make any changes needed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fixes-issue size/L PR with diff > 200 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Do we have any script covert from hf format to orginal format?

1 participant