Skip to content

Commit fddffb1

Browse files
fearblackcatshenjun
authored andcommitted
add motus to loongforge vla
Change-Id: I8b7d9541e7b41f5d73b3a0fc6b719918b08cd03b
1 parent a17058e commit fddffb1

76 files changed

Lines changed: 17204 additions & 15 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

configs/models/embodied/motus.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Motus VLA (WAN video + Qwen3-VL + Action Expert three-modal MoT) embodied config.
2+
# Values mirror the source repo configs/lerobot.yaml (model + dataset sections).
3+
model:
4+
model_type: motus
5+
6+
# WAN video backbone
7+
wan_config_path: "/workspace/motus/models/hf/Wan2.2-TI2V-5B"
8+
wan_checkpoint_path: "/workspace/motus/models/hf/Wan2.2-TI2V-5B"
9+
vae_path: "/workspace/motus/models/hf/Wan2.2-TI2V-5B/Wan2.2_VAE.pth"
10+
video_precision: bfloat16
11+
12+
# VLM (frozen)
13+
vlm_checkpoint_path: "/workspace/motus/models/hf/Qwen3-VL-2B-Instruct"
14+
vlm_precision: bfloat16
15+
16+
# Task dimensions (shared with data side)
17+
action_dim: 14
18+
state_dim: 14
19+
20+
# Action expert
21+
action_expert_hidden_size: 1024
22+
action_expert_ffn_dim_multiplier: 4
23+
action_expert_norm_eps: 1.0e-5
24+
25+
# Understanding expert
26+
und_expert_hidden_size: 512
27+
und_expert_ffn_dim_multiplier: 4
28+
und_expert_norm_eps: 1.0e-5
29+
vlm_adapter_input_dim: 2048
30+
vlm_adapter_projector_type: mlp3x_silu
31+
32+
# MoT backbone depth
33+
num_layers: 30
34+
35+
# Video / sampling geometry (shared with data side)
36+
num_video_frames: 8
37+
video_action_freq_ratio: 6
38+
global_downsample_rate: 1
39+
video_height: 384
40+
video_width: 320
41+
42+
# Loss weights
43+
video_loss_weight: 1.0
44+
action_loss_weight: 1.0
45+
46+
# Training mode / switches
47+
training_mode: finetune
48+
load_pretrained_backbones: null
49+
50+
data:
51+
# LeRobot dataset location
52+
repo_id: "/workspace/motus/data/aloha_mobile_cabinet"
53+
root: "/workspace/motus/data/aloha_mobile_cabinet"
54+
55+
# Task selection
56+
task_mode: single
57+
task_name: null
58+
max_episodes: null
59+
image_aug: false
60+
61+
# Normalization / embodiment
62+
embodiment_type: aloha_agilex_2
63+
64+
# Video decoding
65+
video_backend: torchcodec
66+
67+
# T5 language embedding (on-the-fly encode + cache fallback)
68+
enable_t5_fallback: true
69+
t5_wan_path: "/workspace/motus/models/hf/Wan2.2-TI2V-5B/"
70+
t5_folder_name: t5_embedding
71+
t5_text_len: 512
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#!/usr/bin/env python3
2+
# Copyright 2026 The LoongForge Authors.
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# Modified from https://github.com/thu-ml/Motus under the Apache-2.0 License.
6+
#
7+
# Licensed under the Apache License, Version 2.0 (the "License");
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
19+
"""Online-vs-online VAE-input parity check (DATA link).
20+
21+
Compares the LATENT_DUMP dumps of TWO separate online training runs (both
22+
launched with the SAME PARITY_DATA_SEED so the sampler visits identical anchors
23+
in identical order). For each matching rankR_stepN.pt it bit-compares:
24+
25+
- first_frame (decode + normalization + H2D)
26+
- video_frames (decode + normalization + H2D)
27+
- clean_full_latent (end-to-end: data + VAE compute)
28+
29+
A `torch.equal` pass on first_frame / video_frames proves the data pipeline
30+
(torchcodec decode + transform + collate) is bit-deterministic ACROSS PROCESSES
31+
-- i.e. re-fetching the same (episode, condition_frame) anchor in the offline
32+
precompute will get the exact same input pixels. Combined with
33+
verify_offline_latents.py (compute link), a pass on both scripts means the
34+
offline latent cache is end-to-end bit-identical to the online encode.
35+
36+
Usage
37+
-----
38+
python examples/embodied/motus/diff_online_dumps.py \
39+
--dir-a /tmp/latent_dump_run1 --dir-b /tmp/latent_dump_run2
40+
"""
41+
from __future__ import annotations
42+
43+
import argparse
44+
import glob
45+
import os
46+
47+
import torch
48+
49+
50+
def _cmp(a: torch.Tensor, b: torch.Tensor) -> str:
51+
if a.shape != b.shape:
52+
return f"SHAPE-MISMATCH {tuple(a.shape)} vs {tuple(b.shape)}"
53+
if torch.equal(a, b):
54+
return "equal"
55+
diff = (a.float() - b.float()).abs().max().item()
56+
return f"DIFFERS max|abs|={diff:.3e}"
57+
58+
59+
def main() -> int:
60+
ap = argparse.ArgumentParser()
61+
ap.add_argument("--dir-a", required=True, help="dump dir of online run #1")
62+
ap.add_argument("--dir-b", required=True, help="dump dir of online run #2")
63+
args = ap.parse_args()
64+
65+
files_a = sorted(glob.glob(os.path.join(args.dir_a, "rank*_step*.pt")))
66+
if not files_a:
67+
print(f"[FAIL] no dumps in {args.dir_a}")
68+
return 2
69+
70+
all_ok = True
71+
for fa in files_a:
72+
name = os.path.basename(fa)
73+
fb = os.path.join(args.dir_b, name)
74+
if not os.path.exists(fb):
75+
print(f"{name}: MISSING in dir-b")
76+
all_ok = False
77+
continue
78+
da = torch.load(fa, map_location="cpu")
79+
db = torch.load(fb, map_location="cpu")
80+
ff = _cmp(da["first_frame"], db["first_frame"])
81+
vf = _cmp(da["video_frames"], db["video_frames"])
82+
lat = _cmp(da["clean_full_latent"], db["clean_full_latent"])
83+
ok = ff == "equal" and vf == "equal"
84+
all_ok = all_ok and ok
85+
print(f"{name}: first_frame={ff} | video_frames={vf} | latent={lat}")
86+
87+
print()
88+
if all_ok:
89+
print("[PASS] data pipeline is bit-deterministic across processes.")
90+
print(" -> offline precompute will get identical VAE inputs per anchor.")
91+
return 0
92+
print("[WARN] VAE inputs differ across runs -> decode/transform is not")
93+
print(" cross-process deterministic; offline cache keys must pin the")
94+
print(" exact decoded frames (store inputs, not just anchor ids).")
95+
return 1
96+
97+
98+
if __name__ == "__main__":
99+
raise SystemExit(main())

0 commit comments

Comments
 (0)