Humanoid
Run Multi-view Video Generation in DreamGen
This document provides instructions and examples on how to run multi-view video generation using the Cosmos-Predict2-Multiview model from the root directory (without cd).
Environment Setup
To run DreamGen scripts from the root directory, you must add models/dreamgen to your PYTHONPATH so that internal imports like from examples... can be resolved:
# From the root: /pfss/mlde/workspaces/mlde_wsp_IAS_SAMMerge/VLA/doanh/video_world/video_gen_physics
export PYTHONPATH=$PYTHONPATH:$(pwd)/models/dreamgen
Running the Multi-view Script
The multi-view pipeline generates 7 views with 29 frames at 720p.
Here is the command to run multi-view inference from the root directory:
torchrun --nproc_per_node=1 --master_port=12341 \
-m examples.video2world_gr00t \
--model_size 14B \
--gr00t_variant droid \
--prompt "A multi-view video shows that a robot pick the lid and put it on the pot The video is split into four views: The top-left view shows the robotic arm from the left side, the top-right view shows it from the right side, the bottom-left view shows a first-person perspective from the robot's end-effector (gripper), and the bottom-right view is a black screen (inactive view). The robot pick the lid and put it on the pot" \
--input_path models/dreamgen/assets/sample_gr00t_dreams_droid/episode_000408.png \
--prompt_prefix "" \
--num_gpus 1 \
--disable_guardrail \
--save_path output/generated_video_droid.mp4
Parameter Explanations
--model_size 2B: Uses the 2-Billion parameter multi-view checkpoint.--input_path: Path to your initial image (relative to the root).--num_conditional_frames 1: Uses only the first frame (the image) as the condition.--n_views 7: Generates 7 different camera views.--save_path: The output location for the generatedmp4video.
Multi-GPU Support
To run with Context Parallelism using multiple GPUs:
torchrun --nproc_per_node=2 --master_port=12341 \
-m examples.video2world_gr00t \
--model_size 14B \
--gr00t_variant droid \
--prompt "A multi-view video shows that a robot pick the lid and put it on the pot The video is split into four views: The top-left view shows the robotic arm from the left side, the top-right view shows it from the right side, the bottom-left view shows a first-person perspective from the robot's end-effector (gripper), and the bottom-right view is a black screen (inactive view). The robot pick the lid and put it on the pot" \
--input_path models/dreamgen/assets/sample_gr00t_dreams_droid/episode_000408.png \
--prompt_prefix "" \
--num_gpus 2 \
--disable_guardrail \
--save_path output/generated_video_droid.mp4
Đảm bảo đang ở thư mục root: /pfss/mlde/workspaces/mlde_wsp_IAS_SAMMerge/VLA/doanh/video_world/video_gen_physics
source models/DreamDojo/.venv/bin/activate export PYTHONPATH=$PYTHONPATH:$(pwd)/models/dreamgen
torchrun --nproc_per_node=2 --master_port=12341
-m examples.video2world_gr00t
--model_size 14B
--gr00t_variant droid
--prompt "A multi-view video shows that a robot picks up a pomegranate with its left hand and puts it in the storage box, then picks up a mango with its right hand and puts it in the storage box. The video is split into four views: top-left (front view), top-right (head view), bottom-left (wrist view), and bottom-right (black screen)."
--input_path models/dreamgen/airbot_multiview_input.png
--prompt_prefix ""
--num_gpus 2
--disable_guardrail
--save_path output/generated_video_airbot_droid.mp4
Chạy tất cả 6 Airbot (5 episodes mỗi bộ, FPS=10)
NUM_GPUS=1 MAX_EPISODES=0 bash scripts/run_multiview_airbot_all.sh
Hoặc override
MAX_EPISODES=3 FPS=8 bash scripts/run_multiview_airbot_all.sh
Single-arm (datasets/single_arm/multiview)
Full-batch prep + DreamGen (2×2 grid: exterior_1_left, exterior_2_left, wrist_left, black quadrant):
source models/dreamgen/.venv/bin/activate
export PYTHONPATH=$PYTHONPATH:$(pwd)/models/dreamgen
NUM_GPUS=2 bash scripts/run_single_arm_multiview_dreamgen_all.sh
One branch only (makovian or non_makovian):
DATASET_PATH=datasets/single_arm/multiview/makovian NUM_GPUS=2 \
bash scripts/run_single_arm_multiview_dreamgen_batch.sh
Pipeline chính (scripts/run_single_arm_multiview_dreamgen_batch.sh) gọi examples.video2world_gr00t và checkpoint Cosmos-Predict2-14B-Sample-GR00T-Dreams-DROID (resolve từ CHECKPOINTS_DIR trong imaginaire/constants.py). Để baseline Video2World 2B (không GR00T), ghi tmp/ — script mặc định USE_LVG=1 + NUM_CHUNKS=4 (examples.video2world_lvg, 480p/16fps khớp model-480p-16fps.pt; xem --resolution / --fps trong video2world_lvg.py):
TMP_OUT=./tmp NUM_GPUS=2 \
BATCH_JSON=./sampling_dataset/dense/single_arm/input/multiview/dreamgen/makovian/batch_input.json \
bash scripts/run_single_arm_multiview_video2world_2b_tmp.sh
NUM_CHUNKS=3 NUM_GPUS=1 bash scripts/run_single_arm_multiview_video2world_2b_tmp.sh
Một clip ngắn (không nối chunk): USE_LVG=0. Ghi đè checkpoint: DIT_PATH=.... Đây là video2world_lvg / video2world, không phải video2world_gr00t.
Độ dài video (số frame thật): examples.video2world_gr00t không có cờ --num_frames; độ dài mỗi lần sinh do checkpoint / state_t cố định (tài liệu multiview: khoảng 29 frame @ 16fps training). Để video dài hơn, dùng LVG (nối nhiều chunk):
USE_LVG=1 NUM_CHUNKS=3 NUM_GPUS=1 \
DATASET_PATH=datasets/single_arm/multiview/makovian \
bash scripts/run_single_arm_multiview_dreamgen_batch.sh
NUM_CHUNKS càng lớn → clip càng dài (tốn GPU/time hơn). --fps trên bản không-LVG chỉ đổi tốc độ phát khi encode MP4; bản LVG hiện encode nội bộ 16 fps.
Tại sao trước đây có hàng loạt [WARN] … missing video for exterior_1_left? Script cũ đi theo toàn bộ episode_index trong meta/episodes.jsonl (có thể hàng chục nghìn dòng), trong khi trên đĩa bạn chỉ có một subset file episode_XXXXXX.mp4 (dataset chưa tải đủ / chỉ giữ shard). Index kiểu 005698 nằm trong meta nhưng không có file ⇒ cảnh báo. Mặc định mới: prepare dùng --episode_source disk: chỉ lấy các episode mà đủ cả 3 camera đều có mp4 dưới videos/chunk-*/… (khoảng 128 episode trong ví dụ makovian của bạn). Prompt vẫn lấy từ meta khi trùng index; thiếu dòng meta thì fallback câu generic. Nếu cố tình muốn đi theo đúng meta và chấp nhận skip + warn: EPISODE_SOURCE=meta.
Gợi ý cũ (MIN_EPISODE_INDEX) vẫn dùng được để giới hạn dải index sau khi đã lọc theo disk:
MAX_EPISODES=50 MIN_EPISODE_INDEX=1000 NUM_GPUS=2 \
DATASET_PATH=datasets/single_arm/multiview/makovian \
bash scripts/run_single_arm_multiview_dreamgen_batch.sh
Output mặc định: sampling_dataset/dense/single_arm/input/multiview/dreamgen/<category>/ (grid PNG + batch_input.json) và sampling_dataset/dense/single_arm/output/multiview/dreamgen/<category>/ (mp4). Thư mục dense/ là tuyến video chuẩn (full steps); sau này có thể thêm các tuyến khác (vd. video tăng tốc / sparse) cạnh dense/ — xem skill sampling-dataset-structure.
Bimanual
Aloha_robot
DreamGen batch (2×2 grid, droid variant)
LeRobot tasks live under datasets/bimanual/multiview/{makovian,non_makovian}/<task>/.
Grid inputs and batch_input.json are written to sampling_dataset/bimanual/input/multiview/dreamgen/<category>/<task>/.
Generated videos default to sampling_dataset/bimanual/output/multiview/dreamgen/<category>/<task>/.
Prepare only (3 static+dynamic slots: high, low, left wrist + black quadrant):
python scripts/prepare_bimanual_multiview_dreamgen_batch.py \
--dataset_path datasets/bimanual/multiview/makovian/close_toolbox
Four live views (high, low, left wrist, right wrist):
python scripts/prepare_bimanual_multiview_dreamgen_batch.py \
--dataset_path /pfss/mlde/workspaces/mlde_wsp_IAS_SAMMerge/VLA/doanh/video_world/video_gen_physics/datasets/bimanual/multiview/non_makovian/fold_bath_towel \
--four_views
Single-task prepare + inference:
source models/DreamDojo/.venv/bin/activate
export PYTHONPATH=$PYTHONPATH:$(pwd)/models/dreamgen
DATASET_PATH=datasets/bimanual/multiview/makovian/close_toolbox \
bash scripts/run_bimanual_multiview_dreamgen_batch.sh
source models/dreamgen/.venv/bin/activate
export PYTHONPATH=$PYTHONPATH:$(pwd)/models/dreamgen
DATASET_PATH=datasets/bimanual/multiview/non_makovian/fold_bath_towel \
bash scripts/run_bimanual_multiview_dreamgen_batch.sh
Tự động toàn bộ task
Script scripts/run_bimanual_multiview_dreamgen_all.sh lần lượt xử lý mọi thư mục task có meta/episodes.jsonl dưới datasets/bimanual/multiview/makovian/* và .../non_makovian/* (thứ tự tên thư mục). Mỗi task: (1) tạo lưới + batch_input.json dưới sampling_dataset/bimanual/input/multiview/dreamgen/<category>/<task>/, (2) chạy DreamGen lên batch đó.
Từ root repo (đã có venv trong script):
# Cả makovian + non_makovian, infer toàn episode, 2 GPU
NUM_GPUS=2 bash scripts/run_bimanual_multiview_dreamgen_all.sh
# Chỉ một nhánh
CATEGORY=makovian NUM_GPUS=2 bash scripts/run_bimanual_multiview_dreamgen_all.sh
# Bốn ô camera (không ô đen)
FOUR_VIEWS=1 NUM_GPUS=2 bash scripts/run_bimanual_multiview_dreamgen_all.sh
# Chỉ chuẩn bị batch + PNG (ffmpeg), không cần GPU — chạy infer sau
PREPARE_ONLY=1 bash scripts/run_bimanual_multiview_dreamgen_all.sh
# Batch đã có sẵn: chỉ infer
SKIP_PREPARE=1 NUM_GPUS=2 bash scripts/run_bimanual_multiview_dreamgen_all.sh
# Giới hạn episode mỗi task (test nhanh)
MAX_EPISODES=3 NUM_GPUS=1 bash scripts/run_bimanual_multiview_dreamgen_all.sh
Biến môi trường khác: MULTIVIEW_ROOT, INPUT_DIR, OUTPUT_DIR_ROOT (ghi đè thư mục video ra), DYNAMIC_WRIST, MODEL_SIZE, MASTER_PORT, FPS.