ManiacWallnut commited on
Commit
e4b60ff
Β·
verified Β·
1 Parent(s): 9ee6f68

Deploy ManiTaskGen VLM-free Gradio demo

Browse files
demo/requirements.txt CHANGED
@@ -13,11 +13,12 @@ setuptools<81
13
 
14
  # ManiTaskGen core (scene parsing, scene graph, task generation)
15
  sapien==3.0.0b1
16
- trimesh>=3.9.0,<5
17
  scipy>=1.7.0
18
  shapely==2.0.6
19
  rtree>=1.0.0
20
  transforms3d==0.4.2
 
21
  sympy
22
  glog>=0.3.1
23
  colorama
 
13
 
14
  # ManiTaskGen core (scene parsing, scene graph, task generation)
15
  sapien==3.0.0b1
16
+ trimesh==4.5.2 # 4.12+ removes remove_duplicate_faces used by scene_parser
17
  scipy>=1.7.0
18
  shapely==2.0.6
19
  rtree>=1.0.0
20
  transforms3d==0.4.2
21
+ manifold3d>=3.0,<4 # used by trimesh mesh repair on stage GLBs
22
  sympy
23
  glog>=0.3.1
24
  colorama
requirements.txt CHANGED
@@ -14,11 +14,12 @@ setuptools<81
14
 
15
  # Core task-generation stack (scene parsing, scene graph, task generation)
16
  sapien==3.0.0b1
17
- trimesh>=3.9.0,<5
18
  scipy>=1.7.0
19
  shapely==2.0.6
20
  rtree>=1.0.0
21
  transforms3d==0.4.2
 
22
  sympy
23
  glog>=0.3.1
24
  colorama
 
14
 
15
  # Core task-generation stack (scene parsing, scene graph, task generation)
16
  sapien==3.0.0b1
17
+ trimesh==4.5.2 # 4.12+ removes remove_duplicate_faces used by scene_parser
18
  scipy>=1.7.0
19
  shapely==2.0.6
20
  rtree>=1.0.0
21
  transforms3d==0.4.2
22
+ manifold3d>=3.0,<4 # used by trimesh mesh repair on stage GLBs
23
  sympy
24
  glog>=0.3.1
25
  colorama
scripts/build_ai2thor_scene_zip.py ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Build an uploadable scene pack (scene.zip) for an AI2THOR (HSSD) scene from the
3
+ local ManiSkill-style dataset:
4
+
5
+ data/datasets/ai2thor/ai2thor-hab # stages + scene configs
6
+ data/datasets/ai2thor/ai2thorhab-uncompressed # uncompressed object GLBs + configs
7
+
8
+ The pack uses the same layout as the demo's example_scene.zip / ReplicaCAD
9
+ packs (which is what the demo's upload pipeline expects):
10
+
11
+ <scene>.zip
12
+ β”œβ”€β”€ configs/scenes/<scene>.scene_instance.json
13
+ β”œβ”€β”€ configs/objects/<template>.object_config.json (render_asset rewritten)
14
+ β”œβ”€β”€ objects/<template>.glb (uncompressed GLBs)
15
+ └── stages/iTHOR/<scene>.glb (from ai2thor-hab)
16
+
17
+ Usage (from the repository root):
18
+ python scripts/build_ai2thor_scene_zip.py --scene iTHOR/FloorPlan1_physics
19
+ python scripts/build_ai2thor_scene_zip.py --list
20
+ """
21
+
22
+ import argparse
23
+ import json
24
+ import os
25
+ import sys
26
+ import zipfile
27
+
28
+ REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
29
+ HAB_ROOT = os.path.join(REPO_ROOT, "data", "datasets", "ai2thor", "ai2thor-hab")
30
+ UNCOMP_ROOT = os.path.join(
31
+ REPO_ROOT, "data", "datasets", "ai2thor", "ai2thorhab-uncompressed"
32
+ )
33
+ SCENES_DIR = os.path.join(HAB_ROOT, "configs", "scenes")
34
+ DEFAULT_OUT_DIR = os.path.join(REPO_ROOT, "output")
35
+
36
+
37
+ def list_scenes():
38
+ found = []
39
+ for series in sorted(os.listdir(SCENES_DIR)):
40
+ sdir = os.path.join(SCENES_DIR, series)
41
+ if not os.path.isdir(sdir):
42
+ continue
43
+ for name in sorted(os.listdir(sdir)):
44
+ if name.endswith(".scene_instance.json"):
45
+ found.append(f"{series}/{name[: -len('.scene_instance.json')]}")
46
+ return found
47
+
48
+
49
+ def build(scene_id: str, out_path: str) -> None:
50
+ entry_rel = f"configs/scenes/{scene_id}.scene_instance.json"
51
+ entry_path = os.path.join(HAB_ROOT, entry_rel)
52
+ if not os.path.isfile(entry_path):
53
+ raise SystemExit(f"Scene instance not found: {entry_path}")
54
+
55
+ with open(entry_path) as f:
56
+ scene = json.load(f)
57
+
58
+ stage_template = scene["stage_instance"]["template_name"]
59
+ stage_glb_src = os.path.join(HAB_ROOT, "assets", f"{stage_template}.glb")
60
+ if not os.path.isfile(stage_glb_src):
61
+ raise SystemExit(f"Stage GLB not found: {stage_glb_src}")
62
+
63
+ objects = scene.get("object_instances", [])
64
+ print(f"scene {scene_id}: stage='{stage_template}', {len(objects)} objects")
65
+
66
+ collected = {} # arcname -> src path
67
+ missing = []
68
+ seen = set()
69
+ for obj in objects:
70
+ template = (obj.get("template_name") or "").split("/")[-1]
71
+ if template in seen:
72
+ continue
73
+ seen.add(template)
74
+ cfg_src = os.path.join(
75
+ UNCOMP_ROOT, "configs", "objects", f"{template}.object_config.json"
76
+ )
77
+ if not os.path.isfile(cfg_src):
78
+ missing.append(f"configs/objects/{template}.object_config.json")
79
+ continue
80
+ with open(cfg_src) as f:
81
+ cfg = json.load(f)
82
+ asset = cfg.get("render_asset")
83
+ if not asset:
84
+ missing.append(f"{template}: no render_asset")
85
+ continue
86
+ glb_src = os.path.normpath(
87
+ os.path.join(os.path.dirname(cfg_src), asset)
88
+ )
89
+ if not os.path.isfile(glb_src):
90
+ missing.append(f"{template}: GLB {asset}")
91
+ continue
92
+ collected[f"configs/objects/{template}.object_config.json"] = ("cfg", cfg_src)
93
+ collected[f"objects/{template}.glb"] = ("glb", glb_src)
94
+
95
+ if missing:
96
+ print("Missing (skipped):")
97
+ for m in missing[:15]:
98
+ print(f" - {m}")
99
+ if len(missing) > 15:
100
+ print(f" ... and {len(missing) - 15} more")
101
+
102
+ # zip layout: stage keeps its habitat-relative path under the pack root,
103
+ # objects go under objects/, configs rewritten to ../../objects/<t>.glb
104
+ os.makedirs(os.path.dirname(os.path.abspath(out_path)), exist_ok=True)
105
+ with zipfile.ZipFile(out_path, "w", zipfile.ZIP_DEFLATED) as zf:
106
+ zf.writestr(f"configs/scenes/{scene_id}.scene_instance.json",
107
+ json.dumps(scene, indent=2))
108
+ zf.write(stage_glb_src, arcname=f"{stage_template}.glb")
109
+ for arcname, (kind, src) in sorted(collected.items()):
110
+ if kind == "glb":
111
+ zf.write(src, arcname=arcname)
112
+ else:
113
+ template = os.path.basename(arcname)[: -len(".object_config.json")]
114
+ cfg = json.load(open(src))
115
+ cfg["render_asset"] = f"../../objects/{template}.glb"
116
+ cfg.pop("collision_asset", None)
117
+ zf.writestr(arcname, json.dumps(cfg, indent=2))
118
+
119
+ size_mb = os.path.getsize(out_path) / 1e6
120
+ n = 1 + len(collected) // 2
121
+ print(f"Wrote {out_path} ({size_mb:.1f} MB, stage + {n} objects)")
122
+
123
+
124
+ def main():
125
+ parser = argparse.ArgumentParser()
126
+ parser.add_argument("--scene", help="e.g. iTHOR/FloorPlan1_physics")
127
+ parser.add_argument(
128
+ "--out", default=None,
129
+ help="output zip path (default output/ai2thor_<name>.zip)",
130
+ )
131
+ parser.add_argument("--list", action="store_true", help="list local scenes")
132
+ args = parser.parse_args()
133
+
134
+ if args.list:
135
+ for s in list_scenes():
136
+ print(s)
137
+ return
138
+ if not args.scene:
139
+ parser.error("--scene or --list required")
140
+ out = args.out or os.path.join(
141
+ DEFAULT_OUT_DIR, f"ai2thor_{os.path.basename(args.scene)}.zip"
142
+ )
143
+ build(args.scene, out)
144
+
145
+
146
+ if __name__ == "__main__":
147
+ sys.exit(main())