12 Commits

Author SHA1 Message Date
Test User
2d3f2a4d02 feat: add production-grade batch inference pipeline
Implements a comprehensive batch video generation tool that addresses the #1
missing feature for production users: generating multiple videos from a single
batch file instead of one-at-a-time processing.

## New Files

### tools/batch_inference.py
Production-ready batch inference script with:

**Core Features:**
- JSONL input format (one job per line, streaming-friendly)
- Support for all generation types: t2v, i2v, v2v
- Progress tracking with tqdm (progress bar, ETA)
- Robust error handling (logs errors, continues batch)
- Resume capability (tracks completed jobs, skips on restart)

**Input Schema:**
- prompt (required): Text description
- output_name (required): Output filename
- image_path (optional): For i2v generation
- video_path (optional): For v2v generation
- num_frames, guidance_scale, num_inference_steps, seed, width, height (optional)

**Multi-GPU Support:**
- Job-level parallelism via --gpu_id and --num_gpus flags
- Each GPU processes a subset of jobs (round-robin distribution)
- State file prevents duplicate work across processes

**Memory Management:**
- Loads model once, generates sequentially
- CPU offloading enabled by default
- VAE slicing and tiling enabled

### resources/example_batch_*.jsonl
Example batch files demonstrating:
- example_batch_t2v.jsonl: Text-to-video prompts
- example_batch_i2v.jsonl: Image-to-video with image_path
- example_batch_v2v.jsonl: Video-to-video with video_path

## Design Decisions

1. **JSONL over JSON**: Better for large batches, streaming, and manual editing
2. **Reuse generation logic**: Mirrors cli_demo.py patterns for consistency
3. **Single model per batch**: Memory efficient, simpler implementation
4. **State persistence**: JSON state file enables reliable resume
5. **Error isolation**: One failed job doesn't stop the batch

## Usage Examples

# Basic text-to-video
python tools/batch_inference.py --batch_file prompts.jsonl --model_path THUDM/CogVideoX1.5-5B

# Multi-GPU (4 GPUs)
for i in {0..3}; do
    CUDA_VISIBLE_DEVICES=$i python tools/batch_inference.py --batch_file batch.jsonl --gpu_id $i --num_gpus 4 &
done
2026-02-19 03:15:10 +00:00
Yuxuan Zhang
39c6562dc8 format 2025-03-22 15:14:06 +08:00
Yuxuan Zhang
a691a6dd35 Update wechat.jpg 2025-03-03 10:52:22 +08:00
zR
ce9075514e release ready 2024-09-18 14:47:17 +08:00
zR
66369a90aa update of readme and hostfile 2024-09-17 23:42:35 +08:00
zR
1b16921b2e remove streamlit demo since outdate 2024-09-16 18:25:02 +08:00
glide-the
b2b772a942 支持了从SAT权重文件 导出的lora权重,脚本在CogVideoX仓库 tools/export_sat_lora_weight.py
加载后使用 load_cogvideox_lora.py 推理
2024-09-11 16:24:31 +08:00
zR
e02608ae40 add prompt and huggingface space demo 2024-08-26 22:34:06 +08:00
zR
180a940285 paper and logo update 2024-08-13 12:01:46 +08:00
Yuvraj Sharma
51b7f53e7a Updated README, README_zh, and gradio_demo 2024-08-06 18:14:29 +05:30
zR
ad855f622c ADD PAPER 2024-08-06 02:41:08 +08:00
zR
34dd61430e init 2024-08-06 02:12:51 +08:00