This repository packages a depth video to RGB video pipeline on top of the VACE Wan 2.1 model family.
The main entry point is batch_run.py, which fans out large datasets of depth-driven editing jobs, manages prompt sampling, and optionally reorganises finished results for downstream consumption.
- Python 3.10+
- CUDA-capable GPU (the default configuration targets 14B Wan checkpoints; expect ≥48 GB VRAM)
- PyTorch 2.5.1 with CUDA 12.4 wheels (see
requirements.txtfor the full dependency list)
Install the environment:
pip install torch==2.5.1 torchvision==0.20.1 --index-url https://download.pytorch.org/whl/cu124
pip install -r requirements.txt
pip install wan@git+https://github.com/Wan-Video/Wan2.1If you need the preprocessing annotators used by auxiliary scripts, also run pip install -r requirements/annotator.txt.
batch_run.py loads the Wan 2.1 VACE 14B checkpoint through vace.vace_wan_modified.get_wan_model.
Place the unpacked model weights at:
ckpts/Wan2.1-VACE-14B/
You can obtain the files from:
- Hugging Face: https://huggingface.co/Wan-AI/Wan2.1-VACE-14B
- ModelScope: https://www.modelscope.cn/models/Wan-AI/Wan2.1-VACE-14B
The script expects the directory to contain the original Wan checkpoint layout (config.json, diffusion weights, text encoder weights, etc.).
batch_run.py traverses --input_root for object folders.
Each object folder must contain:
- Depth renderings:
depth_jointXX_videoYYY.mp4(or colour videoscolor_jointXX_videoYYY.mp4when--use_color_directis enabled) - Optional masks:
mask_jointXX_videoYYY.png(same stem as the depth clip) - Prompts file: a tab-separated
prompts.txt
Sample layout:
inputs/
data_1105/
obj0001/
depth_joint00_video000.mp4
mask_joint00_video000.png
depth_joint01_video000.mp4
mask_joint01_video000.png
prompts.txt
Example prompts.txt line (tab separated, empty columns are allowed):
0\tjoint_0\tOriginal prompt text\tSimplified prompt text
- Column 0: integer joint id
- Column 2: full prompt
- Column 3: optional simplified prompt (used when
--simplifiedis passed)
The script draws up to --max_prompts_per_video prompts per joint using a deterministic RNG seeded by (object_id, joint_id, video_idx) so replicas in separate batches stay aligned.
Basic invocation:
python batch_run.py \
--input_root inputs/data_1105 \
--output_root results/data_1105_batch0 \
--batch_id 0 \
--batch_n 8 \
--max_prompts_per_video 2 \
--simplified--batch_nand--batch_idsplit the workload across multiple processes or machines.batch_id∈[0, batch_n).- Outputs (without
--reorg) are grouped underresults/data_1105_batch0/obj<id>/obj<id>_joint<jj>_prompt<ppp>_video<vvv>/without_video.mp4, the first frame snapshot, the prompt text file, and copied masks.
batch_launch.sh showcases how we submit the same command to a cluster scheduler (rjob) while cycling through batches.
- Depth-to-RGB generation: Default mode loads Wan VACE 14B once per run and generates RGB clips for each sampled prompt.
- Colour direct mode (
--use_color_direct): Bypasses the Wan model entirely, copying pre-rendered RGB clips into the output structure while exporting masks and thumbnails. Use this for the ablation scenario where you want a dataset derived purely from the original renders (no VACE-powered data augmentation). - Prompt handling:
--max_prompts_per_videoclamps the number of prompts sampled per depth clip.--simplifiedswitches from column 2 (full prompt) to column 3 (simplified prompt) inprompts.txt.
- Batch partitioning:
--batch_n/--batch_idchunk the task list so you can distribute work manually or viabatch_launch.sh. - Metadata dry run (
--dry_run_meta): Scans existing outputs instead of generating them. With--reorg, it emits a CSV mapping each completed video to its prompt, frame, and mask.--num_processescan be set to parallelise the metadata sweep (defaults to the CPU count).--out_metaselects the CSV filename (defaultmetadata.csv).
- Reorganisation mode (
--reorg): Writes finished artefacts to a flat directory (<output_root>/obj*_joint*_prompt*_video*.mp4) and accumulates metadata rows; useful before uploading to object storage.- When enabled, the script initialises
CephS3Storageusing the environment variablesHOSS_KEY,HOSS_SECRET, andENDPOINT_URL. Ensure these are present if you plan to immediately sync to Ceph/S3.
- When enabled, the script initialises
- Resource hygiene: Each completed job clears cached GPU memory via
torch.cuda.empty_cache()so long runs stay within a single process.
Standard layout (--reorg disabled)
results/<run_name>/obj0001/
obj0001_joint00_prompt000_video000/
out_video.mp4
frame0.png
mask.png
prompt.txt
Reorganised layout (--reorg enabled)
results/<run_name>/
obj0001_joint00_prompt000_video000.mp4
obj0001_joint00_prompt000_video000_frame0.png
obj0001_joint00_prompt000_video000_mask.png
metadata.csv
The metadata CSV contains columns video, prompt, input_image, and ref_mask, making it easy to ingest results downstream or upload to storage services.
- Confirm that every depth (or colour) clip has a matching mask file; the script derives the mask path by replacing
"depth"/"color"with"mask"in the filename. - If model loading fails, double-check that
ckpts/Wan2.1-VACE-14B/exists and that thewanpackage can see GPU resources. - Large batches benefit from setting
CUDA_VISIBLE_DEVICESmanually and ensuring the environment is launched from the correct conda environment (seebase_command.shfor an example activation sequence).
For additional utilities (dataset preparation, metadata alignment, etc.) explore:
find_depth_video.py– helper for locating the exact depth clip that produced a generated RGB videomerge_data.pyandsplit_videos.py– dataset management scripts
Feel free to adapt batch_run.py for other VACE tasks by adjusting the input discovery logic and the prompt sampling strategy.