Skip to content

Add reverse CogVideoX conversion script (HF format -> original format)#13838

Open
TheChyeahhh wants to merge 1 commit into
huggingface:mainfrom
TheChyeahhh:add-reverse-cogvideox-conversion-script
Open

Add reverse CogVideoX conversion script (HF format -> original format)#13838
TheChyeahhh wants to merge 1 commit into
huggingface:mainfrom
TheChyeahhh:add-reverse-cogvideox-conversion-script

Conversation

@TheChyeahhh
Copy link
Copy Markdown

This PR adds a script to convert HuggingFace Diffusers CogVideoX checkpoints back to the original CogVideoX format.

Motivation: Issue #10076 asks for reverse conversion scripts. While and already exist for SD/SDXL, there is no reverse script for CogVideoX.

What this does:

  • Reverses the key transformations in
  • Merges // back into (concatenating along dim=0)
  • Reconstructs and from /
  • Reconstructs from +
  • Reverses all key renames and adds the prefix for the transformer
  • Reverses VAE up_blocks indexing and key renames

Usage:

Closes #10076

This script converts HuggingFace Diffusers CogVideoX checkpoints back
to the original CogVideoX format, reversing the transformations in
convert_cogvideox_to_diffusers.py.

Supports:
- Transformer state dict conversion (query_key_value merge, layernorm
  list reconstruction, adaLN modulation reconstruction, key renames)
- VAE state dict conversion (up_blocks index reversal, key renames)

Usage:
  python scripts/convert_diffusers_to_original_cogvideox.py \
    --checkpoint_path /path/to/hf/pipeline \
    --output_path /path/to/output

Closes huggingface#10076
@github-actions github-actions Bot added fixes-issue size/L PR with diff > 200 LOC labels May 29, 2026
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