purplehihi commited on
Commit
c686331
·
verified ·
1 Parent(s): b5fcc49

Upload JanusVLN code with parquet training support

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. LoRA/README.md +209 -0
  3. LoRA/argument_lora.py +60 -0
  4. LoRA/lora_config.env.example +29 -0
  5. LoRA/train_lora.sh +110 -0
  6. LoRA/train_lora_parquet.sh +13 -0
  7. LoRA/train_qwen_lora.py +262 -0
  8. LoRA/zero2_lora.json +24 -0
  9. PARQUET_AND_ORIGINAL_TRAINING_USAGE.md +291 -0
  10. README.md +253 -0
  11. __init__.py +0 -0
  12. assets/__init__.py +0 -0
  13. assets/logo.png +3 -0
  14. assets/overview.jpg +3 -0
  15. config/vln_dagger.yaml +58 -0
  16. config/vln_r2r.yaml +56 -0
  17. create_data/create_data.py +335 -0
  18. create_data/create_data_parquet.py +464 -0
  19. data/trajectory_data/generate_parquet_manifest.py +158 -0
  20. data/trajectory_data/img2parquet.py +126 -0
  21. data/trajectory_data/merge_parquet_shards.py +161 -0
  22. data/trajectory_data/split_parquet_shards.py +148 -0
  23. habitat-lab/.circleci/config.yml +454 -0
  24. habitat-lab/.editorconfig +22 -0
  25. habitat-lab/.github/ISSUE_TEMPLATE/bug-report.md +41 -0
  26. habitat-lab/.github/ISSUE_TEMPLATE/feature-request.md +24 -0
  27. habitat-lab/.github/ISSUE_TEMPLATE/questions-help-support.md +23 -0
  28. habitat-lab/.github/PULL_REQUEST_TEMPLATE.md +29 -0
  29. habitat-lab/.gitignore +102 -0
  30. habitat-lab/.pre-commit-config.yaml +113 -0
  31. habitat-lab/CODE_OF_CONDUCT.md +5 -0
  32. habitat-lab/CONTRIBUTING.md +70 -0
  33. habitat-lab/DATASETS.md +36 -0
  34. habitat-lab/DETAILS.md +21 -0
  35. habitat-lab/Dockerfile +53 -0
  36. habitat-lab/LICENSE +21 -0
  37. habitat-lab/README.md +202 -0
  38. habitat-lab/docs/.gitignore +1 -0
  39. habitat-lab/docs/build-public.sh +32 -0
  40. habitat-lab/docs/build.sh +42 -0
  41. habitat-lab/docs/conf-public.py +38 -0
  42. habitat-lab/docs/conf.py +127 -0
  43. habitat-lab/docs/docs.rst +15 -0
  44. habitat-lab/docs/images/habitat-lab-demo-images/habitat-lab-demo.png +3 -0
  45. habitat-lab/docs/images/habitat-lab-tdmap-viz-images/pointnav_target_image.png +3 -0
  46. habitat-lab/docs/images/habitat-lab-tdmap-viz-images/pointnav_target_image_edge_1.png +3 -0
  47. habitat-lab/docs/images/habitat-lab-tdmap-viz-images/pointnav_target_image_edge_2.png +3 -0
  48. habitat-lab/docs/images/habitat-lab-tdmap-viz-images/pointnav_target_image_edge_3.png +3 -0
  49. habitat-lab/docs/images/habitat-lab-tdmap-viz-images/pointnav_target_image_edge_4.png +3 -0
  50. habitat-lab/docs/images/habitat-lab-tdmap-viz-images/skokloster-castle.glb_3662.gif +3 -0
.gitattributes CHANGED
@@ -58,3 +58,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
61
+ train_r2r_rxr_parquet.json filter=lfs diff=lfs merge=lfs -text
LoRA/README.md ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # JanusVLN LoRA 训练说明
2
+
3
+ 本目录提供一套可直接运行的 LoRA 微调方案,目标是把 JanusVLN 的 VLM 从全量微调改成参数高效微调,显著降低显存占用。
4
+
5
+ 本方案是**目录隔离实现**:
6
+ - 不改动原有全量微调入口(`src/qwen_vl/train/train_qwen.py` 与 `src/qwen_vl/train/argument.py`)。
7
+ - LoRA 所需逻辑全部放在 `LoRA/` 目录。
8
+
9
+ ## 文件说明
10
+
11
+ - `LoRA/train_lora.sh`
12
+ - 一键训练脚本。
13
+ - 默认策略:冻结 VGGT,冻结 VLM 主干参数,只训练 LoRA Adapter,并继续训练 JanusVLN 特有的 `merger`(可关)。
14
+ - 会优先读取 `LoRA/lora_config.env`(若存在),也支持命令行临时环境变量覆盖。
15
+
16
+ - `LoRA/train_qwen_lora.py`
17
+ - LoRA 专用训练入口。
18
+ - 基于原训练流程复用数据管道与模型加载,但仅在此文件里执行 LoRA 注入(PEFT)。
19
+ - 训练完成后自动导出 `output_dir/lora_adapter/`。
20
+
21
+ - `LoRA/argument_lora.py`
22
+ - LoRA 专用参数定义。
23
+ - 在原参数基础上增加 LoRA 参数(`lora_r`、`lora_alpha`、`lora_dropout`、`lora_target_modules` 等)。
24
+
25
+ - `LoRA/lora_config.env.example`
26
+ - LoRA 配置模板(推荐复制为 `LoRA/lora_config.env` 后修改)。
27
+ - 集中管理精度、batch size、学习率、LoRA 超参。
28
+
29
+ - `LoRA/zero2_lora.json`
30
+ - DeepSpeed ZeRO-2 配置。
31
+ - 相比 ZeRO-3,ZeRO-2 在 LoRA 场景更简单稳定,通信与保存开销更低,适合先快速跑通。
32
+
33
+ - `output_dir/lora_adapter/`(训练后自动生成)
34
+ - 仅保存 LoRA adapter 权重与 tokenizer/processor。
35
+ - 用于轻量部署或与基座模型合并。
36
+
37
+ ## 和全量微调的核心差别
38
+
39
+ 1. 可训练参数规模
40
+ - 全量微调:更新 LLM 全部参数,参数量最大。
41
+ - LoRA 微调:仅更新低秩矩阵(以及你显式开启的模块),参数量通常降到全量的 <1%-5%。
42
+
43
+ 2. 显存占用
44
+ - 全量微调:优化器状态 + 梯度 + 参数副本占用高。
45
+ - LoRA 微调:只为少量可训练参数维护优化器状态,显存通常显著下降。
46
+
47
+ 3. 训练速度
48
+ - LoRA 常见情况是单步更快或相当;如果总步数不变,wall-time 往往更友好。
49
+
50
+ 4. 模型效果
51
+ - 全量微调上限通常更高,尤其当数据域偏移很大时。
52
+ - LoRA 在中小数据场景经常具备更好的性价比;若 rank 配置过小,可能上限受限。
53
+
54
+ ## 如何启动
55
+
56
+ 在项目根目录执行:
57
+
58
+ ```bash
59
+ chmod +x LoRA/train_lora.sh
60
+ ./LoRA/train_lora.sh
61
+ ```
62
+
63
+ 如果需要固定配置,先复制模板:
64
+
65
+ ```bash
66
+ cp LoRA/lora_config.env.example LoRA/lora_config.env
67
+ # 然后按你的 GPU 与任务修改 LoRA/lora_config.env
68
+ ./LoRA/train_lora.sh
69
+ ```
70
+
71
+ 也可按需覆盖参数:
72
+
73
+ ```bash
74
+ MODEL_PATH=Qwen/Qwen2.5-VL-7B-Instruct \
75
+ OUTPUT_DIR=./JanusVLN_LoRA_Base_r32 \
76
+ LORA_R=32 \
77
+ LORA_ALPHA=64 \
78
+ LORA_DROPOUT=0.05 \
79
+ PER_DEVICE_BATCH_SIZE=1 \
80
+ GRAD_ACC_STEPS=8 \
81
+ LEARNING_RATE=1e-4 \
82
+ ./LoRA/train_lora.sh
83
+ ```
84
+
85
+ 训练日志:`$OUTPUT_DIR/train_lora.log`。
86
+
87
+ ## LoRA/训练配置可选项与影响
88
+
89
+ 以下均可在执行前通过环境变量覆盖。
90
+
91
+ ### 1) LoRA 结构相关
92
+
93
+ - `LORA_R`(默认 `16`)
94
+ - 作用:低秩分解的秩,决定 LoRA 容量。
95
+ - 显存影响:`r` 越大,显存与优化器开销线性上升。
96
+ - 性能影响:`r` 越大通常上限更高;过小可能欠拟合。
97
+ - 建议:`8/16/32` 先做网格试验。
98
+
99
+ - `LORA_ALPHA`(默认 `32`)
100
+ - 作用:LoRA 缩放系数(有效更新幅度约与 `alpha/r` 相关)。
101
+ - 显存影响:几乎无直接影响。
102
+ - 性能影响:过小学习慢,过大可能不稳定。
103
+ - 建议:常用配比 `alpha=2r` 或 `alpha=r`。
104
+
105
+ - `LORA_DROPOUT`(默认 `0.05`)
106
+ - 作用:LoRA 分支 dropout。
107
+ - 显存影响:几乎无。
108
+ - 性能影响:
109
+ - 小数据集:适当增大(0.05-0.1)可抗过拟合。
110
+ - 大数据集:可减小到 0-0.05 提升拟合。
111
+
112
+ - `LORA_TARGET_MODULES`
113
+ - 默认:`q_proj,k_proj,v_proj,o_proj,gate_proj,up_proj,down_proj`
114
+ - 作用:指定在哪些线性层挂 LoRA。
115
+ - 显存影响:目标层越多,显存越高。
116
+ - 性能影响:
117
+ - 仅注意力(q/k/v/o):更省显存、效果稳定。
118
+ - 加 MLP(gate/up/down):适配能力更强,但显存与过拟合风险上升。
119
+
120
+ ### 2) 精度相关
121
+
122
+ - `--bf16`(脚本默认开启)
123
+ - 作用:bfloat16 训练。
124
+ - 显存影响:低于 fp32;通常与 fp16 相近。
125
+ - 稳定性:通常比 fp16 更稳(需硬件支持 BF16)。
126
+
127
+ - 若显卡不支持 BF16
128
+ - 可改成 fp16(需要修改脚本中的 `--bf16` 参数策略)。
129
+ - 经验上:fp16 可能更容易出现数值不稳定,需要配合 loss scale。
130
+
131
+ ### 3) Batch 与梯度累积
132
+
133
+ - `PER_DEVICE_BATCH_SIZE`(默认 `1`)
134
+ - 显存影响:最敏感,线性增长。
135
+ - 性能影响:太小会增大梯度噪声;太大可能 OOM。
136
+
137
+ - `GRAD_ACC_STEPS`(默认 `8`)
138
+ - 作用:在不增加显存的前提下增大全局 batch。
139
+ - 显存影响:基本不增加激活显存。
140
+ - 性能影响:更稳定,但 step 时间变长。
141
+
142
+ - 全局 batch 计算
143
+ - `global_batch = PER_DEVICE_BATCH_SIZE * GRAD_ACC_STEPS * GPU_NUM`
144
+
145
+ ### 4) 学习率相关
146
+
147
+ - `LEARNING_RATE`(默认 `2e-4`,LoRA 常用较大全局 LR)
148
+ - 性能影响:
149
+ - 过大:震荡或遗忘。
150
+ - 过小:收敛慢、欠拟合。
151
+ - 建议:LoRA 先试 `1e-4 ~ 3e-4`。
152
+
153
+ - `MM_PROJECTOR_LR`(默认 `1e-5`)
154
+ - 作用:给 Janus 的 projector/merger 分组学习率。
155
+ - 影响:适度提高可加快跨模态对齐,但过大会破坏已有能力。
156
+
157
+ - `VISION_TOWER_LR`(默认 `1e-6`)
158
+ - 当前脚本 `--tune_mm_vision False`,实际不更新视觉主干,通常影响有限。
159
+
160
+ ### 5) 是否训练 Janus 特有模块
161
+
162
+ - 脚本默认 `--lora_train_merger True`
163
+ - 作用:除 LoRA 外继续训练 Janus 的 `merger`。
164
+ - 显存影响:小幅增加。
165
+ - 性能影响:通常对 VLN 任务更友好(保留任务特化能力)。
166
+
167
+ - `--lora_train_lm_head False`(默认)
168
+ - 作用:默认不训练 `lm_head`,更稳更省。
169
+ - 何时开启:数据规模较大且词表分布变化明显时可尝试开启。
170
+
171
+ ## 常见显存-性能策略
172
+
173
+ 1. 24GB 单卡优先跑通
174
+ - `LORA_R=8`
175
+ - 仅注意力层:`LORA_TARGET_MODULES=q_proj,k_proj,v_proj,o_proj`
176
+ - `PER_DEVICE_BATCH_SIZE=1`
177
+ - `GRAD_ACC_STEPS=16`
178
+
179
+ 2. 多卡追求更高上限
180
+ - `LORA_R=16 or 32`
181
+ - 注意力+MLP 全开
182
+ - 在稳定前提下提高 `global_batch`
183
+
184
+ 3. 数据少、过拟合明显
185
+ - 提高 `LORA_DROPOUT` 到 `0.1`
186
+ - 减小 `LORA_R`
187
+ - 缩短 epoch 或增加早停
188
+
189
+ ## 代码改动摘要(为了让脚本可执行)
190
+
191
+ 为支持本目录脚本,LoRA 功能全部在 `LoRA/` 目录独立实现:
192
+
193
+ - `LoRA/argument_lora.py`
194
+ - 定义 LoRA 专用训练参数。
195
+
196
+ - `LoRA/train_qwen_lora.py`
197
+ - 注入 LoRA 并执行训练。
198
+ - 导出 `lora_adapter`。
199
+
200
+ - `LoRA/train_lora.sh`
201
+ - 统一读取配置并启动分布式训练。
202
+
203
+ 原全量微调入口保持不变,可继续使用原脚本直接跑全量训练。
204
+
205
+ ## 与全量微调如何选
206
+
207
+ - 显存受限、需要快速迭代:优先 LoRA。
208
+ - 训练数据非常大且追求绝对上限:可考虑全量微调。
209
+ - 实务建议:先 LoRA 验证数据与任务配置,再决定是否做全量微调。
LoRA/argument_lora.py ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import transformers
2
+ from dataclasses import dataclass, field
3
+ from typing import Optional
4
+
5
+
6
+ @dataclass
7
+ class ModelArguments:
8
+ model_name_or_path: Optional[str] = field(default="Qwen/Qwen2.5-VL-3B-Instruct")
9
+ tune_mm_llm: bool = field(default=False)
10
+ tune_mm_mlp: bool = field(default=False)
11
+ tune_mm_vision: bool = field(default=False)
12
+
13
+ # LoRA-specific arguments.
14
+ use_lora: bool = field(default=True)
15
+ lora_r: int = field(default=16)
16
+ lora_alpha: int = field(default=32)
17
+ lora_dropout: float = field(default=0.05)
18
+ lora_target_modules: str = field(
19
+ default="q_proj,k_proj,v_proj,o_proj,gate_proj,up_proj,down_proj"
20
+ )
21
+ lora_bias: str = field(default="none")
22
+ lora_task_type: str = field(default="CAUSAL_LM")
23
+ lora_modules_to_save: str = field(default="")
24
+ lora_train_merger: bool = field(default=True)
25
+ lora_train_lm_head: bool = field(default=False)
26
+
27
+ vggt_model_path: str = field(default="facebook/VGGT-1B/")
28
+ lam: float = field(default=0.2)
29
+ distill_loss_weight: float = field(default=1.0)
30
+ reference_frame: str = field(default="last")
31
+
32
+
33
+ @dataclass
34
+ class DataArguments:
35
+ dataset_use: str = field(default="")
36
+ video_max_frames: Optional[int] = field(default=8)
37
+ video_min_frames: Optional[int] = field(default=4)
38
+ data_flatten: bool = field(default=False)
39
+ base_interval: int = field(default=2)
40
+ max_pixels: int = field(default=28 * 28 * 576)
41
+ min_pixels: int = field(default=28 * 28 * 16)
42
+ video_max_frame_pixels: int = field(default=32 * 28 * 28)
43
+ video_min_frame_pixels: int = field(default=4 * 28 * 28)
44
+ max_samples: int = field(default=-1)
45
+ shuffle: bool = field(default=True)
46
+
47
+
48
+ @dataclass
49
+ class TrainingArguments(transformers.TrainingArguments):
50
+ cache_dir: Optional[str] = field(default=None)
51
+ optim: str = field(default="adamw_torch")
52
+ model_max_length: int = field(
53
+ default=512,
54
+ metadata={
55
+ "help": "Maximum sequence length. Sequences will be right padded (and possibly truncated)."
56
+ },
57
+ )
58
+ mm_projector_lr: Optional[float] = None
59
+ vision_tower_lr: Optional[float] = None
60
+ group_by_modality_length: bool = field(default=False)
LoRA/lora_config.env.example ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copy this file to LoRA/lora_config.env and edit as needed.
2
+
3
+ # Distributed settings
4
+ MASTER_ADDR=127.0.0.1
5
+ # MASTER_PORT is optional; train_lora.sh will auto-pick a random free-ish port if not set.
6
+ # MASTER_PORT=24567
7
+ # NPROC_PER_NODE is optional; by default, number of visible GPUs from nvidia-smi is used.
8
+ # NPROC_PER_NODE=4
9
+
10
+ # Model/data/output
11
+ MODEL_PATH=Qwen/Qwen2.5-VL-7B-Instruct
12
+ VGGT_MODEL_PATH=facebook/VGGT-1B
13
+ OUTPUT_DIR=./JanusVLN_LoRA_Base
14
+ CACHE_DIR=./cache
15
+ DATASETS=train_r2r_rxr
16
+
17
+ # LoRA core settings
18
+ LORA_R=16
19
+ LORA_ALPHA=32
20
+ LORA_DROPOUT=0.05
21
+ LORA_TARGET_MODULES=q_proj,k_proj,v_proj,o_proj,gate_proj,up_proj,down_proj
22
+
23
+ # Training settings
24
+ # If GPU memory is tight, keep PER_DEVICE_BATCH_SIZE=1 and increase GRAD_ACC_STEPS.
25
+ PER_DEVICE_BATCH_SIZE=1
26
+ GRAD_ACC_STEPS=8
27
+ LEARNING_RATE=2e-4
28
+ MM_PROJECTOR_LR=1e-5
29
+ VISION_TOWER_LR=1e-6
LoRA/train_lora.sh ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+
4
+ # Run from project root regardless of where the script is invoked.
5
+ cd "$(dirname "$0")/.."
6
+
7
+ # Optional user config. Copy LoRA/lora_config.env.example to LoRA/lora_config.env and edit values.
8
+ if [[ -f "LoRA/lora_config.env" ]]; then
9
+ # shellcheck disable=SC1091
10
+ source "LoRA/lora_config.env"
11
+ fi
12
+
13
+ # Launcher selection: prefer explicit TORCHRUN_BIN, then PATH torchrun,
14
+ # then JanusVLN conda torchrun, finally python -m torch.distributed.run.
15
+ if [[ -n "${TORCHRUN_BIN:-}" ]]; then
16
+ LAUNCHER=("$TORCHRUN_BIN")
17
+ elif command -v torchrun >/dev/null 2>&1; then
18
+ LAUNCHER=("$(command -v torchrun)")
19
+ elif [[ -x "/home/catlab/anaconda3/envs/JanusVLN/bin/torchrun" ]]; then
20
+ LAUNCHER=("/home/catlab/anaconda3/envs/JanusVLN/bin/torchrun")
21
+ else
22
+ PYTHON_BIN="${PYTHON_BIN:-python3}"
23
+ LAUNCHER=("$PYTHON_BIN" -m torch.distributed.run)
24
+ fi
25
+
26
+ MASTER_ADDR="${MASTER_ADDR:-127.0.0.1}"
27
+ MASTER_PORT="${MASTER_PORT:-$(shuf -i 20000-29999 -n 1)}"
28
+ NPROC_PER_NODE="${NPROC_PER_NODE:-$(nvidia-smi --list-gpus | wc -l)}"
29
+
30
+ MODEL_PATH="${MODEL_PATH:-Qwen/Qwen2.5-VL-7B-Instruct}"
31
+ VGGT_MODEL_PATH="${VGGT_MODEL_PATH:-facebook/VGGT-1B}"
32
+ OUTPUT_DIR="${OUTPUT_DIR:-./JanusVLN_LoRA_Base}"
33
+ CACHE_DIR="${CACHE_DIR:-./cache}"
34
+ DATASETS="${DATASETS:-train_r2r_rxr}"
35
+
36
+ # LoRA defaults (override by exporting env vars before running).
37
+ LORA_R="${LORA_R:-16}"
38
+ LORA_ALPHA="${LORA_ALPHA:-32}"
39
+ LORA_DROPOUT="${LORA_DROPOUT:-0.05}"
40
+ LORA_TARGET_MODULES="${LORA_TARGET_MODULES:-q_proj,k_proj,v_proj,o_proj,gate_proj,up_proj,down_proj}"
41
+
42
+ # Training defaults (safe for 24G-class cards with multi-GPU + accumulation).
43
+ PER_DEVICE_BATCH_SIZE="${PER_DEVICE_BATCH_SIZE:-1}"
44
+ GRAD_ACC_STEPS="${GRAD_ACC_STEPS:-8}"
45
+ LEARNING_RATE="${LEARNING_RATE:-2e-4}"
46
+ MM_PROJECTOR_LR="${MM_PROJECTOR_LR:-1e-5}"
47
+ VISION_TOWER_LR="${VISION_TOWER_LR:-1e-6}"
48
+
49
+ mkdir -p "$OUTPUT_DIR"
50
+ LOG_FILE="$OUTPUT_DIR/train_lora.log"
51
+
52
+ export NCCL_NVLS_ENABLE=0
53
+
54
+ # Checkpoint policy: save every 1000 steps and keep all checkpoints.
55
+ # Original setting deleted old checkpoints with: --save_total_limit 1
56
+
57
+ "${LAUNCHER[@]}" --nproc_per_node="$NPROC_PER_NODE" \
58
+ --master_addr="$MASTER_ADDR" \
59
+ --master_port="$MASTER_PORT" \
60
+ LoRA/train_qwen_lora.py \
61
+ --model_name_or_path "$MODEL_PATH" \
62
+ --vggt_model_path "$VGGT_MODEL_PATH" \
63
+ --tune_mm_llm False \
64
+ --tune_mm_vision False \
65
+ --tune_mm_mlp True \
66
+ --use_lora True \
67
+ --lora_r "$LORA_R" \
68
+ --lora_alpha "$LORA_ALPHA" \
69
+ --lora_dropout "$LORA_DROPOUT" \
70
+ --lora_target_modules "$LORA_TARGET_MODULES" \
71
+ --lora_bias none \
72
+ --lora_task_type CAUSAL_LM \
73
+ --lora_train_merger True \
74
+ --lora_train_lm_head False \
75
+ --dataset_use "$DATASETS" \
76
+ --output_dir "$OUTPUT_DIR" \
77
+ --cache_dir "$CACHE_DIR" \
78
+ --bf16 \
79
+ --per_device_train_batch_size "$PER_DEVICE_BATCH_SIZE" \
80
+ --gradient_accumulation_steps "$GRAD_ACC_STEPS" \
81
+ --learning_rate "$LEARNING_RATE" \
82
+ --mm_projector_lr "$MM_PROJECTOR_LR" \
83
+ --vision_tower_lr "$VISION_TOWER_LR" \
84
+ --optim adamw_torch \
85
+ --model_max_length 163840 \
86
+ --data_flatten False \
87
+ --max_pixels $((576 * 28 * 28)) \
88
+ --min_pixels $((16 * 28 * 28)) \
89
+ --base_interval 2 \
90
+ --video_max_frames 8 \
91
+ --video_min_frames 4 \
92
+ --video_max_frame_pixels $((1664 * 28 * 28)) \
93
+ --video_min_frame_pixels $((256 * 28 * 28)) \
94
+ --num_train_epochs 1 \
95
+ --warmup_ratio 0.03 \
96
+ --lr_scheduler_type cosine \
97
+ --weight_decay 0.01 \
98
+ --logging_steps 10 \
99
+ --disable_tqdm False \
100
+ --save_steps 1000 \
101
+ --deepspeed "LoRA/zero2_lora.json" \
102
+ --gradient_checkpointing \
103
+ --dataloader_num_workers 8 \
104
+ --group_by_modality_length true \
105
+ --seed 42 \
106
+ --report_to none \
107
+ --reference_frame first \
108
+ 2>&1 | tee "$LOG_FILE"
109
+
110
+ echo "LoRA training finished. Log: $LOG_FILE"
LoRA/train_lora_parquet.sh ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+
4
+ # LoRA entrypoint for parquet-backed trajectory annotations.
5
+ # Original PNG-backed script: LoRA/train_lora.sh with DATASETS="train_r2r_rxr".
6
+
7
+ cd "$(dirname "$0")/.."
8
+
9
+ export DATASETS="${DATASETS:-train_r2r_rxr_parquet}"
10
+ export OUTPUT_DIR="${OUTPUT_DIR:-./JanusVLN_LoRA_Base_Parquet}"
11
+
12
+ exec bash LoRA/train_lora.sh
13
+
LoRA/train_qwen_lora.py ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LoRA-only training entrypoint for JanusVLN.
2
+ # This file is isolated under LoRA/ and does not modify the original full-finetuning scripts.
3
+
4
+ import os
5
+ import logging
6
+ import pathlib
7
+ import shutil
8
+ import sys
9
+ from pathlib import Path
10
+ from typing import List
11
+
12
+ import torch
13
+ import transformers
14
+ from peft import LoraConfig, TaskType, get_peft_model
15
+
16
+ project_root = Path(__file__).resolve().parent.parent
17
+ sys.path.append(str(project_root))
18
+ sys.path.append(str(project_root / "src"))
19
+
20
+ import qwen_vl.train.trainer # noqa: F401 # keep monkey patches from trainer side effects
21
+ import qwen_vl.train.sampler # noqa: F401
22
+ from qwen_vl.train.trainer import replace_qwen2_vl_attention_class
23
+
24
+ from transformers import (
25
+ Qwen2VLForConditionalGeneration,
26
+ )
27
+ from qwen_vl.data.data_qwen import make_supervised_data_module
28
+ from argument_lora import (
29
+ ModelArguments,
30
+ DataArguments,
31
+ TrainingArguments,
32
+ )
33
+ from transformers import AutoProcessor, Qwen2VLImageProcessor, Trainer, AutoConfig, set_seed
34
+
35
+ local_rank = None
36
+
37
+
38
+ def rank0_print(*args):
39
+ if local_rank == 0:
40
+ print(*args)
41
+
42
+
43
+ def is_rank0() -> bool:
44
+ if not torch.distributed.is_available() or not torch.distributed.is_initialized():
45
+ return True
46
+ return torch.distributed.get_rank() == 0
47
+
48
+
49
+ def _parse_csv_list(csv_value: str) -> List[str]:
50
+ if not csv_value:
51
+ return []
52
+ return [x.strip() for x in csv_value.split(",") if x.strip()]
53
+
54
+
55
+ def _get_lora_task_type(task_type_name: str) -> TaskType:
56
+ normalized = (task_type_name or "CAUSAL_LM").upper()
57
+ if not hasattr(TaskType, normalized):
58
+ raise ValueError(
59
+ f"Unsupported lora_task_type: {task_type_name}. "
60
+ f"Supported values: {[x.name for x in TaskType]}"
61
+ )
62
+ return getattr(TaskType, normalized)
63
+
64
+
65
+ def _unwrap_module(model):
66
+ while hasattr(model, "module"):
67
+ model = model.module
68
+ return model
69
+
70
+
71
+ def safe_save_model_for_hf_trainer(trainer: transformers.Trainer, output_dir: str):
72
+ if trainer.deepspeed:
73
+ torch.cuda.synchronize()
74
+ trainer.save_model(output_dir)
75
+ return
76
+
77
+ state_dict = trainer.model.state_dict()
78
+ if trainer.args.should_save:
79
+ cpu_state_dict = {key: value.cpu() for key, value in state_dict.items()}
80
+ del state_dict
81
+ trainer._save(output_dir, state_dict=cpu_state_dict)
82
+
83
+
84
+ def set_lora_training_policy(model_args, model):
85
+ if model_args.tune_mm_vision and hasattr(model, "visual"):
86
+ for _, p in model.visual.named_parameters():
87
+ p.requires_grad = True
88
+ elif hasattr(model, "visual"):
89
+ for _, p in model.visual.named_parameters():
90
+ p.requires_grad = False
91
+
92
+ if model_args.tune_mm_mlp and hasattr(model, "visual") and hasattr(model.visual, "merger"):
93
+ for _, p in model.visual.merger.named_parameters():
94
+ p.requires_grad = True
95
+ elif hasattr(model, "visual") and hasattr(model.visual, "merger"):
96
+ for _, p in model.visual.merger.named_parameters():
97
+ p.requires_grad = False
98
+
99
+ # Freeze the base LLM and only train LoRA adapters.
100
+ if hasattr(model, "model"):
101
+ for _, p in model.model.named_parameters():
102
+ p.requires_grad = False
103
+
104
+ if hasattr(model, "lm_head"):
105
+ model.lm_head.requires_grad = model_args.lora_train_lm_head
106
+
107
+ # Keep VGGT frozen.
108
+ if hasattr(model, "vggt"):
109
+ for _, p in model.vggt.named_parameters():
110
+ p.requires_grad = False
111
+
112
+ # Janus-specific 3D merger can be optionally trainable under LoRA.
113
+ if hasattr(model, "merger"):
114
+ for _, p in model.merger.named_parameters():
115
+ p.requires_grad = model_args.lora_train_merger
116
+
117
+
118
+ def apply_lora_to_llm(model_args, model):
119
+ target_modules = _parse_csv_list(model_args.lora_target_modules)
120
+ if not target_modules:
121
+ raise ValueError("lora_target_modules is empty. Please provide at least one target module name.")
122
+
123
+ modules_to_save = _parse_csv_list(model_args.lora_modules_to_save)
124
+
125
+ lora_config = LoraConfig(
126
+ task_type=_get_lora_task_type(model_args.lora_task_type),
127
+ r=model_args.lora_r,
128
+ lora_alpha=model_args.lora_alpha,
129
+ lora_dropout=model_args.lora_dropout,
130
+ target_modules=target_modules,
131
+ bias=model_args.lora_bias,
132
+ modules_to_save=(modules_to_save if modules_to_save else None),
133
+ )
134
+
135
+ # Wrap the top-level Janus model so Trainer can still pass labels to forward().
136
+ # Wrapping only model.model breaks forward signature and causes labels mismatch.
137
+ return get_peft_model(model, lora_config)
138
+
139
+
140
+ def save_lora_adapter(model, tokenizer, image_processor, output_dir: str):
141
+ if not is_rank0():
142
+ return
143
+
144
+ lora_output_dir = os.path.join(output_dir, "lora_adapter")
145
+ os.makedirs(lora_output_dir, exist_ok=True)
146
+
147
+ core_model = _unwrap_module(model)
148
+ if hasattr(core_model, "save_pretrained"):
149
+ core_model.save_pretrained(lora_output_dir)
150
+ elif hasattr(core_model, "model") and hasattr(core_model.model, "save_pretrained"):
151
+ core_model.model.save_pretrained(lora_output_dir)
152
+ else:
153
+ raise RuntimeError("Cannot find LoRA adapter model to save.")
154
+ tokenizer.save_pretrained(lora_output_dir)
155
+ image_processor.save_pretrained(lora_output_dir)
156
+ rank0_print(f"LoRA adapter has been saved to {lora_output_dir}")
157
+
158
+
159
+ def train(attn_implementation="flash_attention_2"):
160
+ global local_rank
161
+
162
+ parser = transformers.HfArgumentParser(
163
+ (ModelArguments, DataArguments, TrainingArguments)
164
+ )
165
+ model_args, data_args, training_args = parser.parse_args_into_dataclasses()
166
+
167
+ if not model_args.use_lora:
168
+ raise ValueError("This entrypoint is LoRA-only. Please set --use_lora True.")
169
+
170
+ set_seed(training_args.seed)
171
+ local_rank = training_args.local_rank
172
+ os.makedirs(training_args.output_dir, exist_ok=True)
173
+
174
+ # For local/offline checkpoints that already contain Janus weights,
175
+ # allow bypassing external VGGT.from_pretrained() fetch.
176
+ vggt_model_path = model_args.vggt_model_path
177
+ if vggt_model_path in ("", "__SKIP__", "none", "None", None):
178
+ vggt_model_path = None
179
+
180
+ config = AutoConfig.from_pretrained(model_args.model_name_or_path)
181
+ model_type = getattr(config, "model_type", "")
182
+ is_qwen2_5 = "qwen2_5" in model_type or "qwen2.5" in model_type
183
+
184
+ if not is_qwen2_5:
185
+ raise ValueError(
186
+ f"LoRA entrypoint currently supports qwen2.5-vl only, but got model_type={model_type}. "
187
+ "Please use a Qwen2.5-VL / JanusVLN checkpoint."
188
+ )
189
+
190
+ from qwen_vl.model.modeling_qwen2_5_vl import Qwen2_5_VLForConditionalGenerationForJanusVLN
191
+
192
+ setattr(config, "lam", model_args.lam)
193
+
194
+ model = Qwen2_5_VLForConditionalGenerationForJanusVLN.from_pretrained(
195
+ pretrained_model_name_or_path=model_args.model_name_or_path,
196
+ config=config,
197
+ cache_dir=training_args.cache_dir,
198
+ attn_implementation=attn_implementation,
199
+ torch_dtype=(torch.bfloat16 if training_args.bf16 else None),
200
+ vggt_model_path=vggt_model_path,
201
+ )
202
+
203
+ data_args.image_processor = AutoProcessor.from_pretrained(
204
+ model_args.model_name_or_path,
205
+ ).image_processor
206
+ data_args.model_type = "qwen2.5vl"
207
+
208
+ if data_args.data_flatten:
209
+ replace_qwen2_vl_attention_class()
210
+ model.config.use_cache = False
211
+
212
+ if training_args.gradient_checkpointing:
213
+ if hasattr(model, "enable_input_require_grads"):
214
+ model.enable_input_require_grads()
215
+ else:
216
+ def make_inputs_require_grad(module, input_, output):
217
+ output.requires_grad_(True)
218
+
219
+ model.get_input_embeddings().register_forward_hook(make_inputs_require_grad)
220
+
221
+ tokenizer = transformers.AutoTokenizer.from_pretrained(
222
+ model_args.model_name_or_path,
223
+ cache_dir=training_args.cache_dir,
224
+ model_max_length=training_args.model_max_length,
225
+ padding_side="right",
226
+ use_fast=False,
227
+ )
228
+
229
+ set_lora_training_policy(model_args, model)
230
+ model = apply_lora_to_llm(model_args, model)
231
+
232
+ if is_rank0() and hasattr(model, "print_trainable_parameters"):
233
+ model.print_trainable_parameters()
234
+
235
+ data_module = make_supervised_data_module(tokenizer=tokenizer, data_args=data_args)
236
+ trainer = Trainer(
237
+ model=model, processing_class=tokenizer, args=training_args, **data_module
238
+ )
239
+
240
+ if list(pathlib.Path(training_args.output_dir).glob("checkpoint-*")):
241
+ logging.info("checkpoint found, resume training")
242
+ trainer.train(resume_from_checkpoint=True)
243
+ else:
244
+ trainer.train()
245
+
246
+ trainer.save_state()
247
+ data_args.image_processor.save_pretrained(training_args.output_dir)
248
+
249
+ source_path = os.path.join(model_args.model_name_or_path, "chat_template.json")
250
+ template_path = os.path.join(training_args.output_dir, "chat_template.json")
251
+ if os.path.exists(source_path):
252
+ shutil.copy2(source_path, template_path)
253
+
254
+ model.config.use_cache = True
255
+ save_lora_adapter(model=trainer.model, tokenizer=tokenizer, image_processor=data_args.image_processor, output_dir=training_args.output_dir)
256
+
257
+ # Keep compatibility with existing checkpoint expectations.
258
+ safe_save_model_for_hf_trainer(trainer=trainer, output_dir=training_args.output_dir)
259
+
260
+
261
+ if __name__ == "__main__":
262
+ train(attn_implementation="flash_attention_2")
LoRA/zero2_lora.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "train_batch_size": "auto",
3
+ "train_micro_batch_size_per_gpu": "auto",
4
+ "gradient_accumulation_steps": "auto",
5
+ "gradient_clipping": "auto",
6
+ "zero_allow_untested_optimizer": true,
7
+ "fp16": {
8
+ "enabled": "auto",
9
+ "loss_scale": 0,
10
+ "loss_scale_window": 1000,
11
+ "initial_scale_power": 16,
12
+ "hysteresis": 2,
13
+ "min_loss_scale": 1
14
+ },
15
+ "bf16": {
16
+ "enabled": "auto"
17
+ },
18
+ "zero_optimization": {
19
+ "stage": 2,
20
+ "overlap_comm": true,
21
+ "contiguous_gradients": true,
22
+ "reduce_bucket_size": "auto"
23
+ }
24
+ }
PARQUET_AND_ORIGINAL_TRAINING_USAGE.md ADDED
@@ -0,0 +1,291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # JanusVLN 数据格式与训练使用说明
2
+
3
+ 本文说明如何分别使用原始 PNG 图片数据和 parquet 图片数据进行 JanusVLN 的全量微调或 LoRA 微调。
4
+
5
+ ## 1. 数据文件约定
6
+
7
+ ### 原始 PNG 数据
8
+
9
+ 原始代码默认使用 PNG 图片目录:
10
+
11
+ ```text
12
+ data/trajectory_data/R2R/train/<episode_id>/step_*.png
13
+ data/trajectory_data/RxR/train/<episode_id>/step_*.png
14
+ ```
15
+
16
+ 对应的训练 annotation 文件是:
17
+
18
+ ```text
19
+ train_r2r_rxr.json
20
+ ```
21
+
22
+ 对应的数据集名是:
23
+
24
+ ```text
25
+ train_r2r_rxr
26
+ ```
27
+
28
+ ### Parquet 数据
29
+
30
+ parquet 版本使用你已经生成的 annotation 文件:
31
+
32
+ ```text
33
+ train_r2r_rxr_parquet.json
34
+ ```
35
+
36
+ 对应的数据集名是:
37
+
38
+ ```text
39
+ train_r2r_rxr_parquet
40
+ ```
41
+
42
+ 该 annotation 中的 `images` 字段不是 PNG 路径,而是 parquet 引用,例如:
43
+
44
+ ```text
45
+ parquet:data/trajectory_data/R2R/r2r_train_full.parquet|trajectory_id=1|image_index=0|filename=step_0000_TURN_RIGHT.png
46
+ ```
47
+
48
+ 训练代码会自动识别 `parquet:` 前缀,并从 parquet 中读取图片。
49
+
50
+ parquet 文件默认路径:
51
+
52
+ ```text
53
+ data/trajectory_data/R2R/r2r_train_full.parquet
54
+ data/trajectory_data/RxR/rxr_train_full.parquet
55
+ ```
56
+
57
+ 如果存在分片目录,代码会优先读取分片,避免直接扫描超大的完整 parquet 文件:
58
+
59
+ ```text
60
+ data/trajectory_data/R2R/r2r_train_full_shards/data/*.parquet
61
+ data/trajectory_data/RxR/rxr_train_full_shards/data/*.parquet
62
+ ```
63
+
64
+ 为了提升训练启动和读取速度,建议同时保留 manifest 文件:
65
+
66
+ ```text
67
+ data/trajectory_data/R2R/r2r_train_full_shards/trajectory_manifest.json
68
+ data/trajectory_data/RxR/rxr_train_full_shards/trajectory_manifest.json
69
+ ```
70
+
71
+ manifest 会记录每个 `trajectory_id` 位于哪个 shard、哪个 row group、哪一行。训练时会优先读取 manifest,因此不需要每个 dataloader worker 启动时重新扫描所有分片。
72
+
73
+ ## 2. 环境依赖
74
+
75
+ parquet 训练需要 `pyarrow`:
76
+
77
+ ```bash
78
+ pip install pyarrow
79
+ ```
80
+
81
+ 当前项目的 `requirements.txt` 已加入:
82
+
83
+ ```text
84
+ pyarrow
85
+ ```
86
+
87
+ 如果使用本机 JanusVLN conda 环境,可以先确认:
88
+
89
+ ```bash
90
+ /home/catlab/anaconda3/envs/JanusVLN/bin/python -c "import pyarrow; print(pyarrow.__version__)"
91
+ ```
92
+
93
+ ## 3. 生成 parquet annotation
94
+
95
+ 如果还没有 `train_r2r_rxr_parquet.json`,可运行:
96
+
97
+ ```bash
98
+ /home/catlab/anaconda3/bin/python create_data/create_data_parquet.py \
99
+ --output_path train_r2r_rxr_parquet.json
100
+ ```
101
+
102
+ 小规模测试并和原 PNG 逻辑对齐:
103
+
104
+ ```bash
105
+ /home/catlab/anaconda3/bin/python create_data/create_data_parquet.py \
106
+ --max_episodes 5 \
107
+ --output_path train_r2r_rxr_parquet_test.json \
108
+ --compare_png
109
+ ```
110
+
111
+ ## 4. 生成 parquet shards manifest
112
+
113
+ 如果你使用的是分片 parquet,建议先生成 manifest:
114
+
115
+ ```bash
116
+ /home/catlab/anaconda3/bin/python data/trajectory_data/generate_parquet_manifest.py \
117
+ --source-parquet data/trajectory_data/R2R/r2r_train_full.parquet \
118
+ --overwrite
119
+
120
+ /home/catlab/anaconda3/bin/python data/trajectory_data/generate_parquet_manifest.py \
121
+ --source-parquet data/trajectory_data/RxR/rxr_train_full.parquet \
122
+ --overwrite
123
+ ```
124
+
125
+ 生成后会得到:
126
+
127
+ ```text
128
+ data/trajectory_data/R2R/r2r_train_full_shards/trajectory_manifest.json
129
+ data/trajectory_data/RxR/rxr_train_full_shards/trajectory_manifest.json
130
+ ```
131
+
132
+ 训练读取优先级:
133
+
134
+ ```text
135
+ manifest -> shards/data/*.parquet -> full parquet
136
+ ```
137
+
138
+ ## 5. 使用原始 PNG 数据训练
139
+
140
+ ### 全量微调
141
+
142
+ 使用原始脚本:
143
+
144
+ ```bash
145
+ bash scripts/train.sh
146
+ ```
147
+
148
+ 该脚本内部使用:
149
+
150
+ ```bash
151
+ DATASETS="train_r2r_rxr"
152
+ ```
153
+
154
+ 也就是读取 `train_r2r_rxr.json` 和原始 PNG 图片目录。
155
+
156
+ ### LoRA 微调
157
+
158
+ 使用原始 LoRA 脚本:
159
+
160
+ ```bash
161
+ bash LoRA/train_lora.sh
162
+ ```
163
+
164
+ 该脚本默认使用:
165
+
166
+ ```bash
167
+ DATASETS="train_r2r_rxr"
168
+ ```
169
+
170
+ 也可以显式指定:
171
+
172
+ ```bash
173
+ DATASETS=train_r2r_rxr bash LoRA/train_lora.sh
174
+ ```
175
+
176
+ ## 6. 使用 parquet 数据训练
177
+
178
+ ### 全量微调
179
+
180
+ 使用新增 parquet 脚本:
181
+
182
+ ```bash
183
+ bash scripts/train_parquet.sh
184
+ ```
185
+
186
+ 该脚本内部使用:
187
+
188
+ ```bash
189
+ DATASETS="train_r2r_rxr_parquet"
190
+ ```
191
+
192
+ 也就是读取 `train_r2r_rxr_parquet.json`,并通过 parquet 引用读取图片。
193
+
194
+ ### LoRA 微调
195
+
196
+ 使用新增 parquet LoRA 脚本:
197
+
198
+ ```bash
199
+ bash LoRA/train_lora_parquet.sh
200
+ ```
201
+
202
+ 该脚本会设置:
203
+
204
+ ```bash
205
+ DATASETS="train_r2r_rxr_parquet"
206
+ OUTPUT_DIR="./JanusVLN_LoRA_Base_Parquet"
207
+ ```
208
+
209
+ 也可以复用原 LoRA 脚本并显式指定 parquet 数据集:
210
+
211
+ ```bash
212
+ DATASETS=train_r2r_rxr_parquet \
213
+ OUTPUT_DIR=./JanusVLN_LoRA_Base_Parquet \
214
+ bash LoRA/train_lora.sh
215
+ ```
216
+
217
+ ## 7. 快速验证 parquet 是否可读取
218
+
219
+ 可以用下面命令验证 parquet annotation 中的图片引用能否被训练代码读取:
220
+
221
+ ```bash
222
+ /home/catlab/anaconda3/envs/JanusVLN/bin/python - <<'PY'
223
+ import json
224
+ from pathlib import Path
225
+ import sys
226
+
227
+ root = Path("/home/catlab/Project/JanusVLN-main")
228
+ sys.path.insert(0, str(root / "src"))
229
+
230
+ from qwen_vl.data.parquet_image_reader import ParquetImageReader
231
+
232
+ with open(root / "train_r2r_rxr_parquet.json", "r", encoding="utf-8") as f:
233
+ sample = json.load(f)[0]
234
+
235
+ img = ParquetImageReader(project_root=root).read_image(sample["images"][0])
236
+ print(img.mode, img.size)
237
+ PY
238
+ ```
239
+
240
+ 正常输出类似:
241
+
242
+ ```text
243
+ RGB (640, 480)
244
+ ```
245
+
246
+ ## 8. 文件对应关系
247
+
248
+ 原始 PNG 训练:
249
+
250
+ ```text
251
+ scripts/train.sh
252
+ LoRA/train_lora.sh
253
+ train_r2r_rxr.json
254
+ dataset_use=train_r2r_rxr
255
+ ```
256
+
257
+ parquet 训练:
258
+
259
+ ```text
260
+ scripts/train_parquet.sh
261
+ LoRA/train_lora_parquet.sh
262
+ train_r2r_rxr_parquet.json
263
+ dataset_use=train_r2r_rxr_parquet
264
+ ```
265
+
266
+ 核心适配代码:
267
+
268
+ ```text
269
+ src/qwen_vl/data/parquet_image_reader.py
270
+ src/qwen_vl/data/data_qwen.py
271
+ src/qwen_vl/data/__init__.py
272
+ data/trajectory_data/generate_parquet_manifest.py
273
+ ```
274
+
275
+ ## 9. Checkpoint 保存策略
276
+
277
+ 当前训练脚本均设置为每 1000 个 optimizer step 保存一次:
278
+
279
+ ```bash
280
+ --save_steps 1000
281
+ ```
282
+
283
+ 旧配置曾使用:
284
+
285
+ ```bash
286
+ --save_total_limit 1
287
+ ```
288
+
289
+ 这会删除旧 checkpoint,只保留最新的 1 个。现在该限制已移除,因此会保留所有每 1000 step 保存下来的 checkpoint。
290
+
291
+
README.md ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div align="center">
2
+ <img src="assets/logo.png" alt="JanusVLN Logo" width="100"/>
3
+
4
+ <h1>JanusVLN: Decoupling Semantics and Spatiality with Dual Implicit Memory for Vision-Language Navigation</h1>
5
+
6
+ <h1 align="center"><strong>🎉🎉ICLR 2026🎉🎉</strong></h1>
7
+
8
+ [Shuang Zeng](https://scholar.google.com/citations?user=91lbdPcAAAAJ&hl=zh-CN)<sup>1,2</sup>,
9
+ [Dekang Qi](https://scholar.google.com/citations?user=fOU1xMAAAAAJ&hl=zh-CN&oi=ao)<sup>1</sup>,
10
+ [Xinyuan Chang](https://scholar.google.com.hk/citations?user=5OnPBVYAAAAJ&hl=zh-CN)<sup>1</sup>,
11
+ [Feng Xiong](https://scholar.google.com/citations?hl=zh-CN&user=_X4MQ-gAAAAJ)<sup>1</sup>,
12
+ Shichao Xie<sup>1</sup>,
13
+ Xiaolong Wu<sup>1</sup>,
14
+ Shiyi Liang<sup>1,2</sup>,
15
+ Mu Xu<sup>1</sup>,
16
+ [Xing Wei](https://scholar.google.com.hk/citations?user=KNyC5EUAAAAJ&hl=zh-CN&oi=ao/)<sup>2</sup>
17
+
18
+
19
+ <sup>1</sup>Amap, Alibaba Group,
20
+ <sup>2</sup>Xi’an Jiaotong University
21
+
22
+ [![arXiv](https://img.shields.io/badge/arXiv-2509.22548-red)](https://arxiv.org/abs/2509.22548)
23
+ [![Website](https://img.shields.io/badge/🌐-Website-green)](https://miv-xjtu.github.io/JanusVLN.github.io/)
24
+ [![Video](https://img.shields.io/badge/🎥-Live_Demo-purple)](https://www.youtube.com/watch?v=SfrkZks_XE8)
25
+ [![HuggingFace](https://img.shields.io/badge/🚀-Model_Base-yellow)](https://www.modelscope.cn/models/misstl/JanusVLN_Base)
26
+ [![HuggingFace](https://img.shields.io/badge/🏆-Model_Extra-yellow)](https://www.modelscope.cn/models/misstl/JanusVLN_Extra)
27
+ [![HF Demo](https://img.shields.io/badge/💾-Data-orange)](https://www.modelscope.cn/datasets/misstl/JanusVLN_Trajectory_Data)
28
+
29
+ https://github.com/user-attachments/assets/bc477e20-2dd2-4927-b382-f483f578f3e1
30
+
31
+ </div>
32
+
33
+
34
+
35
+ ## 💡 Introduction
36
+ **JanusVLN** is a novel VLN framework and the first to feature a **dual implicit memory**. Inspired by the implicit scene representation in human navigation, which integrates left-brain semantic understanding with right-brain spatial cognition, JanusVLN constructs two complementary, fixed-size, compact neural memory. JanusVLN steers VLN research from 2D semantics-dominant toward 3D spatial-semantisynergy, a critical direction for developing next-generation spatial embodied agents.
37
+
38
+
39
+ <div style="text-align: center;">
40
+ <img src="assets/overview.jpg" alt="JanusVLN" width="888"/>
41
+ </div>
42
+
43
+ ## 📢 News
44
+ [2026-1-26] JanusVLN has been accepted by ICLR 2026! 🎉🎉
45
+
46
+ [2025-11-06] Due to the previous upload of incorrect weights for the `JanusVLN_Extra` model, if you need to directly infer, please download the correct weights from [JanusVLN_Extra](https://www.modelscope.cn/models/misstl/JanusVLN_Extra) again.
47
+
48
+ ## Table of Contents
49
+ - [🛠️ Installation](#-Installation)
50
+ - [📦 Data Preparation](#-Data-Preparation)
51
+ - [🏆 Model Zoo](#-Model-Zoo)
52
+ - [🚀 Training](#-Training)
53
+ - [📈 Evaluation](#-Evaluation)
54
+ - [📜 Citing](#-Citing)
55
+ <p align="right"><a href="#readme-top"><img src=https://img.shields.io/badge/back%20to%20top-red?style=flat
56
+ ></a></p>
57
+
58
+ ## 🛠️ Installation
59
+
60
+ Create the required environment through the following steps:
61
+
62
+ ```bash
63
+ git clone https://github.com/MIV-XJTU/JanusVLN.git && cd JanusVLN
64
+
65
+ conda create -n janusvln python=3.9 -y && conda activate janusvln
66
+
67
+ conda install habitat-sim==0.2.4 withbullet headless -c conda-forge -c aihabitat
68
+
69
+ git clone --branch v0.2.4 https://github.com/facebookresearch/habitat-lab.git
70
+ cd habitat-lab
71
+ pip install -e habitat-lab
72
+ pip install -e habitat-baselines
73
+ cd ..
74
+
75
+ # CUDA 12.4
76
+ pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124
77
+
78
+ pip install -r requirements.txt
79
+ # Install JanusVLN
80
+ pip install -e .
81
+ ```
82
+ <p align="right"><a href="#readme-top"><img src=https://img.shields.io/badge/back%20to%20top-red?style=flat
83
+ ></a></p>
84
+
85
+ ## 📦 Data Preparation
86
+
87
+ 1、**Scene Datasets**
88
+ - For **R2R**, **RxR**: Download the MP3D scenes from the [official project page](https://niessner.github.io/Matterport/), and place them under `data/scene_datasets/mp3d/`.
89
+ - For **ScaleVLN**: Download the HM3D scenes from the [official github page](https://github.com/matterport/habitat-matterport-3dresearch), and place the `train` split under `data/scene_datasets/hm3d/`.
90
+
91
+ 2、**VLN-CE Episodes**
92
+ Download the VLN-CE episodes and extract them into the `data/datasets/` directory:
93
+ - [r2r](https://drive.google.com/file/d/1fo8F4NKgZDH-bPSdVU3cONAkt5EW-tyr/view) (Rename `R2R_VLNCE_v1-3_preprocessed/` -> `r2r/`)
94
+ - [rxr](https://drive.google.com/file/d/145xzLjxBaNTbVgBfQ8e9EsBAV8W-SM0t/view) (Rename `RxR_VLNCE_v0/` -> `rxr/`)
95
+ - [scalevln](https://huggingface.co/datasets/cywan/StreamVLN-Trajectory-Data/blob/main/ScaleVLN/scalevln_subset_150k.json.gz) (Follow the StreamVLN to convert a subset of the ScaleVLN dataset into the VLN-CE format.)
96
+
97
+ 3、**Collected Trajectory Data**
98
+
99
+ We provide pre-collected observation-action trajectory data for training. R2R and RxR are collected following VLN-CE. ScaleVLN is collected following StreamVLN. DAgger data is collected using [JanusVLN_Base](https://www.modelscope.cn/models/misstl/JanusVLN_Base). Note: It is best to collect DAgger data using your own base model. Download the collected trajectory data from [ModelScope](https://www.modelscope.cn/datasets/misstl/JanusVLN_Trajectory_Data) and extract it to the `data/trajectory_data/` and `data/dagger_data/` directory.
100
+
101
+ Your final folder structure should look like this:
102
+ ```bash
103
+ data/
104
+ ├── datasets/
105
+ │ ├── r2r/
106
+ │ │ ├── train/
107
+ │ │ ├── val_seen/
108
+ │ │ │ └── val_seen.json.gz
109
+ │ │ └── val_unseen/
110
+ │ │ └── val_unseen.json.gz
111
+ │ ├── rxr/
112
+ │ │ ├── train/
113
+ │ │ ├── val_seen/
114
+ │ │ │ ├── val_seen_guide.json.gz
115
+ │ │ │ └── ...
116
+ │ │ └── val_unseen/
117
+ │ │ ├── val_unseen_guide.json.gz
118
+ │ │ └── ...
119
+ │ └── scalevln/
120
+ │ └── scalevln_subset_150k.json.gz
121
+ ├── scene_datasets/
122
+ │ ├── hm3d/
123
+ │ │ ├── 00000-kfPV7w3FaU5/
124
+ │ │ ├── 00001-UVdNNRcVyV1/
125
+ │ │ └── ...
126
+ │ └── mp3d/
127
+ │ ├── 17DRP5sb8fy/
128
+ │ ├── 1LXtFkjw3qL/
129
+ │ └── ...
130
+ ├── trajectory_data/
131
+ │ ├── R2R-CE-640x480/
132
+ │ │ └── images/
133
+ │ ├── RxR-CE-640x480/
134
+ │ │ └── images/
135
+ │ └── ScaleVLN/
136
+ │ ├── images/
137
+ │ └── annotations.json
138
+ └── dagger_data/
139
+ ├── R2R/
140
+ │ ├── images/
141
+ │ └── annotations.json
142
+ └── RxR/
143
+ ├── images/
144
+ └── annotations.json
145
+ ```
146
+
147
+
148
+ 4、**Build Datasets**
149
+
150
+ Construct a base dataset that only includes R2R-CE and RxR-CE:
151
+
152
+ ```bash
153
+ python create_data/create_data.py
154
+ ```
155
+
156
+ Finally, the dataset information needs to be configured in the file `src/qwen_vl/data/__init__.py`.
157
+
158
+ <p align="right"><a href="#readme-top"><img src=https://img.shields.io/badge/back%20to%20top-red?style=flat
159
+ ></a></p>
160
+
161
+ ## 🏆 Model Zoo
162
+ We have separately provided two sets of JanusVLN model weights to distinguish whether additional data is used or not:
163
+
164
+ <table border="0">
165
+ <tr>
166
+ <th>Model</th>
167
+ <th>Data</th>
168
+ <th>Name</th>
169
+ </tr>
170
+ <hr style="border: 2px solid black;">
171
+ <tr>
172
+ <td rowspan="3"><b>JanusVLN</b></td>
173
+ <td>R2R-CE,RxR-CE</td>
174
+ <td><a href="https://www.modelscope.cn/models/misstl/JanusVLN_Base">JanusVLN_Base</a></td>
175
+ </tr>
176
+ <tr>
177
+ <td>R2R-CE,RxR-CE,DAgger,ScaleVLN</td>
178
+ <td><a href="https://www.modelscope.cn/models/misstl/JanusVLN_Extra">JanusVLN_Extra</a></td>
179
+ </tr>
180
+ </table>
181
+
182
+
183
+ <p align="right"><a href="#readme-top"><img src=https://img.shields.io/badge/back%20to%20top-red?style=flat
184
+ ></a></p>
185
+
186
+ ## 🚀 Training
187
+
188
+ 1. **Base Training**
189
+
190
+ Use the base data to train the base model:
191
+
192
+ ```bash
193
+ bash scripts/train.sh
194
+ ```
195
+ 2. **Dagger Collection**
196
+
197
+ Collecting DAgger data using the base model:
198
+
199
+ ```bash
200
+ bash scripts/dagger.sh
201
+ ```
202
+
203
+ Construct extra dataset:
204
+
205
+ ```bash
206
+ python create_data/create_data.py --use_extra_data
207
+ ```
208
+
209
+ It is also necessary to configure the dataset information in the file `src/qwen_vl/data/__init__.py`.
210
+ 2. **Extra Training**
211
+
212
+ Continue training on extra data on top of the base model:
213
+
214
+ ```bash
215
+ bash scripts/train_extra.sh
216
+ ```
217
+
218
+ <p align="right"><a href="#readme-top"><img src=https://img.shields.io/badge/back%20to%20top-red?style=flat
219
+ ></a></p>
220
+
221
+ ## 📈 Evaluation
222
+ Use multiple GPUs to infer the model for evaluation:
223
+
224
+ ```bash
225
+ bash scripts/evaluation.sh
226
+ ```
227
+
228
+ <p align="right"><a href="#readme-top"><img src=https://img.shields.io/badge/back%20to%20top-red?style=flat
229
+ ></a></p>
230
+
231
+
232
+
233
+
234
+ ## 📜 Citing
235
+
236
+ If you find FSDrive is useful in your research or applications, please consider giving us a star 🌟 and citing it by the following BibTeX entry:
237
+
238
+ ```
239
+ @article{zeng2025janusvln,
240
+ title={JanusVLN: Decoupling Semantics and Spatiality with Dual Implicit Memory for Vision-Language Navigation},
241
+ author={Zeng, Shuang and Qi, Dekang and Chang, Xinyuan and Xiong, Feng and Xie, Shichao and Wu, Xiaolong and Liang, Shiyi and Xu, Mu and Wei, Xing},
242
+ journal={arXiv preprint arXiv:2509.22548},
243
+ year={2025}
244
+ }
245
+ ```
246
+ <p align="right"><a href="#readme-top"><img src=https://img.shields.io/badge/back%20to%20top-red?style=flat
247
+ ></a></p>
248
+
249
+
250
+
251
+ ## 🙏 Acknowledgement
252
+ Our work is primarily based on the following codebases:[Qwen2.5-VL](https://github.com/QwenLM/Qwen3-VL), [VGGT](https://github.com/facebookresearch/vggt), [StreamVLN](https://github.com/InternRobotics/StreamVLN), [VG-LLM](https://github.com/LaVi-Lab/VG-LLM). We are sincerely grateful for their work.
253
+
__init__.py ADDED
File without changes
assets/__init__.py ADDED
File without changes
assets/logo.png ADDED

Git LFS Details

  • SHA256: 653ddce5d1ca0ccc0340f8bacefbe96c12a57571d1b9db41f9f94bf92f7411ed
  • Pointer size: 131 Bytes
  • Size of remote file: 917 kB
assets/overview.jpg ADDED

Git LFS Details

  • SHA256: d257dc9f54d36c211e6ce6bc12a67c4b891b103bd7cb6d61a3562ea6cc22a5a1
  • Pointer size: 132 Bytes
  • Size of remote file: 1.06 MB
config/vln_dagger.yaml ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # @package _global_
2
+
3
+ defaults:
4
+ - /habitat: habitat_config_base
5
+ - /habitat/task: vln_r2r
6
+ - /habitat/simulator/agents@habitat.simulator.agents.main_agent: rgbd_agent
7
+ - /habitat/dataset/vln: mp3d_r2r
8
+ - /habitat/task/lab_sensors:
9
+ - gps_sensor
10
+ - compass_sensor
11
+ - _self_
12
+
13
+ habitat:
14
+ environment:
15
+ max_episode_steps: 500
16
+ iterator_options:
17
+ max_scene_repeat_steps: 50000
18
+ shuffle: False
19
+ simulator:
20
+ agents:
21
+ main_agent:
22
+ sim_sensors:
23
+ rgb_sensor:
24
+ width: 640
25
+ height: 480
26
+ hfov: 79
27
+ depth_sensor:
28
+ width: 640
29
+ height: 480
30
+ hfov: 79
31
+ min_depth: 0.0
32
+ max_depth: 10.0
33
+ forward_step_size: 0.25
34
+ turn_angle: 15
35
+ habitat_sim_v0:
36
+ gpu_device_id: 0
37
+ task:
38
+ measurements:
39
+ distance_to_goal:
40
+ type: DistanceToGoal
41
+ distance_to: POINT
42
+ success:
43
+ type: Success
44
+ success_distance: 3.0
45
+ spl:
46
+ type: SPL
47
+ oracle_success:
48
+ type: OracleSuccess
49
+ oracle_navigation_error:
50
+ type: OracleNavigationError
51
+ pl:
52
+ type: PL
53
+
54
+ dataset:
55
+ type: R2RVLN-v1
56
+ split: train
57
+ scenes_dir: data/scene_datasets/
58
+ data_path: data/datasets/r2r/{split}/{split}.json.gz
config/vln_r2r.yaml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # @package _global_
2
+
3
+ defaults:
4
+ - /habitat: habitat_config_base
5
+ - /habitat/task: vln_r2r
6
+ - /habitat/simulator/agents@habitat.simulator.agents.main_agent: rgbd_agent
7
+ - /habitat/dataset/vln: mp3d_r2r
8
+ - /habitat/task/lab_sensors:
9
+ - gps_sensor
10
+ - compass_sensor
11
+ - _self_
12
+
13
+ habitat:
14
+ environment:
15
+ max_episode_steps: 100000
16
+ iterator_options:
17
+ max_scene_repeat_steps: 50000
18
+ shuffle: False
19
+ simulator:
20
+ agents:
21
+ main_agent:
22
+ sim_sensors:
23
+ rgb_sensor:
24
+ width: 640
25
+ height: 480
26
+ hfov: 79
27
+ depth_sensor:
28
+ width: 640
29
+ height: 480
30
+ hfov: 79
31
+ min_depth: 0.0
32
+ max_depth: 10.0
33
+ forward_step_size: 0.25
34
+ turn_angle: 15
35
+ habitat_sim_v0:
36
+ gpu_device_id: 0
37
+ task:
38
+ measurements:
39
+ distance_to_goal:
40
+ type: DistanceToGoal
41
+ distance_to: POINT
42
+ success:
43
+ type: Success
44
+ success_distance: 3.0
45
+ spl:
46
+ type: SPL
47
+ oracle_success:
48
+ type: OracleSuccess
49
+ oracle_navigation_error:
50
+ type: OracleNavigationError
51
+
52
+ dataset:
53
+ type: R2RVLN-v1
54
+ split: val_seen
55
+ scenes_dir: data/scene_datasets/
56
+ data_path: data/datasets/r2r/{split}/{split}.json.gz
create_data/create_data.py ADDED
@@ -0,0 +1,335 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+ import concurrent.futures
3
+ import glob
4
+ import gzip
5
+ import json
6
+ import os
7
+ from functools import partial
8
+
9
+ import numpy as np
10
+ from tqdm import tqdm
11
+
12
+ max_history_images = 8
13
+ RxR
14
+
15
+ class JsonArrayWriter:
16
+ def __init__(self, output_path):
17
+ self.output_path = output_path
18
+ self.file = None
19
+ self.first = True
20
+ self.count = 0
21
+
22
+ def __enter__(self):
23
+ self.file = open(self.output_path, "w", encoding="utf-8")
24
+ self.file.write("[\n")
25
+ return self
26
+
27
+ def append_many(self, items):
28
+ for item in items:
29
+ if not self.first:
30
+ self.file.write(",\n")
31
+ json.dump(item, self.file, ensure_ascii=False)
32
+ self.first = False
33
+ self.count += 1
34
+
35
+ def __exit__(self, exc_type, exc_val, exc_tb):
36
+ if self.file is not None:
37
+ self.file.write("\n]\n")
38
+ self.file.close()
39
+ return False
40
+
41
+
42
+ def process_episode_scalevln(ep, img_root, act_map):
43
+ episode_results = []
44
+ episode_id = str(ep["id"])
45
+ instruction = ep["instructions"][0]
46
+ name = ep["video"].split("/")[1]
47
+ img_dir = os.path.join(img_root, name, "rgb")
48
+ missing_images_count = 0
49
+
50
+ img_files = sorted(glob.glob(os.path.join(img_dir, "*.jpg")))
51
+ if not img_files:
52
+ return []
53
+
54
+ num_images = len(img_files)
55
+ for i in range(num_images):
56
+ if i <= max_history_images:
57
+ idxs = list(range(i + 1))
58
+ else:
59
+ idxs = np.linspace(0, i, 9, dtype=int).tolist()
60
+ sampled_imgs = [img_files[j] for j in idxs]
61
+
62
+ original_len = len(sampled_imgs)
63
+ sampled_imgs = [img_path for img_path in sampled_imgs if os.path.exists(img_path)]
64
+
65
+ num_missing = original_len - len(sampled_imgs)
66
+ if num_missing > 0:
67
+ missing_images_count += num_missing
68
+
69
+ if not sampled_imgs:
70
+ continue
71
+
72
+ his_img_tags = "<image>" * (len(sampled_imgs) - 1)
73
+
74
+ if i == num_images - 1:
75
+ action = "STOP"
76
+ else:
77
+ action = act_map[ep["actions"][i + 1]]
78
+
79
+ conversations = [
80
+ {
81
+ "from": "human",
82
+ "value": f"You are a visual language navigation model, and your should go to the locations to complete the given task. Compare the observation and instruction to infer your current progress, and then select the correct direction from the candidates to go to the target location and finish the task.\n This is your historical observation:{his_img_tags}\n This is your current observation:<image>\n Your task is to {instruction}\n You should take one of the following actions:\n MOVE_FORWARD\n TURN_LEFT\n TURN_RIGHT\n STOP.",
83
+ },
84
+ {"from": "gpt", "value": action},
85
+ ]
86
+
87
+ sample_dict = {
88
+ "id": f"{episode_id}/{os.path.basename(img_files[i])}",
89
+ "conversations": conversations,
90
+ "images": sampled_imgs,
91
+ }
92
+
93
+ episode_results.append(sample_dict)
94
+
95
+ if missing_images_count != 0:
96
+ print("miss:", missing_images_count)
97
+
98
+ return episode_results
99
+
100
+
101
+ def process_episode_vlnce(ep, img_root):
102
+ episode_results = []
103
+ episode_id = str(ep["episode_id"])
104
+ instruction = ep["instruction"]["instruction_text"].strip()
105
+ img_dir = os.path.join(img_root, episode_id)
106
+
107
+ img_files = sorted(glob.glob(os.path.join(img_dir, "*.png")))
108
+ if not img_files:
109
+ return []
110
+
111
+ for i in range(len(img_files)):
112
+ if i <= max_history_images:
113
+ idxs = list(range(i + 1))
114
+ else:
115
+ idxs = np.linspace(0, i, 9, dtype=int).tolist()
116
+ sampled_imgs = [img_files[j] for j in idxs]
117
+
118
+ his_img_tags = "<image>" * (len(sampled_imgs) - 1)
119
+ name_parts = os.path.basename(img_files[i]).replace(".png", "").split("_")
120
+ if len(name_parts) > 3:
121
+ action = f"{name_parts[-2].upper()}_{name_parts[-1].upper()}"
122
+ else:
123
+ action = name_parts[-1].upper()
124
+
125
+ conversations = [
126
+ {
127
+ "from": "human",
128
+ "value": f"You are a visual language navigation model, and your should go to the locations to complete the given task. Compare the observation and instruction to infer your current progress, and then select the correct direction from the candidates to go to the target location and finish the task.\n This is your historical observation:{his_img_tags}\n This is your current observation:<image>\n Your task is to {instruction}\n You should take one of the following actions:\n MOVE_FORWARD\n TURN_LEFT\n TURN_RIGHT\n STOP.",
129
+ },
130
+ {"from": "gpt", "value": action},
131
+ ]
132
+
133
+ sample_dict = {
134
+ "id": f"{episode_id}/{os.path.basename(img_files[i])}",
135
+ "conversations": conversations,
136
+ "images": sampled_imgs,
137
+ }
138
+
139
+ episode_results.append(sample_dict)
140
+
141
+ return episode_results
142
+
143
+
144
+ def process_dataset_streaming(dataset_name, episodes, worker_fn, executor, writer, max_in_flight):
145
+ total_episodes = len(episodes)
146
+ print(f"\nProcessing {dataset_name}...")
147
+ if total_episodes == 0:
148
+ print(f"Skipping {dataset_name}: no episodes found.")
149
+ return
150
+
151
+ ep_iter = iter(episodes)
152
+ in_flight = set()
153
+ initial = min(max_in_flight, total_episodes)
154
+
155
+ for _ in range(initial):
156
+ in_flight.add(executor.submit(worker_fn, next(ep_iter)))
157
+
158
+ pbar = tqdm(total=total_episodes)
159
+ while in_flight:
160
+ done, in_flight = concurrent.futures.wait(
161
+ in_flight,
162
+ return_when=concurrent.futures.FIRST_COMPLETED,
163
+ )
164
+
165
+ for fut in done:
166
+ episode_res = fut.result()
167
+ writer.append_many(episode_res)
168
+ pbar.update(1)
169
+
170
+ try:
171
+ in_flight.add(executor.submit(worker_fn, next(ep_iter)))
172
+ except StopIteration:
173
+ pass
174
+
175
+ pbar.close()
176
+ print(f"Finished {dataset_name}. Total samples so far: {writer.count}")
177
+
178
+
179
+ def main():
180
+ parser = argparse.ArgumentParser(description="Process VLN datasets for training.")
181
+ parser.add_argument(
182
+ "--use_extra_data",
183
+ action="store_true",
184
+ help="Include extra datasets (ScaleVLN, DAgger R2R, DAgger RxR) in the processing.",
185
+ )
186
+ parser.add_argument(
187
+ "--num_workers",
188
+ type=int,
189
+ default=min(16, os.cpu_count() or 8),
190
+ help="Number of workers for data processing.",
191
+ )
192
+ parser.add_argument(
193
+ "--executor",
194
+ type=str,
195
+ default="thread",
196
+ choices=["thread", "process"],
197
+ help="Parallel executor type. Use thread for better stability on large RxR runs.",
198
+ )
199
+ parser.add_argument(
200
+ "--max_in_flight",
201
+ type=int,
202
+ default=64,
203
+ help="Maximum number of submitted-but-unfinished tasks.",
204
+ )
205
+ args = parser.parse_args()
206
+
207
+ # --- ScaleVLN Dataset ---
208
+ img_root_scalevln = "data/trajectory_data/ScaleVLN/images"
209
+ json_path_scalevln = "data/trajectory_data/ScaleVLN/annotations.json"
210
+ act_map_scalevln = ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT"]
211
+
212
+ # --- DAgger Dataset ---
213
+ img_root_dagger_r2r = "data/dagger_data/R2R/images"
214
+ json_path_dagger_r2r = "data/dagger_data/R2R/annotations.json"
215
+ act_map_dagger_r2r = ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT"]
216
+
217
+ img_root_dagger_rxr = "data/dagger_data/RxR/images"
218
+ json_path_dagger_rxr = "data/dagger_data/RxR/annotations.json"
219
+ act_map_dagger_rxr = ["STOP", "MOVE_FORWARD", "TURN_LEFT", "TURN_RIGHT"]
220
+
221
+ # --- R2R Dataset ---
222
+ img_root_r2r = "data/trajectory_data/R2R/train"
223
+ json_path_r2r = "data/datasets/r2r/train/train.json.gz"
224
+
225
+ # --- RxR Dataset ---
226
+ img_root_rxr = "data/trajectory_data/RxR/train"
227
+ json_path_rxr = "data/datasets/rxr/train/train_guide.json.gz"
228
+
229
+ print("Loading JSON data...")
230
+
231
+ if args.use_extra_data:
232
+ with open(json_path_scalevln, "r", encoding="utf-8") as f:
233
+ data_scalevln = json.load(f)
234
+
235
+ with open(json_path_dagger_r2r, "r", encoding="utf-8") as f:
236
+ data_dagger_r2r = json.load(f)
237
+
238
+ with open(json_path_dagger_rxr, "r", encoding="utf-8") as f:
239
+ data_dagger_rxr = json.load(f)
240
+
241
+ with gzip.open(json_path_r2r, "rt", encoding="utf-8") as f:
242
+ data_r2r = json.load(f)
243
+
244
+ with gzip.open(json_path_rxr, "rt", encoding="utf-8") as f:
245
+ data_rxr = json.load(f)
246
+
247
+ print("JSON data loaded.")
248
+
249
+ if args.use_extra_data:
250
+ output_path = "train_r2r_rxr_extra.json"
251
+ else:
252
+ output_path = "train_r2r_rxr.json"
253
+
254
+ executor_cls = (
255
+ concurrent.futures.ThreadPoolExecutor
256
+ if args.executor == "thread"
257
+ else concurrent.futures.ProcessPoolExecutor
258
+ )
259
+
260
+ print(
261
+ f"Using executor={args.executor}, num_workers={args.num_workers}, max_in_flight={args.max_in_flight}"
262
+ )
263
+ print(f"Streaming output to {output_path}")
264
+
265
+ with JsonArrayWriter(output_path) as writer:
266
+ with executor_cls(max_workers=args.num_workers) as executor:
267
+ if args.use_extra_data:
268
+ p_process_scalevln = partial(
269
+ process_episode_scalevln,
270
+ img_root=img_root_scalevln,
271
+ act_map=act_map_scalevln,
272
+ )
273
+ process_dataset_streaming(
274
+ dataset_name="ScaleVLN dataset",
275
+ episodes=data_scalevln,
276
+ worker_fn=p_process_scalevln,
277
+ executor=executor,
278
+ writer=writer,
279
+ max_in_flight=args.max_in_flight,
280
+ )
281
+
282
+ p_process_dagger_r2r = partial(
283
+ process_episode_scalevln,
284
+ img_root=img_root_dagger_r2r,
285
+ act_map=act_map_dagger_r2r,
286
+ )
287
+ process_dataset_streaming(
288
+ dataset_name="DAgger R2R dataset",
289
+ episodes=data_dagger_r2r,
290
+ worker_fn=p_process_dagger_r2r,
291
+ executor=executor,
292
+ writer=writer,
293
+ max_in_flight=args.max_in_flight,
294
+ )
295
+
296
+ p_process_dagger_rxr = partial(
297
+ process_episode_scalevln,
298
+ img_root=img_root_dagger_rxr,
299
+ act_map=act_map_dagger_rxr,
300
+ )
301
+ process_dataset_streaming(
302
+ dataset_name="DAgger RxR dataset",
303
+ episodes=data_dagger_rxr,
304
+ worker_fn=p_process_dagger_rxr,
305
+ executor=executor,
306
+ writer=writer,
307
+ max_in_flight=args.max_in_flight,
308
+ )
309
+
310
+ p_process_r2r = partial(process_episode_vlnce, img_root=img_root_r2r)
311
+ process_dataset_streaming(
312
+ dataset_name="R2R dataset",
313
+ episodes=data_r2r["episodes"],
314
+ worker_fn=p_process_r2r,
315
+ executor=executor,
316
+ writer=writer,
317
+ max_in_flight=args.max_in_flight,
318
+ )
319
+
320
+ p_process_rxr = partial(process_episode_vlnce, img_root=img_root_rxr)
321
+ process_dataset_streaming(
322
+ dataset_name="RxR dataset",
323
+ episodes=data_rxr["episodes"],
324
+ worker_fn=p_process_rxr,
325
+ executor=executor,
326
+ writer=writer,
327
+ max_in_flight=args.max_in_flight,
328
+ )
329
+
330
+ print(f"\nAll processing finished. Saved {writer.count} samples to {output_path}.")
331
+ print("Done.")
332
+
333
+
334
+ if __name__ == "__main__":
335
+ main()
create_data/create_data_parquet.py ADDED
@@ -0,0 +1,464 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Create JanusVLN training annotations from trajectory parquet files.
4
+
5
+ 注意需要在JanusVLN-main目录下运行,否则会报错。
6
+
7
+ Terminal usage:
8
+ 1) Use a Python environment with pyarrow, numpy, and tqdm installed.
9
+ On this machine, the base conda Python has the needed packages:
10
+ /home/catlab/anaconda3/bin/python create_data/create_data_parquet.py
11
+
12
+ 2) Generate a small R2R/RxR parquet-based test annotation and compare it with
13
+ the original PNG-folder logic:
14
+ /home/catlab/anaconda3/bin/python create_data/create_data_parquet.py \
15
+ --max_episodes 5 \
16
+ --output_path train_r2r_rxr_parquet_test.json \
17
+ --compare_png
18
+
19
+ 3) Generate the full parquet-based annotation:
20
+ /home/catlab/anaconda3/bin/python create_data/create_data_parquet.py \
21
+ --output_path train_r2r_rxr_parquet.json
22
+
23
+ Notes:
24
+ - The generated JSON keeps the same top-level sample shape as create_data.py:
25
+ id / conversations / images.
26
+ - Since images now live inside parquet files, each item in "images" is a compact
27
+ parquet reference string instead of a PNG file path. The LoRA/full-finetune
28
+ data loader should later parse these references and read the image bytes from
29
+ parquet on demand.
30
+ """
31
+
32
+ from __future__ import annotations
33
+
34
+ import argparse
35
+ import gzip
36
+ import json
37
+ import os
38
+ from pathlib import Path
39
+
40
+ import numpy as np
41
+ import pyarrow.parquet as pq
42
+ from tqdm import tqdm
43
+
44
+
45
+ MAX_HISTORY_IMAGES = 8
46
+ PROMPT_TEMPLATE = (
47
+ "You are a visual language navigation model, and your should go to the "
48
+ "locations to complete the given task. Compare the observation and "
49
+ "instruction to infer your current progress, and then select the correct "
50
+ "direction from the candidates to go to the target location and finish the "
51
+ "task.\n This is your historical observation:{history_image_tags}\n This is "
52
+ "your current observation:<image>\n Your task is to {instruction}\n You "
53
+ "should take one of the following actions:\n MOVE_FORWARD\n TURN_LEFT\n "
54
+ "TURN_RIGHT\n STOP."
55
+ )
56
+
57
+
58
+ class JsonArrayWriter:
59
+ def __init__(self, output_path: Path):
60
+ self.output_path = output_path
61
+ self.file = None
62
+ self.first = True
63
+ self.count = 0
64
+
65
+ def __enter__(self) -> "JsonArrayWriter":
66
+ self.output_path.parent.mkdir(parents=True, exist_ok=True)
67
+ self.file = open(self.output_path, "w", encoding="utf-8")
68
+ self.file.write("[\n")
69
+ return self
70
+
71
+ def append_many(self, items: list[dict]) -> None:
72
+ if self.file is None:
73
+ raise RuntimeError("Writer is not open.")
74
+ for item in items:
75
+ if not self.first:
76
+ self.file.write(",\n")
77
+ json.dump(item, self.file, ensure_ascii=False)
78
+ self.first = False
79
+ self.count += 1
80
+
81
+ def __exit__(self, exc_type, exc_val, exc_tb) -> bool:
82
+ if self.file is not None:
83
+ self.file.write("\n]\n")
84
+ self.file.close()
85
+ return False
86
+
87
+
88
+ class ParquetTrajectoryIndex:
89
+ """Lightweight trajectory metadata index built without loading image bytes."""
90
+
91
+ def __init__(self, parquet_path: Path, project_root: Path):
92
+ self.parquet_path = parquet_path
93
+ self.project_root = project_root
94
+ self.steps_by_episode_id: dict[str, list[str]] = {}
95
+
96
+ @property
97
+ def reference_path(self) -> str:
98
+ try:
99
+ return str(self.parquet_path.relative_to(self.project_root))
100
+ except ValueError:
101
+ return str(self.parquet_path)
102
+
103
+ def load(self, batch_size: int) -> None:
104
+ if not self.parquet_path.is_file():
105
+ raise FileNotFoundError(f"Parquet file not found: {self.parquet_path}")
106
+
107
+ parquet_file = pq.ParquetFile(self.parquet_path)
108
+ total_rows = parquet_file.metadata.num_rows
109
+ required_columns = {"trajectory_id", "steps", "images"}
110
+ schema_columns = set(parquet_file.schema_arrow.names)
111
+ missing_columns = required_columns - schema_columns
112
+ if missing_columns:
113
+ raise ValueError(
114
+ f"{self.parquet_path} is missing required columns: {sorted(missing_columns)}"
115
+ )
116
+
117
+ print(f"Indexing parquet metadata: {self.parquet_path}")
118
+ with tqdm(total=total_rows, desc=f"Index {self.parquet_path.name}", unit="traj") as pbar:
119
+ for batch in parquet_file.iter_batches(
120
+ batch_size=batch_size,
121
+ columns=["trajectory_id", "steps"],
122
+ use_threads=True,
123
+ ):
124
+ data = batch.to_pydict()
125
+ for trajectory_id, steps in zip(data["trajectory_id"], data["steps"]):
126
+ key = str(trajectory_id)
127
+ if key in self.steps_by_episode_id:
128
+ raise ValueError(
129
+ f"Duplicate trajectory_id '{key}' in {self.parquet_path}"
130
+ )
131
+ self.steps_by_episode_id[key] = list(steps)
132
+ pbar.update(batch.num_rows)
133
+
134
+ def get_steps(self, episode_id: str) -> list[str] | None:
135
+ return self.steps_by_episode_id.get(str(episode_id))
136
+
137
+ def image_reference(self, episode_id: str, image_index: int, step: str) -> str:
138
+ filename = step_to_filename(step)
139
+ return (
140
+ f"parquet:{self.reference_path}"
141
+ f"|trajectory_id={episode_id}"
142
+ f"|image_index={image_index}"
143
+ f"|filename={filename}"
144
+ )
145
+
146
+
147
+ def step_to_filename(step: str) -> str:
148
+ return f"step_{step}.png"
149
+
150
+
151
+ def action_from_step(step: str) -> str:
152
+ name_parts = step_to_filename(step).replace(".png", "").split("_")
153
+ if len(name_parts) > 3:
154
+ return f"{name_parts[-2].upper()}_{name_parts[-1].upper()}"
155
+ return name_parts[-1].upper()
156
+
157
+
158
+ def sampled_indices(current_index: int) -> list[int]:
159
+ if current_index <= MAX_HISTORY_IMAGES:
160
+ return list(range(current_index + 1))
161
+ return np.linspace(0, current_index, 9, dtype=int).tolist()
162
+
163
+
164
+ def build_sample(
165
+ episode_id: str,
166
+ instruction: str,
167
+ steps: list[str],
168
+ current_index: int,
169
+ parquet_index: ParquetTrajectoryIndex,
170
+ ) -> dict:
171
+ idxs = sampled_indices(current_index)
172
+ sampled_images = [
173
+ parquet_index.image_reference(episode_id, image_index, steps[image_index])
174
+ for image_index in idxs
175
+ ]
176
+ history_image_tags = "<image>" * (len(sampled_images) - 1)
177
+ action = action_from_step(steps[current_index])
178
+ filename = step_to_filename(steps[current_index])
179
+
180
+ conversations = [
181
+ {
182
+ "from": "human",
183
+ "value": PROMPT_TEMPLATE.format(
184
+ history_image_tags=history_image_tags,
185
+ instruction=instruction,
186
+ ),
187
+ },
188
+ {"from": "gpt", "value": action},
189
+ ]
190
+
191
+ return {
192
+ "id": f"{episode_id}/{filename}",
193
+ "conversations": conversations,
194
+ "images": sampled_images,
195
+ }
196
+
197
+
198
+ def process_episode_vlnce_parquet(ep: dict, parquet_index: ParquetTrajectoryIndex) -> list[dict]:
199
+ episode_id = str(ep["episode_id"])
200
+ instruction = ep["instruction"]["instruction_text"].strip()
201
+ steps = parquet_index.get_steps(episode_id)
202
+ if not steps:
203
+ return []
204
+
205
+ return [
206
+ build_sample(
207
+ episode_id=episode_id,
208
+ instruction=instruction,
209
+ steps=steps,
210
+ current_index=i,
211
+ parquet_index=parquet_index,
212
+ )
213
+ for i in range(len(steps))
214
+ ]
215
+
216
+
217
+ def process_episode_vlnce_png(ep: dict, img_root: Path) -> list[dict]:
218
+ """Original PNG-folder logic, used only for local consistency checks."""
219
+ episode_id = str(ep["episode_id"])
220
+ instruction = ep["instruction"]["instruction_text"].strip()
221
+ img_dir = img_root / episode_id
222
+ if not img_dir.is_dir():
223
+ return []
224
+
225
+ img_files = sorted(str(img_dir / name) for name in os.listdir(img_dir) if name.endswith(".png"))
226
+ if not img_files:
227
+ return []
228
+
229
+ results = []
230
+ for i, img_file in enumerate(img_files):
231
+ idxs = sampled_indices(i)
232
+ sampled_imgs = [img_files[j] for j in idxs]
233
+ history_image_tags = "<image>" * (len(sampled_imgs) - 1)
234
+ name_parts = os.path.basename(img_file).replace(".png", "").split("_")
235
+ if len(name_parts) > 3:
236
+ action = f"{name_parts[-2].upper()}_{name_parts[-1].upper()}"
237
+ else:
238
+ action = name_parts[-1].upper()
239
+ results.append(
240
+ {
241
+ "id": f"{episode_id}/{os.path.basename(img_file)}",
242
+ "conversations": [
243
+ {
244
+ "from": "human",
245
+ "value": PROMPT_TEMPLATE.format(
246
+ history_image_tags=history_image_tags,
247
+ instruction=instruction,
248
+ ),
249
+ },
250
+ {"from": "gpt", "value": action},
251
+ ],
252
+ "images": sampled_imgs,
253
+ }
254
+ )
255
+ return results
256
+
257
+
258
+ def load_episodes(json_gz_path: Path) -> list[dict]:
259
+ if not json_gz_path.is_file():
260
+ raise FileNotFoundError(f"Dataset json not found: {json_gz_path}")
261
+ with gzip.open(json_gz_path, "rt", encoding="utf-8") as f:
262
+ data = json.load(f)
263
+ return data["episodes"]
264
+
265
+
266
+ def truncate_episodes(episodes: list[dict], max_episodes: int | None) -> list[dict]:
267
+ if max_episodes is None:
268
+ return episodes
269
+ return episodes[:max_episodes]
270
+
271
+
272
+ def compare_with_png(
273
+ dataset_name: str,
274
+ episodes: list[dict],
275
+ parquet_index: ParquetTrajectoryIndex,
276
+ png_root: Path,
277
+ ) -> None:
278
+ compared_samples = 0
279
+ compared_episodes = 0
280
+ for ep in tqdm(episodes, desc=f"Compare {dataset_name}", unit="episode"):
281
+ parquet_samples = process_episode_vlnce_parquet(ep, parquet_index)
282
+ png_samples = process_episode_vlnce_png(ep, png_root)
283
+ if not parquet_samples and not png_samples:
284
+ continue
285
+ if len(parquet_samples) != len(png_samples):
286
+ raise AssertionError(
287
+ f"{dataset_name} episode {ep['episode_id']} sample count mismatch: "
288
+ f"parquet={len(parquet_samples)}, png={len(png_samples)}"
289
+ )
290
+ for parquet_sample, png_sample in zip(parquet_samples, png_samples):
291
+ if parquet_sample["id"] != png_sample["id"]:
292
+ raise AssertionError(
293
+ f"{dataset_name} id mismatch: {parquet_sample['id']} != {png_sample['id']}"
294
+ )
295
+ if parquet_sample["conversations"] != png_sample["conversations"]:
296
+ raise AssertionError(
297
+ f"{dataset_name} conversation mismatch for {parquet_sample['id']}"
298
+ )
299
+ parquet_filenames = [
300
+ ref.split("|filename=", 1)[1] for ref in parquet_sample["images"]
301
+ ]
302
+ png_filenames = [os.path.basename(path) for path in png_sample["images"]]
303
+ if parquet_filenames != png_filenames:
304
+ raise AssertionError(
305
+ f"{dataset_name} image history mismatch for {parquet_sample['id']}"
306
+ )
307
+ compared_samples += 1
308
+ compared_episodes += 1
309
+
310
+ print(
311
+ f"{dataset_name} comparison passed: "
312
+ f"{compared_episodes} episodes, {compared_samples} samples."
313
+ )
314
+
315
+
316
+ def write_dataset(
317
+ dataset_name: str,
318
+ episodes: list[dict],
319
+ parquet_index: ParquetTrajectoryIndex,
320
+ writer: JsonArrayWriter,
321
+ ) -> None:
322
+ print(f"\nProcessing {dataset_name} from parquet...")
323
+ missing_episodes = 0
324
+ for ep in tqdm(episodes, desc=dataset_name, unit="episode"):
325
+ samples = process_episode_vlnce_parquet(ep, parquet_index)
326
+ if not samples:
327
+ missing_episodes += 1
328
+ continue
329
+ writer.append_many(samples)
330
+ if missing_episodes:
331
+ print(f"{dataset_name}: skipped {missing_episodes} episodes without parquet images.")
332
+ print(f"Finished {dataset_name}. Total samples so far: {writer.count}")
333
+
334
+
335
+ def parse_args() -> argparse.Namespace:
336
+ parser = argparse.ArgumentParser(description=__doc__)
337
+ parser.add_argument(
338
+ "--output_path",
339
+ default="train_r2r_rxr_parquet.json",
340
+ type=Path,
341
+ help="Output annotation JSON path.",
342
+ )
343
+ parser.add_argument(
344
+ "--datasets",
345
+ nargs="+",
346
+ choices=["r2r", "rxr"],
347
+ default=["r2r", "rxr"],
348
+ help="Datasets to process.",
349
+ )
350
+ parser.add_argument(
351
+ "--max_episodes",
352
+ default=None,
353
+ type=int,
354
+ help="Debug mode: process only the first N episodes from each selected dataset.",
355
+ )
356
+ parser.add_argument(
357
+ "--index_batch_size",
358
+ default=1024,
359
+ type=int,
360
+ help="Batch size for reading parquet metadata columns.",
361
+ )
362
+ parser.add_argument(
363
+ "--r2r_parquet",
364
+ default=Path("data/trajectory_data/R2R/r2r_train_full.parquet"),
365
+ type=Path,
366
+ help="R2R trajectory parquet file.",
367
+ )
368
+ parser.add_argument(
369
+ "--rxr_parquet",
370
+ default=Path("data/trajectory_data/RxR/rxr_train_full.parquet"),
371
+ type=Path,
372
+ help="RxR trajectory parquet file.",
373
+ )
374
+ parser.add_argument(
375
+ "--r2r_json",
376
+ default=Path("data/datasets/r2r/train/train.json.gz"),
377
+ type=Path,
378
+ help="R2R annotation json.gz.",
379
+ )
380
+ parser.add_argument(
381
+ "--rxr_json",
382
+ default=Path("data/datasets/rxr/train/train_guide.json.gz"),
383
+ type=Path,
384
+ help="RxR annotation json.gz.",
385
+ )
386
+ parser.add_argument(
387
+ "--compare_png",
388
+ action="store_true",
389
+ help="Compare generated metadata with the original PNG-folder logic.",
390
+ )
391
+ return parser.parse_args()
392
+
393
+
394
+ def resolve_project_path(project_root: Path, path: Path) -> Path:
395
+ if path.is_absolute():
396
+ return path
397
+ return project_root / path
398
+
399
+
400
+ def main() -> None:
401
+ args = parse_args()
402
+ project_root = Path(__file__).resolve().parents[1]
403
+ output_path = resolve_project_path(project_root, args.output_path)
404
+
405
+ config = {
406
+ "r2r": {
407
+ "name": "R2R dataset",
408
+ "json": resolve_project_path(project_root, args.r2r_json),
409
+ "parquet": resolve_project_path(project_root, args.r2r_parquet),
410
+ "png_root": project_root / "data/trajectory_data/R2R/train",
411
+ },
412
+ "rxr": {
413
+ "name": "RxR dataset",
414
+ "json": resolve_project_path(project_root, args.rxr_json),
415
+ "parquet": resolve_project_path(project_root, args.rxr_parquet),
416
+ "png_root": project_root / "data/trajectory_data/RxR/train",
417
+ },
418
+ }
419
+
420
+ print(f"Project root: {project_root}")
421
+ print(f"Output path: {output_path}")
422
+ print(f"Selected datasets: {', '.join(args.datasets)}")
423
+ if args.max_episodes is not None:
424
+ print(f"Debug mode: first {args.max_episodes} episodes per dataset")
425
+
426
+ loaded = {}
427
+ for key in args.datasets:
428
+ dataset_config = config[key]
429
+ episodes = truncate_episodes(
430
+ load_episodes(dataset_config["json"]),
431
+ args.max_episodes,
432
+ )
433
+ parquet_index = ParquetTrajectoryIndex(
434
+ parquet_path=dataset_config["parquet"],
435
+ project_root=project_root,
436
+ )
437
+ parquet_index.load(batch_size=args.index_batch_size)
438
+ loaded[key] = (episodes, parquet_index)
439
+
440
+ if args.compare_png:
441
+ compare_with_png(
442
+ dataset_name=dataset_config["name"],
443
+ episodes=episodes,
444
+ parquet_index=parquet_index,
445
+ png_root=dataset_config["png_root"],
446
+ )
447
+
448
+ with JsonArrayWriter(output_path) as writer:
449
+ for key in args.datasets:
450
+ episodes, parquet_index = loaded[key]
451
+ write_dataset(
452
+ dataset_name=config[key]["name"],
453
+ episodes=episodes,
454
+ parquet_index=parquet_index,
455
+ writer=writer,
456
+ )
457
+
458
+ print(f"\nAll processing finished. Saved {writer.count} samples to {output_path}.")
459
+ print("Done.")
460
+
461
+
462
+ if __name__ == "__main__":
463
+ main()
464
+
data/trajectory_data/generate_parquet_manifest.py ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Generate a trajectory manifest for parquet shards.
4
+
5
+ Terminal usage:
6
+ 1) Generate R2R manifest:
7
+ /home/catlab/anaconda3/bin/python /home/catlab/Project/JanusVLN-main/data/trajectory_data/generate_parquet_manifest.py \
8
+ --source-parquet /home/catlab/Project/JanusVLN-main/data/trajectory_data/R2R/r2r_train_full.parquet
9
+
10
+ 2) Generate RxR manifest:
11
+ /home/catlab/anaconda3/bin/python /home/catlab/Project/JanusVLN-main/data/trajectory_data/generate_parquet_manifest.py \
12
+ --source-parquet /home/catlab/Project/JanusVLN-main/data/trajectory_data/RxR/rxr_train_full.parquet
13
+
14
+ The output is written next to the shard directory:
15
+ <source_stem>_shards/trajectory_manifest.json
16
+
17
+ The training reader uses this file to map:
18
+ trajectory_id -> shard parquet file + row_group + row_index
19
+ """
20
+
21
+ from __future__ import annotations
22
+
23
+ import argparse
24
+ import json
25
+ from pathlib import Path
26
+
27
+ import pyarrow.parquet as pq
28
+ from tqdm import tqdm
29
+
30
+
31
+ def default_shards_dir(source_parquet: Path) -> Path:
32
+ return source_parquet.with_name(f"{source_parquet.stem}_shards")
33
+
34
+
35
+ def relative_to_manifest(manifest_path: Path, shard_path: Path) -> str:
36
+ try:
37
+ return str(shard_path.relative_to(manifest_path.parent))
38
+ except ValueError:
39
+ return str(shard_path)
40
+
41
+
42
+ def build_manifest(
43
+ source_parquet: Path,
44
+ shards_dir: Path,
45
+ manifest_path: Path,
46
+ batch_size: int,
47
+ ) -> dict:
48
+ data_dir = shards_dir / "data"
49
+ if not data_dir.is_dir():
50
+ raise FileNotFoundError(f"Shard data directory not found: {data_dir}")
51
+
52
+ shard_paths = sorted(data_dir.glob("*.parquet"))
53
+ if not shard_paths:
54
+ raise FileNotFoundError(f"No parquet shards found in {data_dir}")
55
+
56
+ entries: dict[str, dict] = {}
57
+ total_rows = 0
58
+
59
+ for shard_path in tqdm(shard_paths, desc=f"Index {shards_dir.name}", unit="shard"):
60
+ parquet_file = pq.ParquetFile(shard_path)
61
+ if "trajectory_id" not in parquet_file.schema_arrow.names:
62
+ raise ValueError(f"Missing trajectory_id column: {shard_path}")
63
+
64
+ for row_group_index in range(parquet_file.metadata.num_row_groups):
65
+ row_index_in_group = 0
66
+ for batch in parquet_file.iter_batches(
67
+ batch_size=batch_size,
68
+ row_groups=[row_group_index],
69
+ columns=["trajectory_id"],
70
+ use_threads=True,
71
+ ):
72
+ for trajectory_id in batch.column("trajectory_id").to_pylist():
73
+ trajectory_id = str(trajectory_id)
74
+ if trajectory_id in entries:
75
+ raise ValueError(
76
+ f"Duplicate trajectory_id={trajectory_id} in {shards_dir}"
77
+ )
78
+ entries[trajectory_id] = {
79
+ "file": relative_to_manifest(manifest_path, shard_path),
80
+ "row_group": row_group_index,
81
+ "row_index": row_index_in_group,
82
+ }
83
+ row_index_in_group += 1
84
+ total_rows += 1
85
+
86
+ return {
87
+ "version": 1,
88
+ "source_parquet": str(source_parquet),
89
+ "shards_dir": str(shards_dir),
90
+ "data_dir": str(data_dir),
91
+ "total_trajectories": total_rows,
92
+ "num_shards": len(shard_paths),
93
+ "entries": entries,
94
+ }
95
+
96
+
97
+ def parse_args() -> argparse.Namespace:
98
+ parser = argparse.ArgumentParser(description=__doc__)
99
+ parser.add_argument(
100
+ "--source-parquet",
101
+ required=True,
102
+ type=Path,
103
+ help="Original full parquet path referenced by train_r2r_rxr_parquet.json.",
104
+ )
105
+ parser.add_argument(
106
+ "--shards-dir",
107
+ default=None,
108
+ type=Path,
109
+ help="Shard directory. Defaults to <source_stem>_shards next to source parquet.",
110
+ )
111
+ parser.add_argument(
112
+ "--manifest-path",
113
+ default=None,
114
+ type=Path,
115
+ help="Output manifest path. Defaults to <shards_dir>/trajectory_manifest.json.",
116
+ )
117
+ parser.add_argument(
118
+ "--batch-size",
119
+ default=4096,
120
+ type=int,
121
+ help="Batch size for scanning the lightweight trajectory_id column.",
122
+ )
123
+ parser.add_argument(
124
+ "--overwrite",
125
+ action="store_true",
126
+ help="Overwrite existing manifest.",
127
+ )
128
+ return parser.parse_args()
129
+
130
+
131
+ def main() -> None:
132
+ args = parse_args()
133
+ source_parquet = args.source_parquet.resolve()
134
+ shards_dir = (args.shards_dir or default_shards_dir(source_parquet)).resolve()
135
+ manifest_path = (args.manifest_path or (shards_dir / "trajectory_manifest.json")).resolve()
136
+
137
+ if manifest_path.exists() and not args.overwrite:
138
+ raise FileExistsError(f"Manifest already exists: {manifest_path}")
139
+
140
+ manifest = build_manifest(
141
+ source_parquet=source_parquet,
142
+ shards_dir=shards_dir,
143
+ manifest_path=manifest_path,
144
+ batch_size=args.batch_size,
145
+ )
146
+
147
+ manifest_path.parent.mkdir(parents=True, exist_ok=True)
148
+ with open(manifest_path, "w", encoding="utf-8") as f:
149
+ json.dump(manifest, f, ensure_ascii=False, indent=2)
150
+
151
+ print(f"Manifest saved: {manifest_path}")
152
+ print(f"Shards: {manifest['num_shards']}")
153
+ print(f"Trajectories: {manifest['total_trajectories']}")
154
+
155
+
156
+ if __name__ == "__main__":
157
+ main()
158
+
data/trajectory_data/img2parquet.py ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import pandas as pd
3
+ import pyarrow as pa
4
+ import pyarrow.parquet as pq
5
+ from tqdm import tqdm
6
+ import subprocess
7
+ import gc # 引入垃圾回收机制
8
+
9
+ def get_inode_count(path):
10
+ """获取指定路径下的 inode 使用数 (仅限 Linux/macOS)"""
11
+ try:
12
+ count = subprocess.check_output(['find', path, '-printf', 'i'], stderr=subprocess.DEVNULL)
13
+ return len(count)
14
+ except:
15
+ return "无法获取 (可能非类Unix系统)"
16
+
17
+ def convert_trajectory_dataset(src_root, output_parquet, max_samples=None, chunk_size=500):
18
+ initial_inodes = get_inode_count(src_root)
19
+ print(f"[*] 初始路径: {src_root}")
20
+ print(f"[*] 原始目录估算占用 Inodes: {initial_inodes}")
21
+
22
+ # 获取所有轨迹文件夹
23
+ traj_folders = [f for f in os.listdir(src_root) if os.path.isdir(os.path.join(src_root, f))]
24
+
25
+ # 对文件夹进行排序
26
+ traj_folders.sort(key=lambda x: int(x) if x.isdigit() else x)
27
+
28
+ # 切片逻辑
29
+ if max_samples is not None:
30
+ traj_folders = traj_folders[:max_samples]
31
+ print(f"[*] ⚠️ 测试模式开启: 仅处理前 {max_samples} 个轨迹文件夹")
32
+ else:
33
+ print(f"[*] 🚀 全量模式开启: 准备处理全部 {len(traj_folders)} 个轨迹...")
34
+
35
+ # ================= 修改核心区域 =================
36
+ writer = None
37
+ chunk_data = []
38
+
39
+ print(f"[*] 采用流式写入,每 {chunk_size} 个轨迹刷新一次内存...")
40
+
41
+ for i, traj_id in enumerate(tqdm(traj_folders)):
42
+ traj_path = os.path.join(src_root, traj_id)
43
+ img_files = sorted([f for f in os.listdir(traj_path) if f.endswith('.png')])
44
+
45
+ images_binary = []
46
+ instructions = []
47
+
48
+ for img_name in img_files:
49
+ img_path = os.path.join(traj_path, img_name)
50
+ with open(img_path, 'rb') as f:
51
+ images_binary.append(f.read())
52
+
53
+ instruction = img_name.replace('step_', '').replace('.png', '')
54
+ instructions.append(instruction)
55
+
56
+ chunk_data.append({
57
+ 'trajectory_id': traj_id,
58
+ 'steps': instructions,
59
+ 'images': images_binary
60
+ })
61
+
62
+ # 当达到 chunk_size 或者遍历到最后一个文件夹时,触发写入
63
+ is_last_item = (i + 1) == len(traj_folders)
64
+ if (i + 1) % chunk_size == 0 or is_last_item:
65
+ # 1. 转换为 DataFrame 和 PyArrow Table
66
+ df_chunk = pd.DataFrame(chunk_data)
67
+ table = pa.Table.from_pandas(df_chunk)
68
+
69
+ # 2. 如果是第一批数据,初始化 ParquetWriter (需要依赖第一批数据的 schema)
70
+ if writer is None:
71
+ writer = pq.ParquetWriter(output_parquet, table.schema, compression='snappy')
72
+
73
+ # 3. 将这一块数据追加写入 Parquet 文件
74
+ writer.write_table(table)
75
+
76
+ # 4. 彻底清空本轮数据,释放内存 (核心操作)
77
+ del chunk_data
78
+ del df_chunk
79
+ del table
80
+ chunk_data = []
81
+ gc.collect() # 强制进行垃圾回收
82
+
83
+ # 循环结束后,关闭文件写入器
84
+ if writer is not None:
85
+ writer.close()
86
+ # ================================================
87
+
88
+ print(f"\n[+] 转换完成! 文件已保存至: {output_parquet}")
89
+ print(f"[*] 当前 Parquet 文件占用 Inode: 1")
90
+
91
+ # 估算节省的 Inode
92
+ if isinstance(initial_inodes, int) and max_samples is None:
93
+ print(f"[!] 全量转换理论节省 Inode 数量: {initial_inodes - 1}")
94
+ elif max_samples is not None:
95
+ estimated_saved = sum([len(os.listdir(os.path.join(src_root, d))) for d in traj_folders]) + len(traj_folders)
96
+ print(f"[!] 本次测试批次理论节省 Inode 数量: {estimated_saved} (包括文件夹与文件)")
97
+
98
+ if __name__ == "__main__":
99
+ source_directory = "/home/catlab/Project/JanusVLN-main/data/trajectory_data/R2R-CE-640x480/train"
100
+
101
+ # 将输出文件放到和 train 平级的目录
102
+ output_dir = os.path.dirname(source_directory)
103
+
104
+ # ---------------------------------------------------------
105
+ # 【配置区】
106
+ # ---------------------------------------------------------
107
+ TEST_BATCH_SIZE = None # None 表示跑全量。你可以先设为 200 测试一下内存占用
108
+ CHUNK_SIZE = 500 # 【新增】每次读入内存的轨迹数量。64GB 内存设为 500 甚至 1000 都毫无压力
109
+
110
+ if TEST_BATCH_SIZE is not None:
111
+ output_filename = f"r2r_train_test_{TEST_BATCH_SIZE}.parquet"
112
+ else:
113
+ output_filename = "r2r_train_full.parquet"
114
+
115
+ output_filepath = os.path.join(output_dir, output_filename)
116
+
117
+ if os.path.exists(source_directory):
118
+ print(f"[*] 计划将文件输出至: {output_filepath}")
119
+ convert_trajectory_dataset(
120
+ source_directory,
121
+ output_filepath,
122
+ max_samples=TEST_BATCH_SIZE,
123
+ chunk_size=CHUNK_SIZE
124
+ )
125
+ else:
126
+ print(f"错误: 找不到源路径 {source_directory},请检查当前工作目录。")
data/trajectory_data/merge_parquet_shards.py ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Merge parquet shards back into one parquet file.
4
+
5
+ Terminal usage:
6
+ 1) Install dependencies:
7
+ pip3 install pyarrow tqdm
8
+
9
+ 2) Merge R2R shards:
10
+ python3 /home/catlab/Project/JanusVLN-main/data/trajectory_data/merge_parquet_shards.py \
11
+ --input-dir /home/catlab/Project/JanusVLN-main/data/trajectory_data/R2R/r2r_train_full_shards/data \
12
+ --output-file /home/catlab/Project/JanusVLN-main/data/trajectory_data/R2R/r2r_train_full.parquet
13
+
14
+ 3) Merge RxR shards:
15
+ python3 /home/catlab/Project/JanusVLN-main/data/trajectory_data/merge_parquet_shards.py \
16
+ --input-dir /home/catlab/Project/JanusVLN-main/data/trajectory_data/RxR/rxr_train_full_shards/data \
17
+ --output-file /home/catlab/Project/JanusVLN-main/data/trajectory_data/RxR/rxr_train_full.parquet
18
+ """
19
+
20
+ from __future__ import annotations
21
+
22
+ import argparse
23
+ from pathlib import Path
24
+
25
+ import pyarrow as pa
26
+ import pyarrow.parquet as pq
27
+ from tqdm import tqdm
28
+
29
+
30
+ def parse_args() -> argparse.Namespace:
31
+ parser = argparse.ArgumentParser(description=__doc__)
32
+ parser.add_argument(
33
+ "--input-dir",
34
+ required=True,
35
+ type=Path,
36
+ help="Directory containing parquet shards (for example: .../r2r_train_full_shards/data).",
37
+ )
38
+ parser.add_argument(
39
+ "--output-file",
40
+ required=True,
41
+ type=Path,
42
+ help="Output merged parquet file path.",
43
+ )
44
+ parser.add_argument(
45
+ "--pattern",
46
+ default="*.parquet",
47
+ help="Glob pattern used to select shard files in input directory.",
48
+ )
49
+ parser.add_argument(
50
+ "--batch-size",
51
+ default=65536,
52
+ type=int,
53
+ help="Rows per batch while streaming data from shards.",
54
+ )
55
+ parser.add_argument(
56
+ "--compression",
57
+ default="snappy",
58
+ help="Compression codec for the merged parquet file (snappy, gzip, zstd, ...).",
59
+ )
60
+ parser.add_argument(
61
+ "--overwrite",
62
+ action="store_true",
63
+ help="Overwrite output file if it already exists.",
64
+ )
65
+ return parser.parse_args()
66
+
67
+
68
+ def collect_shards(input_dir: Path, pattern: str) -> list[Path]:
69
+ if not input_dir.is_dir():
70
+ raise FileNotFoundError(f"Input directory does not exist: {input_dir}")
71
+ shards = sorted(input_dir.glob(pattern))
72
+ if not shards:
73
+ raise FileNotFoundError(
74
+ f"No shard files found in {input_dir} with pattern '{pattern}'"
75
+ )
76
+ return shards
77
+
78
+
79
+ def merge_shards(
80
+ shards: list[Path],
81
+ output_file: Path,
82
+ batch_size: int,
83
+ compression: str,
84
+ ) -> int:
85
+ first_file = pq.ParquetFile(shards[0])
86
+ schema = first_file.schema_arrow
87
+
88
+ total_rows = 0
89
+ for shard in shards:
90
+ total_rows += pq.ParquetFile(shard).metadata.num_rows
91
+
92
+ output_file.parent.mkdir(parents=True, exist_ok=True)
93
+ rows_written = 0
94
+
95
+ with pq.ParquetWriter(output_file, schema=schema, compression=compression) as writer:
96
+ with tqdm(total=len(shards), desc="Shards", unit="file") as shard_bar:
97
+ with tqdm(total=total_rows, desc="Rows", unit="row") as row_bar:
98
+ for shard in shards:
99
+ parquet_file = pq.ParquetFile(shard)
100
+ shard_schema = parquet_file.schema_arrow
101
+ if not shard_schema.equals(schema):
102
+ raise ValueError(f"Schema mismatch in shard: {shard}")
103
+
104
+ for batch in parquet_file.iter_batches(
105
+ batch_size=batch_size,
106
+ use_threads=True,
107
+ ):
108
+ table = pa.Table.from_batches([batch], schema=schema)
109
+ writer.write_table(table)
110
+ batch_rows = table.num_rows
111
+ rows_written += batch_rows
112
+ row_bar.update(batch_rows)
113
+ shard_bar.update(1)
114
+
115
+ return rows_written
116
+
117
+
118
+ def main() -> None:
119
+ args = parse_args()
120
+ shards = collect_shards(args.input_dir, args.pattern)
121
+
122
+ if args.output_file.exists() and not args.overwrite:
123
+ raise FileExistsError(
124
+ f"Output file already exists: {args.output_file}. "
125
+ "Use --overwrite to replace it."
126
+ )
127
+ if args.output_file.exists() and args.overwrite:
128
+ args.output_file.unlink()
129
+
130
+ print(f"Found shards: {len(shards)}")
131
+ print(f"Input dir: {args.input_dir}")
132
+ print(f"Output file: {args.output_file}")
133
+ print(f"Compression: {args.compression}")
134
+ print(f"Batch size: {args.batch_size}")
135
+
136
+ rows_written = merge_shards(
137
+ shards=shards,
138
+ output_file=args.output_file,
139
+ batch_size=args.batch_size,
140
+ compression=args.compression,
141
+ )
142
+
143
+ merged_metadata = pq.ParquetFile(args.output_file).metadata
144
+ merged_rows = merged_metadata.num_rows
145
+ merged_row_groups = merged_metadata.num_row_groups
146
+
147
+ print("Merge completed.")
148
+ print(f"Rows written: {rows_written}")
149
+ print(f"Merged file rows: {merged_rows}")
150
+ print(f"Merged file row groups: {merged_row_groups}")
151
+ print(f"Output size bytes: {args.output_file.stat().st_size}")
152
+
153
+ if rows_written != merged_rows:
154
+ raise RuntimeError(
155
+ f"Row count mismatch: wrote {rows_written}, merged file reports {merged_rows}"
156
+ )
157
+
158
+
159
+ if __name__ == "__main__":
160
+ main()
161
+
data/trajectory_data/split_parquet_shards.py ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Split a large parquet file into smaller parquet shards."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import argparse
7
+ import os
8
+ from pathlib import Path
9
+
10
+ import pyarrow as pa
11
+ import pyarrow.parquet as pq
12
+
13
+
14
+ def parse_size(value: str) -> int:
15
+ units = {
16
+ "b": 1,
17
+ "kb": 1024,
18
+ "mb": 1024**2,
19
+ "gb": 1024**3,
20
+ "tb": 1024**4,
21
+ }
22
+ text = value.strip().lower()
23
+ for suffix, multiplier in sorted(units.items(), key=lambda item: len(item[0]), reverse=True):
24
+ if text.endswith(suffix):
25
+ number = float(text[: -len(suffix)].strip())
26
+ return int(number * multiplier)
27
+ return int(float(text))
28
+
29
+
30
+ def shard_name(index: int) -> str:
31
+ return f"train-{index:05d}.parquet"
32
+
33
+
34
+ def split_parquet(
35
+ source: Path,
36
+ output_dir: Path,
37
+ target_size: int,
38
+ batch_size: int,
39
+ compression: str,
40
+ ) -> None:
41
+ data_dir = output_dir / "data"
42
+ data_dir.mkdir(parents=True, exist_ok=False)
43
+
44
+ parquet_file = pq.ParquetFile(source)
45
+ schema = parquet_file.schema_arrow
46
+ source_rows = parquet_file.metadata.num_rows
47
+ source_row_groups = parquet_file.metadata.num_row_groups
48
+
49
+ print(f"source={source}", flush=True)
50
+ print(f"source_rows={source_rows}", flush=True)
51
+ print(f"source_row_groups={source_row_groups}", flush=True)
52
+ print(f"target_size_bytes={target_size}", flush=True)
53
+ print(f"batch_size={batch_size}", flush=True)
54
+
55
+ writer: pq.ParquetWriter | None = None
56
+ current_path: Path | None = None
57
+ shard_index = 0
58
+ shard_rows = 0
59
+ total_rows = 0
60
+
61
+ def open_writer() -> None:
62
+ nonlocal writer, current_path, shard_rows, shard_index
63
+ current_path = data_dir / shard_name(shard_index)
64
+ writer = pq.ParquetWriter(current_path, schema=schema, compression=compression)
65
+ shard_rows = 0
66
+ print(f"opened_shard={current_path}", flush=True)
67
+
68
+ def close_writer() -> None:
69
+ nonlocal writer, current_path, shard_rows, shard_index
70
+ if writer is None or current_path is None:
71
+ return
72
+ writer.close()
73
+ size = current_path.stat().st_size
74
+ print(
75
+ f"closed_shard={current_path} rows={shard_rows} size_bytes={size}",
76
+ flush=True,
77
+ )
78
+ writer = None
79
+ current_path = None
80
+ shard_index += 1
81
+ shard_rows = 0
82
+
83
+ try:
84
+ open_writer()
85
+ for row_group_index in range(source_row_groups):
86
+ for batch in parquet_file.iter_batches(
87
+ batch_size=batch_size,
88
+ row_groups=[row_group_index],
89
+ use_threads=True,
90
+ ):
91
+ if writer is None:
92
+ open_writer()
93
+
94
+ table = pa.Table.from_batches([batch], schema=schema)
95
+ writer.write_table(table)
96
+ rows = table.num_rows
97
+ shard_rows += rows
98
+ total_rows += rows
99
+
100
+ if current_path is not None and current_path.exists():
101
+ current_size = current_path.stat().st_size
102
+ print(
103
+ "progress "
104
+ f"row_group={row_group_index + 1}/{source_row_groups} "
105
+ f"total_rows={total_rows}/{source_rows} "
106
+ f"current_shard={current_path.name} "
107
+ f"current_size_bytes={current_size}",
108
+ flush=True,
109
+ )
110
+ if current_size >= target_size:
111
+ close_writer()
112
+
113
+ close_writer()
114
+ except Exception:
115
+ if writer is not None:
116
+ writer.close()
117
+ raise
118
+
119
+ print(f"completed total_rows={total_rows} shards={shard_index}", flush=True)
120
+ if total_rows != source_rows:
121
+ raise RuntimeError(f"row count mismatch: wrote {total_rows}, expected {source_rows}")
122
+
123
+
124
+ def main() -> None:
125
+ parser = argparse.ArgumentParser(description=__doc__)
126
+ parser.add_argument("--source", required=True, type=Path)
127
+ parser.add_argument("--output-dir", required=True, type=Path)
128
+ parser.add_argument("--target-size", default="10GB")
129
+ parser.add_argument("--batch-size", default=8, type=int)
130
+ parser.add_argument("--compression", default="snappy")
131
+ args = parser.parse_args()
132
+
133
+ if not args.source.is_file():
134
+ raise FileNotFoundError(args.source)
135
+ if args.output_dir.exists():
136
+ raise FileExistsError(f"Output directory already exists: {args.output_dir}")
137
+
138
+ split_parquet(
139
+ source=args.source,
140
+ output_dir=args.output_dir,
141
+ target_size=parse_size(args.target_size),
142
+ batch_size=args.batch_size,
143
+ compression=args.compression,
144
+ )
145
+
146
+
147
+ if __name__ == "__main__":
148
+ main()
habitat-lab/.circleci/config.yml ADDED
@@ -0,0 +1,454 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: 2.1
2
+ gpu: &gpu
3
+ machine:
4
+ image: ubuntu-2004-cuda-11.4:202110-01
5
+ resource_class: gpu.nvidia.medium
6
+ environment:
7
+ FPS_THRESHOLD: 900
8
+
9
+ orbs:
10
+ codecov: codecov/codecov@3.2.3
11
+
12
+ jobs:
13
+ python_lint:
14
+ docker:
15
+ - image: cimg/python:3.9.16
16
+ steps:
17
+ - checkout
18
+ - run:
19
+ name: setup
20
+ command: |
21
+ pip install black==23.1.0 --progress-bar off
22
+ pip install "isort[pyproject]" numpy --progress-bar off
23
+ pip install mypy==0.991 types-mock types-Pillow types-tqdm types-PyYAML --progress-bar off
24
+ pip install -r habitat-lab/requirements.txt --progress-bar off
25
+ - run:
26
+ name: run black
27
+ command: |
28
+ black --exclude '/(\.eggs|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|_build|buck-out|build|dist)|examples/tutorials/(colabs|nb_python)' habitat-lab/. habitat-baselines/. examples/. test/. --diff
29
+ black --exclude '/(\.eggs|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|_build|buck-out|build|dist)|examples/tutorials/(colabs|nb_python)' habitat-lab/. habitat-baselines/. examples/. test/. --check
30
+ - run:
31
+ name: run isort
32
+ command: |
33
+ isort --version
34
+ isort habitat-lab/. habitat-baselines/. examples/. test/. --diff
35
+ isort habitat-lab/. habitat-baselines/. examples/. test/. --check-only
36
+ - run:
37
+ name: run mypy
38
+ command: |
39
+ mypy --version
40
+ mypy --exclude="^docs/|setup.py$"
41
+ - run:
42
+ name: run assert no files in habitat and habitat_baselines
43
+ command: |
44
+ if test -d habitat ; then echo "folder habitat should not exist"; exit 1; fi
45
+ if test -d habitat_baselines ; then echo "folder habitat_baselines should not exist"; exit 1; fi
46
+ pre-commit:
47
+ docker:
48
+ - image: cimg/python:3.9.16
49
+ working_directory: ~/repo/
50
+
51
+ steps:
52
+ - checkout
53
+ - run:
54
+ name: Combine precommit config and python versions for caching
55
+ command: |
56
+ cat .pre-commit-config.yaml > pre-commit-deps.txt
57
+ python -VV >> pre-commit-deps.txt
58
+ - restore_cache:
59
+ keys:
60
+ - v1-precommit-deps-{{ checksum "pre-commit-deps.txt" }}
61
+
62
+ - run:
63
+ name: Install Dependencies
64
+ command: |
65
+ pip install -U pip setuptools pre-commit
66
+ # Install the hooks now so that they'll be cached
67
+ pre-commit install-hooks
68
+ - save_cache:
69
+ paths:
70
+ - ~/.cache/pre-commit
71
+ key: v1-precommit-deps-{{ checksum "pre-commit-deps.txt" }}
72
+
73
+ - run:
74
+ name: Check Code Style using pre-commit
75
+ command: |
76
+ SKIP=clang-format,eslint pre-commit run --show-diff-on-failure --all-files
77
+ install_and_test_ubuntu:
78
+ <<: *gpu
79
+ steps:
80
+ - checkout:
81
+ path: ./habitat-lab
82
+ - run:
83
+ name: Install cmake
84
+ no_output_timeout: 5m
85
+ command: |
86
+ echo $(git ls-remote https://github.com/facebookresearch/habitat-sim.git HEAD | awk '{ print $1}') > ./hsim_sha
87
+ wget https://github.com/Kitware/CMake/releases/download/v3.13.4/cmake-3.13.4-Linux-x86_64.sh
88
+ sudo mkdir /opt/cmake
89
+ sudo sh ./cmake-3.13.4-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
90
+ sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
91
+ - run:
92
+ name: Install dependencies
93
+ no_output_timeout: 20m
94
+ command: |
95
+ sudo apt-get update || true
96
+ sudo apt-get install -y --no-install-recommends \
97
+ build-essential \
98
+ git \
99
+ curl \
100
+ vim \
101
+ ca-certificates \
102
+ libjpeg-dev \
103
+ libglm-dev \
104
+ libegl1-mesa-dev \
105
+ ninja-build \
106
+ xorg-dev \
107
+ freeglut3-dev \
108
+ pkg-config \
109
+ wget \
110
+ zip \
111
+ lcov\
112
+ libhdf5-dev \
113
+ libomp-dev \
114
+ unzip || true
115
+ sudo apt install --allow-change-held-packages \
116
+ texlive-base \
117
+ texlive-latex-extra \
118
+ texlive-fonts-extra \
119
+ texlive-fonts-recommended
120
+ - run:
121
+ name: Check CUDA
122
+ no_output_timeout: 20m
123
+ background: true
124
+ command: nvidia-smi
125
+ # Restore Conda cache
126
+ - restore_cache:
127
+ keys:
128
+ - conda-{{ checksum "habitat-lab/.circleci/config.yml" }}
129
+ - run:
130
+ name: Install conda and dependencies
131
+ no_output_timeout: 20m
132
+ command: |
133
+ if [ ! -d ~/miniconda ]
134
+ then
135
+ curl -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
136
+ chmod +x ~/miniconda.sh
137
+ bash ~/miniconda.sh -b -p $HOME/miniconda
138
+ rm ~/miniconda.sh
139
+ export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
140
+ conda create -y -n habitat python=3.9
141
+ . activate habitat
142
+ conda install -q -y -c conda-forge ninja ccache
143
+ pip install pytest-sugar>=0.9.6 mock cython pygame flaky pytest pytest-mock pytest-cov psutil
144
+ fi
145
+ - run:
146
+ name: Install pytorch
147
+ no_output_timeout: 20m
148
+ background: true
149
+ command: |
150
+ export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
151
+ . activate habitat;
152
+ if [ ! -f ~/miniconda/pytorch_installed ]
153
+ then
154
+ # For whatever reason we have to install pytorch first. If it isn't
155
+ # it installs the 1.4 cpuonly version. Which is no good.
156
+ echo "Installing pytorch"
157
+ conda install -y pytorch==1.12.1=py3.9_cuda11.3_cudnn8.3.2_0 torchvision==0.13.1=py39_cu113 cudatoolkit=11.3 -c pytorch -c nvidia
158
+ fi
159
+ touch ~/miniconda/pytorch_installed
160
+ python -c 'import torch; print("Has cuda?", torch.cuda.is_available()); print("torch version:", torch.__version__);'
161
+ - restore_cache:
162
+ keys:
163
+ - v1-habitat-sim-{{ checksum "./hsim_sha" }}
164
+ - restore_cache:
165
+ keys:
166
+ - ccache-{{ arch }}-main
167
+ paths:
168
+ - /home/circleci/.ccache
169
+ - run:
170
+ name: CCache initialization
171
+ command: |
172
+ export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
173
+ . activate habitat;
174
+ ccache --show-stats
175
+ ccache --zero-stats
176
+ ccache --max-size=10.0G
177
+ - run:
178
+ name: Build and install habitat-sim
179
+ no_output_timeout: 30m
180
+ command: |
181
+ if [ ! -d ./habitat-sim ]
182
+ then
183
+ git clone https://github.com/facebookresearch/habitat-sim.git --recursive
184
+ fi
185
+ export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
186
+ . activate habitat;
187
+ cd habitat-sim
188
+ pip install -r requirements.txt --progress-bar off
189
+ pip install imageio imageio-ffmpeg
190
+ python -u setup.py install --headless --with-cuda --bullet
191
+ - run:
192
+ name: Ccache stats
193
+ when: always
194
+ command: |
195
+ export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
196
+ . activate habitat;
197
+ ccache --show-stats
198
+ - run:
199
+ name: Download test data
200
+ command: |
201
+ export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
202
+ . activate habitat
203
+ if [ ! -f ./habitat-sim/data/scene_datasets/habitat-test-scenes/van-gogh-room.glb ]
204
+ then
205
+ cd habitat-sim
206
+ wget http://dl.fbaipublicfiles.com/habitat/habitat-test-scenes.zip
207
+ unzip habitat-test-scenes.zip
208
+ rm habitat-test-scenes.zip
209
+ cd -
210
+ fi
211
+ if [ ! -f ./habitat-sim/data/robots/franka_panda/panda_arm.urdf ]
212
+ then
213
+ python -m habitat_sim.utils.datasets_download --uids franka_panda --data-path habitat-sim/data/
214
+ fi
215
+ if [ ! -f ./habitat-sim/data/robots/hab_spot_arm/urdf/hab_spot_arm.urdf ]
216
+ then
217
+ python -m habitat_sim.utils.datasets_download --uids hab_spot_arm --data-path habitat-sim/data/ --replace
218
+ fi
219
+ if [ ! -f ./habitat-sim/data/robots/hab_stretch/urdf/hab_stretch.urdf ]
220
+ then
221
+ python -m habitat_sim.utils.datasets_download --uids hab_stretch --data-path habitat-sim/data/
222
+ fi
223
+ - run:
224
+ name: Download coda scene
225
+ command: |
226
+ if [ ! -f ./habitat-sim/data/scene_datasets/coda/coda.glb ]
227
+ then
228
+ cd habitat-sim
229
+ wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1Pc-J6pZzXEd8RSeLM94t3iwO8q_RQ853' -O coda.zip
230
+ unzip coda.zip -d data/scene_datasets
231
+ rm coda.zip
232
+ fi
233
+ - run:
234
+ name: Run sim benchmark
235
+ command: |
236
+ export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
237
+ . activate habitat; cd habitat-sim
238
+ python examples/example.py --scene data/scene_datasets/habitat-test-scenes/van-gogh-room.glb --silent --test_fps_regression $FPS_THRESHOLD
239
+ - save_cache:
240
+ key: v1-habitat-sim-{{ checksum "./hsim_sha" }}
241
+ background: true
242
+ paths:
243
+ - ./habitat-sim
244
+ - save_cache:
245
+ key: ccache-{{ arch }}-main
246
+ background: true
247
+ paths:
248
+ - /home/circleci/.ccache
249
+ - run:
250
+ name: Install api with baselines
251
+ no_output_timeout: 20m
252
+ command: |
253
+ export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
254
+ . activate habitat; cd habitat-lab
255
+ ln -s ../habitat-sim/data data
256
+ while [ ! -f ~/miniconda/pytorch_installed ]; do sleep 2; done # wait for Pytorch
257
+ pip install -e habitat-lab
258
+ pip install -e habitat-baselines
259
+ - save_cache:
260
+ key: conda-{{ checksum "habitat-lab/.circleci/config.yml" }}
261
+ background: true
262
+ paths:
263
+ - ~/miniconda
264
+ - run:
265
+ name: Run api tests
266
+ no_output_timeout: 120m
267
+ command: |
268
+ export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
269
+ . activate habitat; cd habitat-lab
270
+ export PYTHONPATH=.:$PYTHONPATH
271
+ export MULTI_PROC_OFFSET=0 && export MAGNUM_LOG=quiet && export HABITAT_SIM_LOG=quiet
272
+ python -m pytest --cov-report=xml --cov-report term --cov=./
273
+ - codecov/upload
274
+ - run:
275
+ name: Run baseline training tests
276
+ no_output_timeout: 30m
277
+ command: |
278
+ export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
279
+ . activate habitat; cd habitat-lab
280
+ export PYTHONPATH=.:$PYTHONPATH
281
+ export MULTI_PROC_OFFSET=0 && export MAGNUM_LOG=quiet && export HABITAT_SIM_LOG=quiet
282
+ # This is a flag that enables test_test_baseline_training to work
283
+ export TEST_BASELINE_SMALL=1
284
+ python -m pytest test/test_baseline_training.py -s
285
+ - run:
286
+ name: Run Hab2.0 benchmark
287
+ no_output_timeout: 30m
288
+ command: |
289
+ export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
290
+ . activate habitat; cd habitat-lab
291
+ python -m habitat_sim.utils.datasets_download --uids hab2_bench_assets
292
+ mkdir -p data/ep_datasets/
293
+ cp data/hab2_bench_assets/bench_scene.json.gz data/ep_datasets/
294
+ bash scripts/hab2_bench/bench_runner.sh
295
+ python scripts/hab2_bench/plot_bench.py
296
+ # Assert the SPS number are up to standard
297
+ python scripts/hab2_bench/assert_bench.py
298
+ - run:
299
+ name: Build api documentation
300
+ command: |
301
+ export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
302
+ . activate habitat; cd habitat-lab
303
+ # Download sim inventory for crosslinking (no need to build
304
+ # the whole sim docs for that)
305
+ # TODO: take it from github.com/facebookmicrosites/habitat-website
306
+ # instead
307
+ mkdir -p ../habitat-sim/build/docs-public/habitat-sim
308
+ curl -s https://aihabitat.org/docs/habitat-sim/objects.inv > ../habitat-sim/build/docs-public/habitat-sim/objects.inv
309
+ cd docs
310
+ conda install -y -c conda-forge doxygen
311
+ conda install -y jinja2 pygments docutils
312
+ mkdir -p ../build/docs
313
+ ./build-public.sh
314
+ - run:
315
+ name: Ensure non-editable mode works
316
+ command: |
317
+ cd habitat-lab
318
+ export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
319
+ conda create -y -n non-editable-install python=3.9
320
+ . activate non-editable-install
321
+ conda install -y -c conda-forge -c aihabitat-nightly habitat-sim
322
+ pip install habitat-lab/
323
+ python -c 'import habitat; print("habitat version:", habitat.__version__)'
324
+ pip install habitat-baselines/
325
+ python -c 'import habitat_baselines; print("habitat_baselines version:", habitat_baselines.__version__)'
326
+ - run: &build_sdist_and_bdist
327
+ name: Build sdist and bdist
328
+ command: |
329
+ cd habitat-lab
330
+ export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
331
+ conda create -y -n build-env python=3.9
332
+ . activate build-env
333
+ pip install --upgrade build
334
+ python -m build -s -w -C--global-option=egg_info -C--global-option=--tag-date habitat-lab/
335
+ python -m build -s -w -C--global-option=egg_info -C--global-option=--tag-date habitat-baselines/
336
+ - run:
337
+ name: Ensure sdist and bdist intall work
338
+ command: |
339
+ cd habitat-lab
340
+ export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
341
+ conda create -y -n bdist-install python=3.9
342
+ . activate bdist-install
343
+ conda install -y -c conda-forge -c aihabitat-nightly habitat-sim
344
+ conda create -n sdist-install --clone bdist-install
345
+ # install from built distribution:
346
+ . activate bdist-install
347
+ pip install habitat-lab/dist/habitat_lab*.whl
348
+ python -c 'import habitat; print("habitat version:", habitat.__version__)'
349
+ pip install habitat-baselines/dist/habitat_baselines*.whl
350
+ python -c 'import habitat_baselines; print("habitat_baselines version:", habitat_baselines.__version__)'
351
+ # install from source distribution:
352
+ . activate sdist-install
353
+ pip install habitat-lab/dist/habitat-lab*.tar.gz
354
+ python -c 'import habitat; print("habitat version:", habitat.__version__)'
355
+ pip install habitat-baselines/dist/habitat-baselines*.tar.gz
356
+ python -c 'import habitat_baselines; print("habitat_baselines version:", habitat_baselines.__version__)'
357
+ - store_artifacts:
358
+ path: habitat-lab/data/profile # This is the benchmark profile
359
+ pypi_deploy:
360
+ <<: *gpu
361
+ parameters:
362
+ username_env_var:
363
+ description: "Twine username environment variable name"
364
+ type: env_var_name
365
+ default: TESTPYPI_USERNAME
366
+ password_env_var:
367
+ description: "Twine password environment variable name"
368
+ type: env_var_name
369
+ default: TESTPYPI_PASSWORD
370
+ repository:
371
+ description: "Twine repository name (possible options: testpypi or pypi)"
372
+ type: string
373
+ default: "testpypi"
374
+ steps:
375
+ - checkout:
376
+ path: ./habitat-lab
377
+ - run:
378
+ name: Install conda
379
+ no_output_timeout: 20m
380
+ command: |
381
+ if [ ! -d ~/miniconda ]
382
+ then
383
+ curl -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
384
+ chmod +x ~/miniconda.sh
385
+ bash ~/miniconda.sh -b -p $HOME/miniconda
386
+ rm ~/miniconda.sh
387
+ fi
388
+ - run: *build_sdist_and_bdist
389
+ - run:
390
+ name: Deploy Habitat-Lab and Habitat-Baselines distributions to PyPI
391
+ command: |
392
+ cd habitat-lab
393
+ export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
394
+ . activate build-env
395
+ pip install --upgrade twine
396
+ twine upload \
397
+ --username ${<< parameters.username_env_var >>} \
398
+ --password ${<< parameters.password_env_var >>} \
399
+ --repository << parameters.repository >> \
400
+ habitat-lab/dist/*
401
+ twine upload \
402
+ --username ${<< parameters.username_env_var >>} \
403
+ --password ${<< parameters.password_env_var >>} \
404
+ --repository << parameters.repository >> \
405
+ habitat-baselines/dist/*
406
+
407
+ workflows:
408
+ version: 2
409
+ install_and_test:
410
+ jobs:
411
+ - pre-commit
412
+ - python_lint
413
+ - install_and_test_ubuntu
414
+ testpypi_nightly:
415
+ triggers:
416
+ - schedule:
417
+ cron: "0 7 * * *"
418
+ filters:
419
+ branches:
420
+ only: main
421
+ jobs:
422
+ - pre-commit
423
+ - python_lint
424
+ - install_and_test_ubuntu
425
+ - pypi_deploy:
426
+ requires:
427
+ - pre-commit
428
+ - python_lint
429
+ - install_and_test_ubuntu
430
+ context:
431
+ - pypi_context
432
+ version_pipy_release:
433
+ jobs:
434
+ - pre-commit:
435
+ filters: &version_filter
436
+ tags:
437
+ only: /^v[0-9]+(\.[0-9]+)*.*/ # v0.1.5-rc1
438
+ branches:
439
+ ignore: /.*/
440
+ - python_lint:
441
+ filters: *version_filter
442
+ - install_and_test_ubuntu:
443
+ filters: *version_filter
444
+ - pypi_deploy:
445
+ filters: *version_filter
446
+ username_env_var: PYPI_USERNAME
447
+ password_env_var: PYPI_PASSWORD
448
+ repository: "pypi"
449
+ requires:
450
+ - pre-commit
451
+ - python_lint
452
+ - install_and_test_ubuntu
453
+ context:
454
+ - pypi_context
habitat-lab/.editorconfig ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # See https://editorconfig.org/ for more info :)
2
+
3
+ [*]
4
+ charset = utf-8
5
+ indent_style = space
6
+ indent_size = 2
7
+ trim_trailing_whitespace = true
8
+ insert_final_newline = true
9
+
10
+ # isort can't parse [*.{py, rst}], so specifying it separately
11
+ # https://github.com/timothycrosley/isort/issues/830
12
+ [*.rst]
13
+ indent_size = 4
14
+ [*.py]
15
+ indent_size = 4
16
+ max_line_length = 79
17
+ multi_line_output = 3
18
+ force_grid_wrap = false
19
+ include_trailing_comma = true
20
+ ensure_newline_before_comments=true
21
+ use_parentheses = true
22
+ known_first_party = habitat,habitat_sim,habitat_baselines,version
habitat-lab/.github/ISSUE_TEMPLATE/bug-report.md ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: "\U0001F41B Bug Report"
3
+ about: Submit a bug report to help us improve Habitat
4
+
5
+ ---
6
+
7
+ ## Habitat-Lab and Habitat-Sim versions
8
+ Habitat-Lab: vx.x.x or master?
9
+
10
+ Habitat-Sim: vx.x.x or master?
11
+
12
+ Habitat is under active development, and we advise users to restrict themselves to stable releases of [Habitat-Lab](https://github.com/facebookresearch/habitat-lab/releases) and [Habitat-Sim](https://github.com/facebookresearch/habitat-sim/releases). The bug you are about to report may already be fixed in the latest version.
13
+
14
+ Master branch contains 'bleeding edge' code, but we do appreciate bug reports for it!
15
+
16
+
17
+ ## 🐛 Bug
18
+
19
+ <!-- A clear and concise description of what the bug is. -->
20
+
21
+ ## Steps to Reproduce
22
+
23
+ Steps to reproduce the behavior:
24
+
25
+ <!-- If you were running a command, post the exact command that you were running -->
26
+
27
+ 1.
28
+ 2.
29
+ 3.
30
+
31
+ Please note that without a minimal working example to reproduce the bug, we may not be able to help you.
32
+
33
+ <!-- If you have a code sample, error messages, stack traces, please provide it here as well -->
34
+
35
+ ## Expected behavior
36
+
37
+ <!-- A clear and concise description of what you expected to happen. -->
38
+
39
+ ## Additional context
40
+
41
+ <!-- Add any other context about the problem here. -->
habitat-lab/.github/ISSUE_TEMPLATE/feature-request.md ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: "\U0001F680Feature Request"
3
+ about: Submit a proposal/request for a new Habitat feature
4
+
5
+ ---
6
+
7
+ ## 🚀 Feature
8
+ <!-- A clear and concise description of the feature proposal -->
9
+
10
+ ## Motivation
11
+
12
+ <!-- Please outline the motivation for the proposal. Is your feature request related to a problem? e.g., I'm always frustrated when [...]. If this is related to another GitHub issue, please link here too -->
13
+
14
+ ## Pitch
15
+
16
+ <!-- A clear and concise description of what you want to happen. -->
17
+
18
+ ## Alternatives
19
+
20
+ <!-- A clear and concise description of any alternative solutions or features you've considered, if any. -->
21
+
22
+ ## Additional context
23
+
24
+ <!-- Add any other context or screenshots about the feature request here. -->
habitat-lab/.github/ISSUE_TEMPLATE/questions-help-support.md ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: "❓Questions/Help/Support"
3
+ about: Do you need support?
4
+
5
+ ---
6
+
7
+ ## Habitat-Lab and Habitat-Sim versions
8
+ Habitat-Lab: vx.x.x or master?
9
+
10
+ Habitat-Sim: vx.x.x or master?
11
+
12
+ Habitat is under active development, and we advise users to restrict themselves to stable releases. Are you using the latest release versions of [Habitat-Lab](https://github.com/facebookresearch/habitat-lab/releases) and [Habitat-Sim](https://github.com/facebookresearch/habitat-sim/releases)? Your question may already be addressed in the latest versions. We may also not be able to help with problems in earlier versions because they sometimes lack the more verbose logging needed for debugging.
13
+
14
+ Master branch contains 'bleeding edge' code and should be used at your own risk.
15
+
16
+ ## Docs and Tutorials
17
+ Did you read the docs? https://aihabitat.org/docs/habitat-lab/
18
+
19
+ Did you check out the tutorials? https://aihabitat.org/tutorial/2020/
20
+
21
+ Perhaps your question is answered there. If not, carry on!
22
+
23
+ ## ❓ Questions and Help
habitat-lab/.github/PULL_REQUEST_TEMPLATE.md ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Motivation and Context
2
+
3
+ <!--- Why is this change required? What problem does it solve? -->
4
+ <!--- Please link to an existing issue here if one exists. -->
5
+ <!--- (we recommend to have an existing issue for each pull request) -->
6
+
7
+ ## How Has This Been Tested
8
+
9
+ <!--- Please describe here how your modifications have been tested. -->
10
+
11
+ ## Types of changes
12
+
13
+ <!--- What types of changes does your code introduce? Please mark the title of your pull request with one of the following -->
14
+ - **\[Docs change\]** Addition or changes to the documentation
15
+ - **\[Refactoring\]** Large changes to the code that improve its functionality or performance
16
+ - **\[Dependency Upgrade\]** Upgrades one or several dependencies in habitat
17
+ - **\[Bug Fix\]** (non-breaking change which fixes an issue)
18
+ - **\[Development\]** A pull request that add new features to the [habitat-lab](/habitat-lab) task and environment codebase. Development Pull Requests must be small (less that 500 lines of code change), have unit testing, very extensive documentation and examples. These are typically new tasks, environments, sensors, etc... The review process for these Pull Request is longer because these changes will be maintained by our core team of developers, so make sure your changes are easy to understand!
19
+ - **\[Experiment\]** A pull request that add new features to the [habitat-baselines](/habitat-baselines/) training codebase. Experiments Pull Requests can be any size, must have smoke/integration tests and be isolated from the rest of the code. Your code additions should not rely on other habitat-baselines code. This is to avoid dependencies between different parts of habitat-baselines. You must also include a README that will document how to use your new feature or trainer. **You** will be the maintainer of this code, if the code becomes stale or is not supported often enough, we will eventually remove it.
20
+
21
+ ## Checklist
22
+
23
+ <!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
24
+ <!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
25
+ - [ ] My code follows the code style of this project.
26
+ - [ ] I have updated the documentation if required.
27
+ - [ ] I have read the [**CONTRIBUTING**](/CONTRIBUTING.md) document.
28
+ - [ ] I have completed my CLA (see **CONTRIBUTING**)
29
+ - [ ] I have added tests to cover my changes if required.
habitat-lab/.gitignore ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+
5
+ # C extensions
6
+ *.so
7
+
8
+ # Distribution / packaging
9
+ .Python
10
+ */env/
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ *.egg-info/
23
+ .installed.cfg
24
+ *.egg
25
+
26
+ # Hydra
27
+ outputs/
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .coverage
43
+ .coverage.*
44
+ .cache
45
+ nosetests.xml
46
+ coverage.xml
47
+ *,cover
48
+ examples/images
49
+
50
+ # Translations
51
+ *.mo
52
+ *.pot
53
+
54
+ # Django stuff:
55
+ *.log
56
+
57
+ # Sphinx documentation
58
+ docs/_build/
59
+
60
+ # PyBuilder
61
+ target/
62
+
63
+ # DotEnv configuration
64
+ .env
65
+
66
+ # Database
67
+ *.db
68
+ *.rdb
69
+
70
+ # Pycharm
71
+ .idea
72
+
73
+ # VS Code
74
+ .vscode/
75
+
76
+ # Spyder
77
+ .spyproject/
78
+
79
+ # Jupyter NB Checkpoints
80
+ .ipynb_checkpoints/
81
+
82
+ # exclude data from source control by default
83
+ data
84
+
85
+ # Mac OS-specific storage files
86
+ .DS_Store
87
+
88
+ # mypy
89
+ .mypy_cache/
90
+
91
+ # vim
92
+ *.swp
93
+
94
+ # habitat_baselines outputs
95
+ /videos
96
+ /train_dir
97
+ /tb
98
+
99
+ # outputs from other libraries
100
+ /sandbox
101
+ /plots/outputs
102
+ /wandb/
habitat-lab/.pre-commit-config.yaml ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ exclude: 'build|src/deps|src/obsolete'
2
+
3
+ default_language_version:
4
+ python: python3
5
+
6
+ repos:
7
+ - repo: https://github.com/pre-commit/pre-commit-hooks
8
+ rev: v4.2.0
9
+ hooks:
10
+ - id: trailing-whitespace
11
+ - id: check-added-large-files
12
+ args: ['--maxkb=2000']
13
+ - id: end-of-file-fixer
14
+ - id: debug-statements
15
+ - id: check-case-conflict
16
+ - id: check-docstring-first
17
+ - id: check-executables-have-shebangs
18
+ - id: check-merge-conflict
19
+ - id: check-toml
20
+ - id: check-yaml
21
+ - id: mixed-line-ending
22
+ args: ['--fix=lf']
23
+
24
+ - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
25
+ rev: v2.3.0
26
+ hooks:
27
+ - id: pretty-format-ini
28
+ args: [--autofix]
29
+ - id: pretty-format-toml
30
+ args: [--autofix]
31
+ additional_dependencies:
32
+ - toml-sort==0.21.0
33
+
34
+ - repo: https://github.com/pre-commit/pygrep-hooks
35
+ rev: v1.9.0 # Use the ref you want to point at
36
+ hooks:
37
+ - id: python-check-blanket-noqa
38
+ # TODO: Add blanket type ignore check as well
39
+
40
+ - repo: https://github.com/timothycrosley/isort
41
+ rev: 5.11.5
42
+ hooks:
43
+ - id: isort
44
+ exclude: docs/|examples/tutorials/(colabs|nb_python)/(.*\.py|.*\.ipynb)$
45
+ additional_dependencies: [toml]
46
+
47
+ - repo: https://github.com/ambv/black
48
+ rev: 23.1.0
49
+ hooks:
50
+ - id: black
51
+ exclude: ^examples/tutorials/(nb_python|colabs)
52
+
53
+ - repo: https://github.com/myint/autoflake
54
+ rev: v1.4
55
+ hooks:
56
+ - id: autoflake
57
+ args: ['--expand-star-imports', '--ignore-init-module-imports', '--in-place']
58
+ exclude: docs/
59
+
60
+ - repo: https://github.com/PyCQA/flake8
61
+ rev: 4.0.1
62
+ hooks:
63
+ - id: flake8
64
+ exclude: docs/
65
+ additional_dependencies:
66
+ - flake8-bugbear==22.4.25
67
+ - flake8-builtins==1.5.3
68
+ - flake8-comprehensions==3.8.0
69
+ - flake8-return==1.1.3
70
+ - flake8-simplify==0.18.2
71
+
72
+ - repo: https://github.com/pre-commit/mirrors-mypy
73
+ rev: v0.991
74
+ hooks:
75
+ - id: mypy
76
+ # https://github.com/python/mypy/issues/4008
77
+ exclude: "^docs/|setup.py$"
78
+ additional_dependencies:
79
+ - attrs>=19.1.0
80
+ - hydra-core>=1.2.0
81
+ - numpy>=1.20.0
82
+ - omegaconf>=2.2.3
83
+ - types-mock
84
+ - types-Pillow
85
+ - types-tqdm
86
+ - types-PyYAML
87
+
88
+ - repo: https://github.com/kynan/nbstripout
89
+ rev: 0.5.0
90
+ hooks:
91
+ - id: nbstripout
92
+ files: ".ipynb"
93
+
94
+ - repo: https://github.com/mwouts/jupytext
95
+ rev: v1.13.8
96
+ hooks:
97
+ - id: jupytext
98
+ files: '^examples/tutorials/(colabs|nb_python)/(.*\.py|.*\.ipynb)$'
99
+ args: [--update-metadata, '{"jupytext":{"notebook_metadata_filter":"all", "cell_metadata_filter":"-all"}, "accelerator":"GPU"}', --set-formats, 'nb_python//py:percent,colabs//ipynb,', --pipe, black, --pipe, 'isort - --treat-comment-as-code "# %%"', --pipe-fmt, 'py:percent', --sync]
100
+ additional_dependencies:
101
+ - 'nbformat<=5.0.8'
102
+ - black==23.1.0
103
+ - isort
104
+
105
+ - repo: https://github.com/shellcheck-py/shellcheck-py
106
+ rev: v0.8.0.4
107
+ hooks:
108
+ - id: shellcheck
109
+
110
+ - repo: https://github.com/AleksaC/circleci-cli-py
111
+ rev: v0.1.17183
112
+ hooks:
113
+ - id: circle-ci-validator
habitat-lab/CODE_OF_CONDUCT.md ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # Code of Conduct
2
+
3
+ Facebook has adopted a Code of Conduct that we expect project participants to adhere to.
4
+ Please read the [full text](https://code.fb.com/codeofconduct/)
5
+ so that you can understand what actions will and will not be tolerated.
habitat-lab/CONTRIBUTING.md ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributing to habitat-lab
2
+ We want to make contributing to this project as easy and transparent as
3
+ possible.
4
+
5
+
6
+
7
+ ## Notes on Pull Requests
8
+ We actively welcome your pull requests.
9
+
10
+ 1. Fork the repo and create your branch from `main`.
11
+ 2. If you've added code that should be tested, add tests.
12
+ 3. If you've changed APIs, update the documentation.
13
+ 4. Ensure the test suite passes.
14
+ 5. Make sure your code lints.
15
+ 6. If you haven't already, complete the Contributor License Agreement ("CLA").
16
+ 7. We have adopted squash-and-merge as the policy for incorporating PRs into the `main` branch.
17
+ 8. We would rather have several smaller pull requests that a single large Pull Request since smaller self-contained changes are easier to review.
18
+
19
+ We accept these types of Pull Requests. Make sure your Pull Requests are not a mix of different types since they have different review processes.
20
+
21
+ **Docs change** which adds to or changes the documentation
22
+
23
+ **Refactoring** that changes the code to improve its functionality or performance
24
+
25
+ **Dependency Upgrade** of one or several dependencies in habitat
26
+
27
+ **Bug Fix** which are non-breaking change which fixes an issue
28
+
29
+ **Development Pull Requests** that add new features to the [habitat-lab](/habitat-lab) task and environment codebase. Development Pull Requests must be small, have unit testing, very extensive documentation and examples. These are typically new tasks, environments, sensors, etc... The review process for these Pull Request is longer because these changes will be maintained by our core team of developers, so make sure your changes are easy to understand!
30
+
31
+ **Experiments Pull Requests** that add new features to the [habitat-baselines](/habitat-baselines/) training codebase. Experiments Pull Requests can be any size, must have smoke/integration tests and be isolated from the rest of the code. Your code additions should not rely on other habitat-baselines code. This is to avoid dependencies between different parts of habitat-baselines. You must also include a README that will document how to use your new feature or trainer. **You** will be the maintainer of this code, if the code becomes stale and is not supported often enough, we will eventually remove it.
32
+
33
+ __Note:__ Pull Requests are not the only way to share your work with habitat. You can extend the functionality of Habitat in your own code base by importing and using the Habitat Sim, Habitat Lab, and Habitat Baselines API. If you have a cool project that uses this API, let us know and we might link to your work in our documentation! We encourage using the Habitat-Lab API in your codebase instead of forking the entirety of Habitat-Lab.
34
+
35
+
36
+ ## Contributor License Agreement ("CLA")
37
+ In order to accept your pull request, we need you to submit a CLA. You only need
38
+ to do this once to work on any of Facebook's open source projects.
39
+
40
+ Complete your CLA here: <https://code.facebook.com/cla>
41
+
42
+ ## Issues
43
+ We use [GitHub issues](../../issues) to track public bugs. Please ensure your description is
44
+ clear and has sufficient instructions to be able to reproduce the issue.
45
+
46
+ ## Test
47
+ We use pytest testing framework and testing data that needs to be downloaded, please make sure that test are passing:
48
+ ```
49
+ python -m pytest
50
+ ```
51
+
52
+ ## Check typing
53
+ We use mypy to check Python typing and guard API consistency, please make sure next command doesn't complain prior to submission:
54
+ ```
55
+ mypy . --ignore-missing-imports
56
+ ```
57
+
58
+ ## Coding Style
59
+ - We follow PEP8 and use [typing](https://docs.python.org/3/library/typing.html).
60
+ - Use `black` for style enforcement and linting. Install black through `pip install black`.
61
+
62
+ We also use pre-commit hooks to ensure linting and style enforcement. Install the pre-commit hooks with `pip install pre-commit && pre-commit install`.
63
+
64
+ ## Documentation
65
+ - Our documentation style is based on Magnum / Corrade and uses [a similar build system](https://mcss.mosra.cz/documentation/doxygen/).
66
+ - Documentation of PRs is required!
67
+
68
+ ## License
69
+ By contributing to habitat-lab, you agree that your contributions will be licensed
70
+ under the LICENSE file in the root directory of this source tree.
habitat-lab/DATASETS.md ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ To make things easier we expect `data` folder of particular structure or symlink presented in habitat-lab working directory.
2
+
3
+ ### Scenes datasets
4
+
5
+ | Scenes models | Extract path | Archive size |
6
+ | --- | --- | --- |
7
+ | [Habitat test scenes](https://github.com/facebookresearch/habitat-sim/blob/main/DATASETS.md#habitat-test-scenes) | `data/scene_datasets/habitat-test-scenes/{scene}.glb` | 89 MB |
8
+ | 🆕[ReplicaCAD](https://github.com/facebookresearch/habitat-sim/blob/main/DATASETS.md#replicacad) | `data/scene_datasets/replica_cad/configs/scenes/{scene}.scene_instance.json` | 123 MB |
9
+ | 🆕[HM3D](https://github.com/facebookresearch/habitat-sim/blob/main/DATASETS.md#habitat-matterport-3d-research-dataset-hm3d) | `data/scene_datasets/hm3d/{split}/00\d\d\d-{scene}/{scene}.basis.glb` | 130 GB |
10
+ | [Gibson](https://github.com/facebookresearch/habitat-sim/blob/main/DATASETS.md#gibson-and-3dscenegraph-datasets) | `data/scene_datasets/gibson/{scene}.glb` | 1.5 GB |
11
+ | [MatterPort3D](https://github.com/facebookresearch/habitat-sim/blob/main/DATASETS.md#matterport3d-mp3d-dataset) | `data/scene_datasets/mp3d/{scene}/{scene}.glb` | 15 GB |
12
+
13
+ These datasets can be downloaded follow the instructions [here](https://github.com/facebookresearch/habitat-sim/blob/main/DATASETS.md).
14
+
15
+ ### Task datasets
16
+
17
+ | Task | Scenes | Link | Extract path | Config to use | Archive size |
18
+ | --- | --- | --- | --- |------------------------------------------------------------------------------------------------------------------------| --- |
19
+ | 🆕[Rearrange Pick](https://arxiv.org/abs/2106.14405) | ReplicaCAD | [rearrange_pick_replica_cad_v0.zip](https://dl.fbaipublicfiles.com/habitat/data/datasets/rearrange_pick/replica_cad/v0/rearrange_pick_replica_cad_v0.zip) | `data/datasets/rearrange_pick/replica_cad/v0/` | [`datasets/rearrangepick/replica_cad.yaml`](habitat-lab/habitat/config/habitat/dataset/rearrangement/replica_cad.yaml) | 11 MB |
20
+ | [Point goal navigation](https://arxiv.org/abs/1807.06757) | Gibson | [pointnav_gibson_v1.zip](https://dl.fbaipublicfiles.com/habitat/data/datasets/pointnav/gibson/v1/pointnav_gibson_v1.zip) | `data/datasets/pointnav/gibson/v1/` | [`datasets/pointnav/gibson.yaml`](habitat-lab/habitat/config/habitat/dataset/pointnav/gibson.yaml) | 385 MB |
21
+ | 🆕[Point goal navigation](https://arxiv.org/abs/1807.06757) | Gibson 0+ (train) | [pointnav_gibson_0_plus_v1.zip](https://dl.fbaipublicfiles.com/habitat/data/datasets/pointnav/gibson/v1/pointnav_gibson_0_plus_v1.zip) | `data/datasets/pointnav/gibson/v1/` | [`datasets/pointnav/gibson_0_plus.yaml`](habitat-lab/habitat/config/habitat/dataset/pointnav/gibson_0_plus.yaml) | 321 MB |
22
+ | [Point goal navigation corresponding to Sim2LoCoBot experiment configuration](https://arxiv.org/abs/1912.06321) | Gibson | [pointnav_gibson_v2.zip](https://dl.fbaipublicfiles.com/habitat/data/datasets/pointnav/gibson/v2/pointnav_gibson_v2.zip) | `data/datasets/pointnav/gibson/v2/` | [`datasets/pointnav/gibson_v2.yaml`](habitat-lab/habitat/config/habitat/dataset/pointnav/gibson_v2.yaml) | 274 MB |
23
+ | [Point goal navigation](https://arxiv.org/abs/1807.06757) | MatterPort3D | [pointnav_mp3d_v1.zip](https://dl.fbaipublicfiles.com/habitat/data/datasets/pointnav/mp3d/v1/pointnav_mp3d_v1.zip) | `data/datasets/pointnav/mp3d/v1/` | [`datasets/pointnav/mp3d.yaml`](habitat-lab/habitat/config/habitat/dataset/pointnav/mp3d.yaml) | 400 MB |
24
+ | 🆕[Point goal navigation](https://arxiv.org/abs/1807.06757) | HM3D | [pointnav_hm3d_v1.zip](https://dl.fbaipublicfiles.com/habitat/data/datasets/pointnav/hm3d/v1/pointnav_hm3d_v1.zip) | `data/datasets/pointnav/hm3d/v1/` | [`datasets/pointnav/hm3d.yaml`](habitat-lab/habitat/config/habitat/dataset/pointnav/hm3d.yaml) | 992 MB |
25
+ | [Object goal navigation](https://arxiv.org/abs/2006.13171) | MatterPort3D | [objectnav_mp3d_v1.zip](https://dl.fbaipublicfiles.com/habitat/data/datasets/objectnav/m3d/v1/objectnav_mp3d_v1.zip) | `data/datasets/objectnav/mp3d/v1/` | [`datasets/objectnav/mp3d.yaml`](habitat-lab/habitat/config/habitat/dataset/objectnav/mp3d.yaml) | 170 MB |
26
+ | 🆕[Object goal navigation](https://arxiv.org/abs/2006.13171) | HM3DSem-v0.1 | [objectnav_hm3d_v1.zip](https://dl.fbaipublicfiles.com/habitat/data/datasets/objectnav/hm3d/v1/objectnav_hm3d_v1.zip) | `data/datasets/objectnav/hm3d/v1/` | [`datasets/objectnav/hm3d.yaml`](habitat-lab/habitat/config/habitat/dataset/objectnav/hm3d.yaml) | 154 MB |
27
+ | 🆕[Object goal navigation](https://arxiv.org/abs/2006.13171) | HM3DSem-v0.2 | [objectnav_hm3d_v2.zip](https://dl.fbaipublicfiles.com/habitat/data/datasets/objectnav/hm3d/v2/objectnav_hm3d_v2.zip) | `data/datasets/objectnav/hm3d/v2/` | [`datasets/objectnav/hm3d_v2.yaml`](habitat-lab/habitat/config/habitat/dataset/objectnav/hm3d_v2.yaml) | 245 MB |
28
+ | [Embodied Question Answering](https://embodiedqa.org/) | MatterPort3D | [eqa_mp3d_v1.zip](https://dl.fbaipublicfiles.com/habitat/data/datasets/eqa/mp3d/v1/eqa_mp3d_v1.zip) | `data/datasets/eqa/mp3d/v1/` | [`datasets/eqa/mp3d.yaml`](habitat-lab/habitat/config/habitat/dataset/eqa/mp3d.yaml) | 44 MB |
29
+ | [Visual Language Navigation](https://bringmeaspoon.org/) | MatterPort3D | [vln_r2r_mp3d_v1.zip](https://dl.fbaipublicfiles.com/habitat/data/datasets/vln/mp3d/r2r/v1/vln_r2r_mp3d_v1.zip) | `data/datasets/vln/mp3d/r2r/v1` | [`datasets/vln/mp3d_r2r.yaml`](habitat-lab/habitat/config/habitat/dataset/vln/mp3d_r2r.yaml) | 2.7 MB |
30
+ | [Instance image goal navigation](https://arxiv.org/abs/2211.15876) | HM3DSem-v0.1 | [instance_imagenav_hm3d_v1.zip](https://dl.fbaipublicfiles.com/habitat/data/datasets/imagenav/hm3d/v1/instance_imagenav_hm3d_v1.zip) | `data/datasets/instance_imagenav/hm3d/v1/` | [`datasets/instance_imagenav/hm3d_v1.yaml`](habitat-lab/habitat/config/habitat/dataset/instance_imagenav/hm3d_v1.yaml) | 303 MB |
31
+ | [Instance image goal navigation](https://arxiv.org/abs/2211.15876) | HM3DSem-v0.2 | [instance_imagenav_hm3d_v2.zip](https://dl.fbaipublicfiles.com/habitat/data/datasets/imagenav/hm3d/v2/instance_imagenav_hm3d_v2.zip) | `data/datasets/instance_imagenav/hm3d/v2/` | [`datasets/instance_imagenav/hm3d_v2.yaml`](habitat-lab/habitat/config/habitat/dataset/instance_imagenav/hm3d_v2.yaml) | 518 MB |
32
+ | 🆕 [Instance image goal navigation](https://arxiv.org/abs/2211.15876) | HM3DSem-v0.2 | [instance_imagenav_hm3d_v3.zip](https://dl.fbaipublicfiles.com/habitat/data/datasets/imagenav/hm3d/v3/instance_imagenav_hm3d_v3.zip) | `data/datasets/instance_imagenav/hm3d/v3/` | [`datasets/instance_imagenav/hm3d_v3.yaml`](habitat-lab/habitat/config/habitat/dataset/instance_imagenav/hm3d_v3.yaml) | 517 MB |
33
+ | [Image goal navigation](https://github.com/facebookresearch/habitat-lab/pull/333) | Gibson | [pointnav_gibson_v1.zip](https://dl.fbaipublicfiles.com/habitat/data/datasets/pointnav/gibson/v1/pointnav_gibson_v1.zip) | `data/datasets/pointnav/gibson/v1/` | [`datasets/imagenav/gibson.yaml`](habitat-lab/habitat/config/habitat/dataset/imagenav/gibson.yaml) | 385 MB |
34
+ | [Image goal navigation](https://github.com/facebookresearch/habitat-lab/pull/333) | MatterPort3D | [pointnav_mp3d_v1.zip](https://dl.fbaipublicfiles.com/habitat/data/datasets/pointnav/mp3d/v1/pointnav_mp3d_v1.zip) | `data/datasets/pointnav/mp3d/v1/` | [`datasets/imagenav/mp3d.yaml`](habitat-lab/habitat/config/habitat/dataset/imagenav/mp3d.yaml) | 400 MB |
35
+
36
+ To use an episode dataset, provide the related config to the Env in [the example](examples/example.py) or use the config for [RL agent training](habitat-baselines/habitat_baselines/README.md#reinforcement-learning-rl).
habitat-lab/DETAILS.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Details
2
+ An important objective of Habitat-Lab is to make it easy for users to set up a variety of embodied agent tasks in 3D environments. The process of setting up a task involves using environment information provided by the simulator, connecting the information with a dataset (e.g. PointGoal targets, or question and answer pairs for Embodied QA) and providing observations which can be used by the agents. Keeping this primary objective in mind the core API defines the following key concepts as abstractions that can be extended:
3
+
4
+ * `Env`: the fundamental environment concept for Habitat. All the information needed for working on embodied tasks with a simulator is abstracted inside an Env. This class acts as a base for other derived environment classes. Env consists of three major components: a Simulator, a Dataset (containing Episodes), and a Task, and it serves to connects all these three components together.
5
+
6
+ * `Dataset`: contains a list of task-specific episodes from a particular data split and additional dataset-wide information. Handles loading and saving of a dataset to disk, getting a list of scenes, and getting a list of episodes for a particular scene.
7
+
8
+ * `Episode`: a class for episode specification that includes the initial position and orientation of an Agent, a scene id, a goal position and optionally shortest paths to the goal. An episode is a description of one task instance for the agent.
9
+
10
+ <p align="center">
11
+ <img src='res/img/habitat_lab_structure.png' alt="teaser results" width="100%"/>
12
+ <p align="center"><i>Architecture of Habitat-Lab</i></p>
13
+ </p>
14
+
15
+ * `Task`: this class builds on top of the simulator and dataset. The criteria of episode termination and measures of success are provided by the Task.
16
+
17
+ * `Sensor`: a generalization of the physical Sensor concept provided by a Simulator, with the capability to provide Task-specific Observation data in a specified format.
18
+
19
+ * `Observation`: data representing an observation from a Sensor. This can correspond to physical sensors on an Agent (e.g. RGB, depth, semantic segmentation masks, collision sensors) or more abstract sensors such as the current agent state.
20
+
21
+ Note that the core functionality defines fundamental building blocks such as the API for interacting with the simulator backend, and receiving observations through Sensors. Concrete simulation backends, 3D datasets, and embodied agent baselines are implemented on top of the core API.
habitat-lab/Dockerfile ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Base image
2
+ FROM nvidia/cudagl:10.1-devel-ubuntu16.04
3
+
4
+ # Setup basic packages
5
+ RUN apt-get update && apt-get install -y --no-install-recommends \
6
+ build-essential \
7
+ git \
8
+ curl \
9
+ vim \
10
+ ca-certificates \
11
+ libjpeg-dev \
12
+ libpng-dev \
13
+ libglfw3-dev \
14
+ libglm-dev \
15
+ libx11-dev \
16
+ libomp-dev \
17
+ libegl1-mesa-dev \
18
+ pkg-config \
19
+ wget \
20
+ zip \
21
+ unzip &&\
22
+ rm -rf /var/lib/apt/lists/*
23
+
24
+ # Install conda
25
+ RUN curl -L -o ~/miniconda.sh -O https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh &&\
26
+ chmod +x ~/miniconda.sh &&\
27
+ ~/miniconda.sh -b -p /opt/conda &&\
28
+ rm ~/miniconda.sh &&\
29
+ /opt/conda/bin/conda install numpy pyyaml scipy ipython mkl mkl-include &&\
30
+ /opt/conda/bin/conda clean -ya
31
+ ENV PATH /opt/conda/bin:$PATH
32
+
33
+ # Install cmake
34
+ RUN wget https://github.com/Kitware/CMake/releases/download/v3.14.0/cmake-3.14.0-Linux-x86_64.sh
35
+ RUN mkdir /opt/cmake
36
+ RUN sh /cmake-3.14.0-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
37
+ RUN ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
38
+ RUN cmake --version
39
+
40
+ # Conda environment
41
+ RUN conda create -n habitat python=3.9 cmake=3.14.0
42
+
43
+ # Setup habitat-sim
44
+ RUN git clone --branch stable https://github.com/facebookresearch/habitat-sim.git
45
+ RUN /bin/bash -c ". activate habitat; cd habitat-sim; pip install -r requirements.txt; python setup.py install --headless"
46
+
47
+ # Install challenge specific habitat-lab
48
+ RUN git clone --branch stable https://github.com/facebookresearch/habitat-lab.git
49
+ RUN /bin/bash -c ". activate habitat; cd habitat-lab; pip install -e habitat-lab/"
50
+
51
+ # Silence habitat-sim logs
52
+ ENV GLOG_minloglevel=2
53
+ ENV MAGNUM_LOG="quiet"
habitat-lab/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) Meta Platforms, Inc. and its affiliates.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
habitat-lab/README.md ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [![CircleCI](https://circleci.com/gh/facebookresearch/habitat-lab.svg?style=shield)](https://circleci.com/gh/facebookresearch/habitat-lab)
2
+ [![codecov](https://codecov.io/gh/facebookresearch/habitat-lab/branch/main/graph/badge.svg)](https://codecov.io/gh/facebookresearch/habitat-lab)
3
+ [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/facebookresearch/habitat-lab/blob/main/LICENSE)
4
+ [![GitHub release (latest by date)](https://img.shields.io/github/v/release/facebookresearch/habitat-lab)](https://github.com/facebookresearch/habitat-lab/releases/latest)
5
+ [![Supports Habitat_Sim](https://img.shields.io/static/v1?label=supports&message=Habitat%20Sim&color=informational&link=https://github.com/facebookresearch/habitat-sim)](https://github.com/facebookresearch/habitat-sim)
6
+ [![Python 3.9](https://img.shields.io/badge/python-3.9-blue.svg)](https://www.python.org/downloads/release/python-390/)
7
+ [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
8
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
9
+ [![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://timothycrosley.github.io/isort/)
10
+ [![Twitter Follow](https://img.shields.io/twitter/follow/ai_habitat?style=social)](https://twitter.com/ai_habitat)
11
+
12
+ Habitat-Lab
13
+ ==============================
14
+
15
+ Habitat-Lab is a modular high-level library for end-to-end development in embodied AI --
16
+ defining embodied AI tasks (e.g. navigation, rearrangement, instruction following, question answering), configuring embodied agents (physical form, sensors, capabilities), training these agents (via imitation or reinforcement learning, or no learning at all as in SensePlanAct pipelines), and benchmarking their performance on the defined tasks using standard metrics.
17
+
18
+ Habitat-Lab uses [`Habitat-Sim`](https://github.com/facebookresearch/habitat-sim) as the core simulator. For documentation refer [here](https://aihabitat.org/docs/habitat-lab/).
19
+
20
+ [![Habitat Demo](https://img.shields.io/static/v1?label=WebGL&message=Try%20AI%20Habitat%20In%20Your%20Browser%20&color=blue&logo=webgl&labelColor=%23990000&style=for-the-badge&link=https://aihabitat.org/demo)](https://aihabitat.org/demo)
21
+ <p align="center">
22
+ <img src="res/img/habitat_compressed.gif" height="400">
23
+ </p>
24
+
25
+ ---
26
+
27
+ ## Table of contents
28
+ 1. [Citing Habitat](#citing-habitat)
29
+ 1. [Installation](#installation)
30
+ 1. [Testing](#testing)
31
+ 1. [Documentation](#documentation)
32
+ 1. [Docker Setup](#docker-setup)
33
+ 1. [Datasets](#datasets)
34
+ 1. [Baselines](#baselines)
35
+ 1. [License](#license)
36
+
37
+
38
+ ## Citing Habitat
39
+ If you use the Habitat platform in your research, please cite the [Habitat 1.0](https://arxiv.org/abs/1904.01201) and [Habitat 2.0](https://arxiv.org/abs/2106.14405) papers:
40
+
41
+ ```
42
+ @inproceedings{szot2021habitat,
43
+ title = {Habitat 2.0: Training Home Assistants to Rearrange their Habitat},
44
+ author = {Andrew Szot and Alex Clegg and Eric Undersander and Erik Wijmans and Yili Zhao and John Turner and Noah Maestre and Mustafa Mukadam and Devendra Chaplot and Oleksandr Maksymets and Aaron Gokaslan and Vladimir Vondrus and Sameer Dharur and Franziska Meier and Wojciech Galuba and Angel Chang and Zsolt Kira and Vladlen Koltun and Jitendra Malik and Manolis Savva and Dhruv Batra},
45
+ booktitle = {Advances in Neural Information Processing Systems (NeurIPS)},
46
+ year = {2021}
47
+ }
48
+
49
+ @inproceedings{habitat19iccv,
50
+ title = {Habitat: {A} {P}latform for {E}mbodied {AI} {R}esearch},
51
+ author = {Manolis Savva and Abhishek Kadian and Oleksandr Maksymets and Yili Zhao and Erik Wijmans and Bhavana Jain and Julian Straub and Jia Liu and Vladlen Koltun and Jitendra Malik and Devi Parikh and Dhruv Batra},
52
+ booktitle = {Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV)},
53
+ year = {2019}
54
+ }
55
+ ```
56
+
57
+ ## Installation
58
+
59
+ 1. **Preparing conda env**
60
+
61
+ Assuming you have [conda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/) installed, let's prepare a conda env:
62
+ ```bash
63
+ # We require python>=3.9 and cmake>=3.14
64
+ conda create -n habitat python=3.9 cmake=3.14.0
65
+ conda activate habitat
66
+ ```
67
+
68
+ 1. **conda install habitat-sim**
69
+ - To install habitat-sim with bullet physics
70
+ ```
71
+ conda install habitat-sim withbullet -c conda-forge -c aihabitat
72
+ ```
73
+ See Habitat-Sim's [installation instructions](https://github.com/facebookresearch/habitat-sim#installation) for more details.
74
+
75
+ 1. **pip install habitat-lab stable version**.
76
+
77
+ ```bash
78
+ git clone --branch stable https://github.com/facebookresearch/habitat-lab.git
79
+ cd habitat-lab
80
+ pip install -e habitat-lab # install habitat_lab
81
+ ```
82
+ 1. **Install habitat-baselines**.
83
+
84
+ The command above will install only core of Habitat-Lab. To include habitat_baselines along with all additional requirements, use the command below after installing habitat-lab:
85
+
86
+ ```bash
87
+ pip install -e habitat-baselines # install habitat_baselines
88
+ ```
89
+
90
+ ## Testing
91
+
92
+ 1. Let's download some 3D assets using Habitat-Sim's python data download utility:
93
+ - Download (testing) 3D scenes:
94
+ ```bash
95
+ python -m habitat_sim.utils.datasets_download --uids habitat_test_scenes --data-path data/
96
+ ```
97
+ Note that these testing scenes do not provide semantic annotations.
98
+
99
+ - Download point-goal navigation episodes for the test scenes:
100
+ ```bash
101
+ python -m habitat_sim.utils.datasets_download --uids habitat_test_pointnav_dataset --data-path data/
102
+ ```
103
+
104
+ 1. **Non-interactive testing**: Test the Pick task: Run the example pick task script
105
+ <!--- Please, update `examples/example.py` if you update example. -->
106
+ ```bash
107
+ python examples/example.py
108
+ ```
109
+
110
+ which uses [`habitat-lab/habitat/config/benchmark/rearrange/pick.yaml`](habitat-lab/habitat/config/benchmark/rearrange/pick.yaml) for configuration of task and agent. The script roughly does this:
111
+
112
+ ```python
113
+ import gym
114
+ import habitat.gym
115
+
116
+ # Load embodied AI task (RearrangePick) and a pre-specified virtual robot
117
+ env = gym.make("HabitatRenderPick-v0")
118
+ observations = env.reset()
119
+
120
+ terminal = False
121
+
122
+ # Step through environment with random actions
123
+ while not terminal:
124
+ observations, reward, terminal, info = env.step(env.action_space.sample())
125
+ ```
126
+
127
+ To modify some of the configurations of the environment, you can also use the `habitat.gym.make_gym_from_config` method that allows you to create a habitat environment using a configuration.
128
+
129
+ ```python
130
+ config = habitat.get_config(
131
+ "benchmark/rearrange/pick.yaml",
132
+ overrides=["habitat.environment.max_episode_steps=20"]
133
+ )
134
+ env = habitat.gym.make_gym_from_config(config)
135
+ ```
136
+
137
+ If you want to know more about what the different configuration keys overrides do, you can use [this reference](habitat-lab/habitat/config/CONFIG_KEYS.md).
138
+
139
+ See [`examples/register_new_sensors_and_measures.py`](examples/register_new_sensors_and_measures.py) for an example of how to extend habitat-lab from _outside_ the source code.
140
+
141
+
142
+
143
+ 1. **Interactive testing**: Using you keyboard and mouse to control a Fetch robot in a ReplicaCAD environment:
144
+ ```bash
145
+ # Pygame for interactive visualization, pybullet for inverse kinematics
146
+ pip install pygame==2.0.1 pybullet==3.0.4
147
+
148
+ # Interactive play script
149
+ python examples/interactive_play.py --never-end
150
+ ```
151
+
152
+ Use I/J/K/L keys to move the robot base forward/left/backward/right and W/A/S/D to move the arm end-effector forward/left/backward/right and E/Q to move the arm up/down. The arm can be difficult to control via end-effector control. More details in documentation. Try to move the base and the arm to touch the red bowl on the table. Have fun!
153
+
154
+ Note: Interactive testing currently fails on Ubuntu 20.04 with an error: `X Error of failed request: BadAccess (attempt to access private resource denied)`. We are working on fixing this, and will update instructions once we have a fix. The script works without errors on MacOS.
155
+
156
+ ## Debugging an environment issue
157
+
158
+ Our vectorized environments are very fast, but they are not very verbose. When using `VectorEnv` some errors may be silenced, resulting in process hanging or multiprocessing errors that are hard to interpret. We recommend setting the environment variable `HABITAT_ENV_DEBUG` to 1 when debugging (`export HABITAT_ENV_DEBUG=1`) as this will use the slower, but more verbose `ThreadedVectorEnv` class. Do not forget to reset `HABITAT_ENV_DEBUG` (`unset HABITAT_ENV_DEBUG`) when you are done debugging since `VectorEnv` is much faster than `ThreadedVectorEnv`.
159
+
160
+ ## Documentation
161
+
162
+ Browse the online [Habitat-Lab documentation](https://aihabitat.org/docs/habitat-lab/index.html) and the extensive [tutorial on how to train your agents with Habitat](https://aihabitat.org/tutorial/2020/). For Habitat 2.0, use this [quickstart guide](https://aihabitat.org/docs/habitat2/).
163
+
164
+
165
+ ## Docker Setup
166
+ We provide docker containers for Habitat, updated approximately once per year for the [Habitat Challenge](https://github.com/facebookresearch/habitat-challenge). This works on machines with an NVIDIA GPU and requires users to install [nvidia-docker](https://github.com/NVIDIA/nvidia-docker). To setup the habitat stack using docker follow the below steps:
167
+
168
+ 1. Pull the habitat docker image: `docker pull fairembodied/habitat-challenge:testing_2022_habitat_base_docker`
169
+
170
+ 1. Start an interactive bash session inside the habitat docker: `docker run --runtime=nvidia -it fairembodied/habitat-challenge:testing_2022_habitat_base_docker`
171
+
172
+ 1. Activate the habitat conda environment: `conda init; source ~/.bashrc; source activate habitat`
173
+
174
+ 1. Run the testing scripts as above: `cd habitat-lab; python examples/example.py`. This should print out an output like:
175
+ ```bash
176
+ Agent acting inside environment.
177
+ Episode finished after 200 steps.
178
+ ```
179
+
180
+ ### Questions?
181
+ Can't find the answer to your question? Try asking the developers and community on our [Discussions forum](https://github.com/facebookresearch/habitat-lab/discussions).
182
+
183
+ ## Datasets
184
+
185
+ [Common task and episode datasets used with Habitat-Lab](DATASETS.md).
186
+
187
+ ## Baselines
188
+ Habitat-Lab includes reinforcement learning (via PPO) baselines. For running PPO training on sample data and more details refer [habitat_baselines/README.md](habitat-baselines/habitat_baselines/README.md).
189
+
190
+ ## ROS-X-Habitat
191
+ ROS-X-Habitat (https://github.com/ericchen321/ros_x_habitat) is a framework that bridges the AI Habitat platform (Habitat Lab + Habitat Sim) with other robotics resources via ROS. Compared with Habitat-PyRobot, ROS-X-Habitat places emphasis on 1) leveraging Habitat Sim v2's physics-based simulation capability and 2) allowing roboticists to access simulation assets from ROS. The work has also been made public as a [paper](https://arxiv.org/abs/2109.07703).
192
+
193
+ Note that ROS-X-Habitat was developed, and is maintained by the Lab for Computational Intelligence at UBC; it has not yet been officially supported by the Habitat Lab team. Please refer to the framework's repository for docs and discussions.
194
+
195
+
196
+ ## License
197
+ Habitat-Lab is MIT licensed. See the [LICENSE file](/LICENSE) for details.
198
+
199
+ The trained models and the task datasets are considered data derived from the correspondent scene datasets.
200
+
201
+ - Matterport3D based task datasets and trained models are distributed with [Matterport3D Terms of Use](http://kaldir.vc.in.tum.de/matterport/MP_TOS.pdf) and under [CC BY-NC-SA 3.0 US license](https://creativecommons.org/licenses/by-nc-sa/3.0/us/).
202
+ - Gibson based task datasets, the code for generating such datasets, and trained models are distributed with [Gibson Terms of Use](https://storage.googleapis.com/gibson_material/Agreement%20GDS%2006-04-18.pdf) and under [CC BY-NC-SA 3.0 US license](https://creativecommons.org/licenses/by-nc-sa/3.0/us/).
habitat-lab/docs/.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ m.math.cache
habitat-lab/docs/build-public.sh ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ # Copyright (c) Meta Platforms, Inc. and its affiliates.
4
+ # This source code is licensed under the MIT license found in the
5
+ # LICENSE file in the root directory of this source tree.
6
+
7
+ # Propagate failures properly
8
+ set -e
9
+
10
+ mcss_path=../../habitat-sim/docs/m.css
11
+
12
+ # Regenerate the compiled CSS file (yes, in the sim repository, to allow fast
13
+ # iterations from here as well)
14
+ $mcss_path/css/postprocess.py \
15
+ ../../habitat-sim/docs/theme.css \
16
+ $mcss_path/css/m-grid.css \
17
+ $mcss_path/css/m-components.css \
18
+ $mcss_path/css/m-layout.css \
19
+ ../../habitat-sim/docs/pygments-pastie.css \
20
+ $mcss_path/css/pygments-console.css \
21
+ $mcss_path/css/m-documentation.css \
22
+ -o ../../habitat-sim/docs/theme.compiled.css
23
+
24
+ $mcss_path/documentation/python.py conf-public.py
25
+
26
+ # The file:// URLs are usually clickable in the terminal, directly opening a
27
+ # browser
28
+ echo "------------------------------------------------------------------------"
29
+ echo "Public docs were successfully generated to the following location. Note"
30
+ echo "that the search functionality requires a web server in this case."
31
+ echo
32
+ echo "file://$(pwd)/../../habitat-sim/build/docs-public/habitat-lab/index.html"
habitat-lab/docs/build.sh ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ # Copyright (c) Meta Platforms, Inc. and its affiliates.
4
+ # This source code is licensed under the MIT license found in the
5
+ # LICENSE file in the root directory of this source tree.
6
+
7
+ # Propagate failures properly
8
+ set -e
9
+
10
+ if [[ $# -eq 1 ]]; then
11
+ export mcss_path=$1
12
+ elif [[ $# -ne 0 ]]; then
13
+ echo "usage: ./build.sh [path-to-m.css]"
14
+ exit 1
15
+ else
16
+ if [ ! -d ../../habitat-sim/docs/m.css ]; then
17
+ echo "m.css submodule not found in the sim repository, please run git submodule update --init there or specify the path to it"
18
+ exit 1
19
+ fi
20
+ mcss_path=../../habitat-sim/docs/m.css
21
+ fi
22
+
23
+ # Regenerate the compiled CSS file (yes, in the sim repository, to allow fast
24
+ # iterations from here as well)
25
+ $mcss_path/css/postprocess.py \
26
+ ../../habitat-sim/docs/theme.css \
27
+ $mcss_path/css/m-grid.css \
28
+ $mcss_path/css/m-components.css \
29
+ $mcss_path/css/m-layout.css \
30
+ ../../habitat-sim/docs/pygments-pastie.css \
31
+ $mcss_path/css/pygments-console.css \
32
+ $mcss_path/css/m-documentation.css \
33
+ -o ../../habitat-sim/docs/theme.compiled.css
34
+
35
+ $mcss_path/documentation/python.py conf.py
36
+
37
+ # The file:// URLs are usually clickable in the terminal, directly opening a
38
+ # browser
39
+ echo "------------------------------------------------------------------------"
40
+ echo "Docs were successfully generated. Open the following link to view them:"
41
+ echo
42
+ echo "file://$(pwd)/../../habitat-sim/build/docs/habitat-lab/index.html"
habitat-lab/docs/conf-public.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) Meta Platforms, Inc. and its affiliates.
2
+ # This source code is licensed under the MIT license found in the
3
+ # LICENSE file in the root directory of this source tree.
4
+
5
+ import os
6
+ import sys
7
+
8
+ sys.path.append(os.path.dirname(os.path.realpath(__file__)))
9
+
10
+ # Inherit everything from the local config
11
+ from conf import * # isort:skip
12
+
13
+ OUTPUT = "../../habitat-sim/build/docs-public/habitat-lab/"
14
+
15
+ SEARCH_DOWNLOAD_BINARY = "searchdata-v1.bin"
16
+ SEARCH_BASE_URL = "https://aihabitat.org/docs/habitat-lab/"
17
+ SEARCH_EXTERNAL_URL = "https://google.com/search?q=site:aihabitat.org+{query}"
18
+
19
+ M_SPHINX_INVENTORIES = [
20
+ (
21
+ "../../habitat-sim/docs/python.inv",
22
+ "https://docs.python.org/3/",
23
+ [],
24
+ ["m-doc-external"],
25
+ ),
26
+ (
27
+ "../../habitat-sim/docs/numpy.inv",
28
+ "https://docs.scipy.org/doc/numpy/",
29
+ [],
30
+ ["m-doc-external"],
31
+ ),
32
+ (
33
+ "../../habitat-sim/build/docs-public/habitat-sim/objects.inv",
34
+ "../habitat-sim/",
35
+ [],
36
+ ["m-doc-external"],
37
+ ),
38
+ ]
habitat-lab/docs/conf.py ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) Meta Platforms, Inc. and its affiliates.
2
+ # This source code is licensed under the MIT license found in the
3
+ # LICENSE file in the root directory of this source tree.
4
+
5
+ import os
6
+ import sys
7
+
8
+ # TODO make this less brittle
9
+ sys.path = [os.path.join(os.path.dirname(__file__), "../")] + sys.path
10
+
11
+ import habitat # isort:skip
12
+
13
+ import gym # isort:skip
14
+ import typing # isort:skip
15
+
16
+ # Override the typing annotation of _np_random of gym.Env since the type provided is
17
+ # "RandomNumberGenerator | None" and the "|" symbol for typing is not valid in Python <3.10
18
+ # Remove when upgrading to Python 3.10
19
+ gym.Env.__annotations__["_np_random"] = typing.Optional[
20
+ gym.utils.seeding.RandomNumberGenerator
21
+ ]
22
+
23
+
24
+ # Overrides the __all__ as that one pulls everything into the root module
25
+ # and doesn't expose any submodules
26
+ habitat.__all__ = ["config", "core", "Agent", "Benchmark", "gym"]
27
+ habitat.core.__all__ = [
28
+ "env",
29
+ "embodied_task",
30
+ "dataset",
31
+ "simulator",
32
+ "registry",
33
+ "vector_env",
34
+ ]
35
+
36
+ PROJECT_TITLE = "Habitat"
37
+ PROJECT_SUBTITLE = "Lab Docs"
38
+ PROJECT_LOGO = "../../habitat-sim/docs/habitat.svg"
39
+ FAVICON = "../../habitat-sim/docs/habitat-blue.png"
40
+ MAIN_PROJECT_URL = "/"
41
+ INPUT_MODULES = [habitat]
42
+ INPUT_DOCS = ["docs.rst"]
43
+ INPUT_PAGES = [
44
+ "pages/index.rst",
45
+ "pages/quickstart.rst",
46
+ "pages/habitat-lab-demo.rst",
47
+ "pages/habitat-lab-tdmap-viz.rst",
48
+ "pages/habitat2.rst",
49
+ "pages/view-transform-warp.rst",
50
+ ]
51
+
52
+ PLUGINS = [
53
+ "m.abbr",
54
+ "m.code",
55
+ "m.components",
56
+ "m.dox",
57
+ "m.gh",
58
+ "m.htmlsanity",
59
+ "m.images",
60
+ "m.link",
61
+ "m.math",
62
+ "m.sphinx",
63
+ ]
64
+
65
+ CLASS_INDEX_EXPAND_LEVELS = 2
66
+
67
+ PYBIND11_COMPATIBILITY = True
68
+ ATTRS_COMPATIBILITY = True
69
+
70
+ # Putting output into the sim repository so relative linking works the same
71
+ # way as on the website
72
+ OUTPUT = "../../habitat-sim/build/docs/habitat-lab/"
73
+
74
+ LINKS_NAVBAR1 = [
75
+ (
76
+ "Pages",
77
+ "pages",
78
+ [
79
+ ("Quickstart", "quickstart"),
80
+ ("Habitat Lab Demo", "habitat-lab-demo"),
81
+ ("Habitat Lab TopdownMap Visualization", "habitat-lab-tdmap-viz"),
82
+ ("Habitat 2.0 Overview", "habitat2"),
83
+ ("View, Transform and Warp", "view-transform-warp"),
84
+ ],
85
+ ),
86
+ ("Classes", "classes", []),
87
+ ]
88
+ LINKS_NAVBAR2 = [
89
+ ("Sim Docs", "../habitat-sim/index.html", []),
90
+ ]
91
+
92
+ FINE_PRINT = f"""
93
+ | {PROJECT_TITLE} {PROJECT_SUBTITLE}. Copyright © 2021 Facebook AI Research.
94
+ | `Terms of Use </terms-of-use>`_ `Data Policy </data-policy>`_ `Cookie Policy </cookie-policy>`_
95
+ | Created with `m.css Python doc generator <https://mcss.mosra.cz/documentation/python/>`_."""
96
+
97
+ STYLESHEETS = [
98
+ "https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600",
99
+ "../../habitat-sim/docs/theme.compiled.css",
100
+ ]
101
+
102
+ M_SPHINX_INVENTORIES = [
103
+ (
104
+ "../../habitat-sim/docs/python.inv",
105
+ "https://docs.python.org/3/",
106
+ [],
107
+ ["m-doc-external"],
108
+ ),
109
+ (
110
+ "../../habitat-sim/docs/numpy.inv",
111
+ "https://docs.scipy.org/doc/numpy/",
112
+ [],
113
+ ["m-doc-external"],
114
+ ),
115
+ (
116
+ "../../habitat-sim/build/docs/habitat-sim/objects.inv",
117
+ "../habitat-sim/",
118
+ [],
119
+ ["m-doc-external"],
120
+ ),
121
+ ]
122
+ M_SPHINX_INVENTORY_OUTPUT = "objects.inv"
123
+ M_SPHINX_PARSE_DOCSTRINGS = True
124
+
125
+ M_HTMLSANITY_SMART_QUOTES = True
126
+ # Will people hate me if I enable this?
127
+ # M_HTMLSANITY_HYPHENATION = True
habitat-lab/docs/docs.rst ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ..
2
+ Stuff defined here gets set globally for everything else:
3
+
4
+ - use :py:`code` for inline code with highlighted Python syntax
5
+ ..
6
+
7
+ .. role:: py(code)
8
+ :language: py
9
+
10
+ .. due to current limitations in m.css, all underscored members have to be
11
+ listed here in order to be visible, it's not enough to list them in a class
12
+ / module docstring. All underscored members are otherwise treated as
13
+ private and not exposed in the docs
14
+
15
+ .. py:data:: habitat.core.embodied_task.Measure._metric
habitat-lab/docs/images/habitat-lab-demo-images/habitat-lab-demo.png ADDED

Git LFS Details

  • SHA256: c7e1a9e6344bee883dbb605bd00e0e0b9f5b8c57bb14ce33409c9b49205803e8
  • Pointer size: 131 Bytes
  • Size of remote file: 977 kB
habitat-lab/docs/images/habitat-lab-tdmap-viz-images/pointnav_target_image.png ADDED

Git LFS Details

  • SHA256: 7ce21069adbd8d102f4aa8142290c54cfc09e442f60771baf09dd18589d45145
  • Pointer size: 129 Bytes
  • Size of remote file: 9.54 kB
habitat-lab/docs/images/habitat-lab-tdmap-viz-images/pointnav_target_image_edge_1.png ADDED

Git LFS Details

  • SHA256: 443f2f14a619dcb2fea08f153dd6c5cd9e07ed452f78e9e57d4e28742cb80bbc
  • Pointer size: 129 Bytes
  • Size of remote file: 7.9 kB
habitat-lab/docs/images/habitat-lab-tdmap-viz-images/pointnav_target_image_edge_2.png ADDED

Git LFS Details

  • SHA256: 64fc6a0b47c6734aa2b489d32ed6a3d49db41e11e2eebb03db63f6cb63c5b203
  • Pointer size: 129 Bytes
  • Size of remote file: 7.95 kB
habitat-lab/docs/images/habitat-lab-tdmap-viz-images/pointnav_target_image_edge_3.png ADDED

Git LFS Details

  • SHA256: 39307ff7262834cc750bf52bf8e636164b4a74500a2c4715968325acbf7328d8
  • Pointer size: 129 Bytes
  • Size of remote file: 7.94 kB
habitat-lab/docs/images/habitat-lab-tdmap-viz-images/pointnav_target_image_edge_4.png ADDED

Git LFS Details

  • SHA256: 9ae1706ba565a34e6ddb7edaabef683eb975a5fe07f4b1a893a6c20446b6ca6b
  • Pointer size: 129 Bytes
  • Size of remote file: 8.08 kB
habitat-lab/docs/images/habitat-lab-tdmap-viz-images/skokloster-castle.glb_3662.gif ADDED

Git LFS Details

  • SHA256: de36177515552e235ddd1cb48dd916b0739b9e319f769d4fbf6ccf93008cbde2
  • Pointer size: 132 Bytes
  • Size of remote file: 1.48 MB