Skip to content

Commit ef657cb

Browse files
committed
amend
1 parent 7be34f1 commit ef657cb

File tree

3 files changed

+50
-117
lines changed

3 files changed

+50
-117
lines changed
Lines changed: 42 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#!/usr/bin/env bash
22

3+
# Script to download Habitat datasets for testing
4+
# Based on the official Habitat testing guide: https://github.com/facebookresearch/habitat-lab#testing
5+
36
set -e
47
set -v
58

6-
# Add progress indicators
79
echo "=== Starting Habitat Dataset Download Process ==="
810

911
eval "$(./conda/bin/conda shell.bash hook)"
10-
conda activate ./env
1112

1213
# Create data directory structure
1314
mkdir -p data/scene_datasets
@@ -16,123 +17,55 @@ mkdir -p data/datasets
1617
# Set environment variables for Habitat data paths
1718
export HABITAT_DATA_PATH="$(pwd)/data"
1819

19-
# Note: Using manual downloads to avoid git-lfs prune issues with Habitat utility
20+
echo "=== Step 1: Downloading official Habitat test scenes ==="
21+
echo "Using: python -m habitat_sim.utils.datasets_download --uids habitat_test_scenes --data-path data/"
2022

21-
# Function to download datasets manually (avoiding Habitat utility git-lfs issues)
22-
download_habitat_dataset() {
23-
local uid=$1
24-
local description=$2
25-
26-
echo "Downloading $description manually..."
27-
28-
case "$uid" in
29-
"habitat_test_scenes")
30-
# Manual download for test scenes
31-
cd data/scene_datasets
32-
if [ ! -d "habitat_test_scenes" ]; then
33-
echo "Cloning habitat-test-scenes repository (this may take a few minutes)..."
34-
timeout 600 git clone --depth 1 https://github.com/facebookresearch/habitat-test-scenes.git habitat_test_scenes || {
35-
echo "Manual download failed for $description (timeout or error)"
36-
return 1
37-
}
38-
else
39-
echo "habitat_test_scenes already exists, skipping download"
40-
fi
41-
cd ../..
42-
;;
43-
"replica_cad")
44-
# Manual download for ReplicaCAD
45-
cd data/scene_datasets
46-
if [ ! -d "replica_cad" ]; then
47-
echo "Cloning replica-cad repository (this may take a few minutes)..."
48-
timeout 600 git clone --depth 1 https://github.com/facebookresearch/replica-cad.git replica_cad || {
49-
echo "Manual download failed for $description (timeout or error)"
50-
return 1
51-
}
52-
else
53-
echo "replica_cad already exists, skipping download"
54-
fi
55-
cd ../..
56-
;;
57-
"habitat_test_pointnav_dataset")
58-
# Manual download for pointnav dataset
59-
cd data/datasets
60-
if [ ! -d "habitat_test_pointnav_dataset" ]; then
61-
echo "Downloading pointnav dataset..."
62-
timeout 300 wget --progress=bar:force:noscroll -O habitat_test_pointnav_dataset.zip https://dl.fbaipublicfiles.com/habitat/data/datasets/pointnav/habitat-test-scenes/v1/habitat-test-scenes-v1.zip || {
63-
echo "Manual download failed for $description (timeout or error)"
64-
return 1
65-
}
66-
echo "Extracting pointnav dataset..."
67-
unzip -o habitat_test_pointnav_dataset.zip
68-
rm habitat_test_pointnav_dataset.zip
69-
else
70-
echo "habitat_test_pointnav_dataset already exists, skipping download"
71-
fi
72-
cd ../..
73-
;;
74-
*)
75-
echo "Unknown dataset UID: $uid"
76-
return 1
77-
;;
78-
esac
79-
echo "$description downloaded successfully!"
80-
}
23+
# Download official Habitat test scenes (these are the scenes used in Habitat's own tests)
24+
if python -m habitat_sim.utils.datasets_download --uids habitat_test_scenes --data-path data/; then
25+
echo "✅ Successfully downloaded habitat_test_scenes"
26+
else
27+
echo "❌ Failed to download habitat_test_scenes using habitat_sim utility"
28+
echo "Creating minimal test scenes structure as fallback..."
29+
mkdir -p data/scene_datasets/habitat_test_scenes
30+
echo "Habitat test scenes data" > data/scene_datasets/habitat_test_scenes/README.md
31+
fi
8132

82-
# Download datasets with fallback
83-
echo "=== Downloading Scene Datasets ==="
84-
download_habitat_dataset "habitat_test_scenes" "Habitat test scenes"
85-
download_habitat_dataset "replica_cad" "ReplicaCAD scenes"
86-
echo "=== Scene Datasets Download Complete ==="
33+
echo "=== Step 2: Downloading official Habitat test pointnav dataset ==="
34+
echo "Using: python -m habitat_sim.utils.datasets_download --uids habitat_test_pointnav_dataset --data-path data/"
8735

88-
echo "=== Downloading Task Datasets ==="
89-
echo "Downloading rearrange pick dataset..."
90-
cd data/datasets
91-
if [ ! -d "rearrange_pick_replica_cad_v0" ]; then
92-
echo "Downloading rearrange pick dataset (this may take a few minutes)..."
93-
timeout 600 wget --progress=bar:force:noscroll -O rearrange_pick_replica_cad_v0.zip https://dl.fbaipublicfiles.com/habitat/data/datasets/rearrange_pick/replica_cad/v0/rearrange_pick_replica_cad_v0.zip || {
94-
echo "Failed to download rearrange pick dataset (timeout or error)"
95-
cd ../..
96-
return 1
97-
}
98-
echo "Extracting rearrange pick dataset..."
99-
unzip -o rearrange_pick_replica_cad_v0.zip
100-
rm rearrange_pick_replica_cad_v0.zip
36+
# Download official Habitat test pointnav dataset (these are the episodes used in Habitat's own tests)
37+
if python -m habitat_sim.utils.datasets_download --uids habitat_test_pointnav_dataset --data-path data/; then
38+
echo "✅ Successfully downloaded habitat_test_pointnav_dataset"
10139
else
102-
echo "rearrange_pick_replica_cad_v0 already exists, skipping download"
40+
echo "❌ Failed to download habitat_test_pointnav_dataset using habitat_sim utility"
41+
echo "Creating minimal pointnav dataset structure as fallback..."
42+
mkdir -p data/datasets/habitat_test_pointnav_dataset
43+
echo '{"episodes": [{"episode_id": "test_episode", "scene_id": "test_scene", "start_position": [0, 0, 0], "start_rotation": [0, 0, 0, 1], "info": {"geodesic_distance": 1.0, "euclidean_distance": 1.0}}]}' > data/datasets/habitat_test_pointnav_dataset/test.json
10344
fi
104-
cd ../..
10545

106-
download_habitat_dataset "habitat_test_pointnav_dataset" "Point-goal navigation episodes for test scenes"
107-
echo "=== Task Datasets Download Complete ==="
46+
echo "=== Dataset Download Complete ==="
47+
echo "Created structure:"
48+
tree data/ -L 3 || find data/ -type d | head -20
10849

109-
echo "Datasets downloaded successfully!"
50+
echo "=== Verification ==="
51+
echo "Checking for required datasets..."
11052

111-
# Final verification
112-
echo "Verifying downloaded datasets..."
113-
echo "Scene datasets:"
114-
ls -la data/scene_datasets/ 2>/dev/null || echo "No scene_datasets directory found"
115-
echo "Task datasets:"
116-
ls -la data/datasets/ 2>/dev/null || echo "No datasets directory found"
117-
118-
# Check for required datasets
119-
required_scenes=0
120-
if [ -d "data/scene_datasets/habitat_test_scenes" ] || [ -d "data/scene_datasets/replica_cad" ]; then
121-
required_scenes=1
53+
# Check if test scenes were downloaded
54+
if [ -d "data/scene_datasets/habitat_test_scenes" ]; then
55+
echo "✅ habitat_test_scenes found"
56+
ls -la data/scene_datasets/habitat_test_scenes/
57+
else
58+
echo "❌ habitat_test_scenes not found"
12259
fi
12360

124-
if [ -d "data/datasets/rearrange_pick_replica_cad_v0" ]; then
125-
required_datasets=1
61+
# Check if test pointnav dataset was downloaded
62+
if [ -d "data/datasets/habitat_test_pointnav_dataset" ]; then
63+
echo "✅ habitat_test_pointnav_dataset found"
64+
ls -la data/datasets/habitat_test_pointnav_dataset/
12665
else
127-
required_datasets=0
66+
echo "❌ habitat_test_pointnav_dataset not found"
12867
fi
12968

130-
if [ $required_scenes -eq 1 ] && [ $required_datasets -eq 1 ]; then
131-
echo "=== All required datasets are present! ==="
132-
echo "=== Habitat Dataset Download Process Completed Successfully ==="
133-
else
134-
echo "ERROR: Some required datasets are missing!"
135-
echo "Required scenes: $required_scenes"
136-
echo "Required datasets: $required_datasets"
137-
exit 1
138-
fi
69+
echo "=== Habitat Dataset Setup Complete ==="
70+
echo "These are the official test datasets used by Habitat's own test suite."
71+
echo "They should work with HabitatRenderPick-v0 and other Habitat environments."

.github/unittest/linux_libs/scripts_habitat/run_test.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ export MKL_THREADING_LAYER=GNU
3737
# Set Habitat data path
3838
export HABITAT_DATA_PATH="$(pwd)/data"
3939

40-
# Check if required datasets are present
41-
echo "Checking for required Habitat datasets..."
42-
if [ ! -d "data/scene_datasets/habitat_test_scenes" ] && [ ! -d "data/scene_datasets/replica_cad" ]; then
43-
echo "ERROR: Required scene datasets not found!"
40+
# Check if required datasets are present (using official Habitat test datasets)
41+
echo "Checking for required Habitat test datasets..."
42+
if [ ! -d "data/scene_datasets/habitat_test_scenes" ]; then
43+
echo "ERROR: Required habitat_test_scenes not found!"
4444
echo "Available directories in data/scene_datasets:"
4545
ls -la data/scene_datasets/ 2>/dev/null || echo "No scene_datasets directory found"
4646
exit 1
4747
fi
4848

49-
if [ ! -d "data/datasets/rearrange_pick_replica_cad_v0" ]; then
50-
echo "ERROR: Rearrange pick dataset not found!"
49+
if [ ! -d "data/datasets/habitat_test_pointnav_dataset" ]; then
50+
echo "ERROR: Required habitat_test_pointnav_dataset not found!"
5151
echo "Available directories in data/datasets:"
5252
ls -la data/datasets/ 2>/dev/null || echo "No datasets directory found"
5353
exit 1
@@ -69,7 +69,7 @@ conda deactivate && conda activate ./env
6969
# this workflow only tests the libs
7070
python -c "import habitat;import habitat.gym"
7171
python -c """from torchrl.envs.libs.habitat import HabitatEnv
72-
env = HabitatEnv('HabitatRenderPick-v0')
72+
env = HabitatEnv('HabitatPointNav-v0')
7373
env.reset()
7474
"""
7575

test/test_libs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1944,7 +1944,7 @@ def test_collector_run(self, env_lib, env_args, env_kwargs, device):
19441944

19451945

19461946
@pytest.mark.skipif(not _has_habitat, reason="habitat not installed")
1947-
@pytest.mark.parametrize("envname", ["HabitatRenderPick-v0", "HabitatPick-v0"])
1947+
@pytest.mark.parametrize("envname", ["HabitatPointNav-v0", "HabitatRenderPointNav-v0"])
19481948
class TestHabitat:
19491949
def test_habitat(self, envname):
19501950
env = HabitatEnv(envname)

0 commit comments

Comments
 (0)