Add CogVideoX diffusers-to-original format conversion script#13435
Open
Ricardo-M-L wants to merge 1 commit intohuggingface:mainfrom
Open
Add CogVideoX diffusers-to-original format conversion script#13435Ricardo-M-L wants to merge 1 commit intohuggingface:mainfrom
Ricardo-M-L wants to merge 1 commit intohuggingface:mainfrom
Conversation
Add a reverse conversion script that converts CogVideoX models from diffusers format back to the original CogVideo checkpoint format. This complements the existing convert_cogvideox_to_diffusers.py script. Closes huggingface#10076 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/convert_cogvideox_to_original.py, a reverse conversion script that converts CogVideoX models (transformer and VAE) from diffusers format back to the original CogVideo checkpoint formatconvert_cogvideox_to_diffusers.pyCloses #10076
How to use
Implementation details
The script reverses every transformation in
convert_cogvideox_to_diffusers.py:query_key_valuechunked intoto_q,to_k,to_vto_q/k/vconcatenated back intoquery_key_valueadaln_layer.adaLN_modulationssplit intonorm1.linear+norm2.linearnorm1/norm2.linearinterleaved back intoadaLN_modulationsquery/key_layernorm_listrenamed toattn1.norm_q/kattn1.norm_q/krenamed back toquery/key_layernorm_listTRANSFORMER_KEYS_RENAME_DICTTRANSFORMER_KEYS_RENAME_DICT_REVERSEmodel.diffusion_model.prefix strippedTest plan
🤖 Generated with Claude Code