Skip to content

cogvideo example: Distribute VAE video encoding across processes in CogVideoX LoRA training#13207

Merged
sayakpaul merged 2 commits intohuggingface:mainfrom
jiqing-feng:cogvideo
Mar 4, 2026
Merged

cogvideo example: Distribute VAE video encoding across processes in CogVideoX LoRA training#13207
sayakpaul merged 2 commits intohuggingface:mainfrom
jiqing-feng:cogvideo

Conversation

@jiqing-feng
Copy link
Contributor

Currently, every process encodes the entire dataset through the VAE during preprocessing. This is redundant in multi-GPU training — each process does the same full encoding work independently.

This PR shards the VAE encoding across processes so that each process only encodes 1/num_processes of the videos, then broadcasts the results. This reduces the preprocessing time proportionally to the number of processes (e.g., ~4x faster with 4 GPUs) with no change to training behavior.

Single-GPU training is unaffected.

Hi @sayakpaul . Would you please review this PR? Thanks!

@sayakpaul
Copy link
Member

@bot /style

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

Style bot fixed some files and pushed the changes.

@sayakpaul sayakpaul merged commit 8879824 into huggingface:main Mar 4, 2026
26 checks passed
@sayakpaul
Copy link
Member

Thanks for your contributions!

jiqing-feng and others added 2 commits March 4, 2026 15:45
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.

2 participants