Skip to content

Add CogVideoX Diffusers checkpoint conversion - #14651

Open
anubhavsingh23906-code wants to merge 1 commit into
huggingface:mainfrom
anubhavsingh23906-code:add-cogvideox-reverse-conversion
Open

Add CogVideoX Diffusers checkpoint conversion#14651
anubhavsingh23906-code wants to merge 1 commit into
huggingface:mainfrom
anubhavsingh23906-code:add-cogvideox-reverse-conversion

Conversation

@anubhavsingh23906-code

Copy link
Copy Markdown

What does this PR do?

Adds a new conversion script to convert CogVideoX transformer checkpoints from Diffusers format to the CogVideoX checkpoint format.

Changes

  • Added scripts/convert_diffusers_to_cogvideox.py
  • Converts separate Q/K/V projection weights into combined QKV weights.
  • Converts query/key LayerNorm keys to the CogVideoX format.
  • Reconstructs AdaLN modulation weights and biases.
  • Converts transformer layer key names to the expected CogVideoX format.
  • Added CLI arguments for input and output checkpoint paths.

Validation

  • Verified QKV reconstruction using synthetic tensors.
  • Verified AdaLN weight rearrangement.
  • Verified query/key LayerNorm key conversion.
  • Verified CogVideoXTransformer3DModel can be instantiated successfully.
  • Verified CLI argument parsing with --help.
  • git diff --check passes.

Testing

The conversion logic has currently been validated with synthetic state dictionaries. Real checkpoint conversion has not yet been performed because a suitable source checkpoint was not available locally.

Dependencies

No new dependencies were added.

Self-review

  • Reviewed the conversion logic for QKV, AdaLN, LayerNorm, and transformer key mappings.
  • Confirmed the script passes basic syntax/CLI and synthetic conversion checks.
  • Real checkpoint conversion remains to be validated separately.

@github-actions github-actions Bot added the size/L PR with diff > 200 LOC label Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L PR with diff > 200 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant