Skip to content
This repository was archived by the owner on Nov 1, 2024. It is now read-only.

Commit 106684e

Browse files
committed
add circleci config, fix interactive demo bug and update api to habitat v0.1.7
1 parent bf02d8d commit 106684e

File tree

8 files changed

+235
-10
lines changed

8 files changed

+235
-10
lines changed

.circleci/config.yml

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
version: 2
2+
gpu: &gpu
3+
machine:
4+
image: ubuntu-1604-cuda-10.1:201909-23
5+
resource_class: gpu.small
6+
environment:
7+
FPS_THRESHOLD: 900
8+
9+
jobs:
10+
python_lint:
11+
docker:
12+
- image: circleci/python:3.6
13+
steps:
14+
- checkout
15+
- run:
16+
name: setup
17+
command: |
18+
sudo pip install black flake8 flake8-builtins flake8-bugbear flake8-comprehensions flake8-return flake8-simplify "isort[pyproject]" numpy --progress-bar off
19+
sudo pip install -e . --progress-bar off
20+
- run:
21+
name: run black
22+
command: |
23+
black --exclude '/(\.eggs|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|_build|buck-out|build|dist)|examples/tutorials/(colabs|nb_python)' soundspaces/. ss_baselines/. scripts/. setup.py --diff
24+
black --exclude '/(\.eggs|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|_build|buck-out|build|dist)|examples/tutorials/(colabs|nb_python)' soundspaces/. ss_baselines/. scripts/. setup.py --check
25+
- run:
26+
name: run isort
27+
command: |
28+
isort --version
29+
isort soundspaces/. ss_baselines/. scripts/. setup.py --diff
30+
isort soundspaces/. ss_baselines/. scripts/. setup.py --check-only
31+
- run:
32+
name: run flake8
33+
command: |
34+
flake8 --version
35+
flake8 soundspaces/. ss_baselines/. scripts/. setup.py
36+
install_and_test_ubuntu:
37+
<<: *gpu
38+
steps:
39+
- checkout:
40+
path: ./sound-spaces
41+
- run:
42+
name: Install cmake
43+
no_output_timeout: 5m
44+
command: |
45+
echo $(git ls-remote https://github.com/facebookresearch/habitat-sim.git HEAD | awk '{ print $1}') > ./hsim_sha
46+
wget https://github.com/Kitware/CMake/releases/download/v3.13.4/cmake-3.13.4-Linux-x86_64.sh
47+
sudo mkdir /opt/cmake
48+
sudo sh ./cmake-3.13.4-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
49+
sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
50+
- run:
51+
name: Install dependencies
52+
no_output_timeout: 20m
53+
command: |
54+
sudo apt-get update || true
55+
sudo apt-get install -y --no-install-recommends \
56+
build-essential \
57+
git \
58+
curl \
59+
vim \
60+
ca-certificates \
61+
libbullet-dev \
62+
libjpeg-dev \
63+
libglm-dev \
64+
libegl1-mesa-dev \
65+
xorg-dev \
66+
freeglut3-dev \
67+
pkg-config \
68+
wget \
69+
zip \
70+
libhdf5-dev \
71+
unzip || true
72+
sudo apt install --allow-change-held-packages \
73+
texlive-base \
74+
texlive-latex-extra \
75+
texlive-fonts-extra \
76+
texlive-fonts-recommended
77+
- run:
78+
name: Check CUDA
79+
no_output_timeout: 20m
80+
background: true
81+
command: |
82+
# wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.44-1_amd64.deb
83+
# sudo dpkg -i cuda-repo-ubuntu1604_8.0.44-1_amd64.deb
84+
# sudo apt-get update || true
85+
# sudo apt-get --yes --force-yes install cuda
86+
# touch ./cuda_installed
87+
nvidia-smi
88+
# Restore Conda cache
89+
- restore_cache:
90+
keys:
91+
- conda-{{ checksum "sound-spaces/.circleci/config.yml" }}
92+
- run:
93+
name: Install conda and dependencies
94+
no_output_timeout: 20m
95+
command: |
96+
if [ ! -d ~/miniconda ]
97+
then
98+
curl -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
99+
chmod +x ~/miniconda.sh
100+
~/miniconda.sh -b -p $HOME/miniconda
101+
rm ~/miniconda.sh
102+
export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
103+
conda create -y -n soundspaces python=3.6
104+
. activate soundspaces
105+
conda install -q -y -c conda-forge ninja ccache numpy pytest pytest-mock pytest-cov
106+
pip install pytest-sugar
107+
fi
108+
- run:
109+
name: Install pytorch
110+
no_output_timeout: 20m
111+
background: true
112+
command: |
113+
if [ ! -f ~/miniconda/pytorch_installed ]
114+
then
115+
export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
116+
. activate soundspaces;
117+
conda install -c conda-forge opencv -y
118+
conda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 cudatoolkit=10.1 -c pytorch
119+
fi
120+
touch ~/miniconda/pytorch_installed
121+
- restore_cache:
122+
keys:
123+
- habitat-sim-{{ checksum "./hsim_sha" }}
124+
- restore_cache:
125+
keys:
126+
- ccache-{{ arch }}-master
127+
paths:
128+
- /home/circleci/.ccache
129+
- run:
130+
name: CCache initialization
131+
command: |
132+
export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
133+
. activate soundspaces;
134+
ccache --show-stats
135+
ccache --zero-stats
136+
ccache --max-size=10.0G
137+
- run:
138+
name: Build, install habitat-sim and run benchmark
139+
no_output_timeout: 30m
140+
command: |
141+
if [ ! -d ./habitat-sim ]
142+
then
143+
git clone https://github.com/facebookresearch/habitat-sim.git --recursive
144+
fi
145+
# while [ ! -f ./cuda_installed ]; do sleep 2; done # wait for CUDA
146+
export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
147+
. activate soundspaces;
148+
cd habitat-sim
149+
pip install -r requirements.txt --progress-bar off
150+
pip install pillow
151+
python -u setup.py install --headless --with-cuda --bullet
152+
- run:
153+
name: Ccache stats
154+
when: always
155+
command: |
156+
export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
157+
. activate soundspaces;
158+
ccache --show-stats
159+
- run:
160+
name: Download test data
161+
command: |
162+
cd sound-spaces
163+
wget http://dl.fbaipublicfiles.com/SoundSpaces/challenge_21/minival.tar
164+
tar -xvf minival.tar
165+
rm minival.tar
166+
wget http://dl.fbaipublicfiles.com/SoundSpaces/pretrained_weights.tar.xz
167+
tar -xvf pretrained_weights.tar.xz
168+
mv pretrained_weights data/
169+
rm pretrained_weights.tar.xz
170+
- save_cache:
171+
key: habitat-sim-{{ checksum "./hsim_sha" }}
172+
background: true
173+
paths:
174+
- ./habitat-sim
175+
- save_cache:
176+
key: ccache-{{ arch }}-master
177+
background: true
178+
paths:
179+
- /home/circleci/.ccache
180+
- run:
181+
name: Install habitat-lab
182+
no_output_timeout: 20m
183+
command: |
184+
export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
185+
. activate soundspaces;
186+
git clone git@github.com:facebookresearch/habitat-lab.git && cd habitat-lab && git checkout v0.1.6
187+
pip --version
188+
pip install -e .
189+
- run:
190+
name: Install sound-spaces
191+
no_output_timeout: 20m
192+
command: |
193+
export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
194+
. activate soundspaces; cd sound-spaces
195+
while [ ! -f ~/miniconda/pytorch_installed ]; do sleep 2; done # wait for Pytorch
196+
pip install -e .
197+
- save_cache:
198+
key: conda-{{ checksum "sound-spaces/.circleci/config.yml" }}
199+
background: true
200+
paths:
201+
- ~/miniconda
202+
- run:
203+
name: Run api tests
204+
no_output_timeout: 30m
205+
command: |
206+
export PATH=$HOME/miniconda/bin:/usr/local/cuda/bin:$PATH
207+
. activate soundspaces; cd sound-spaces
208+
pip show torch
209+
python ss_baselines/av_nav/run.py --run-type eval --exp-config ss_baselines/av_nav/config/audionav/mp3d/test_telephone/audiogoal_depth.yaml EVAL_CKPT_PATH_DIR data/pretrained_weights/audionav/av_nav/mp3d/heard.pth EVAL.SPLIT val_mini
210+
python ss_baselines/av_nav/run.py --run-type eval --exp-config ss_baselines/av_nav/config/audionav/mp3d/test_telephone/audiogoal_depth.yaml EVAL_CKPT_PATH_DIR data/pretrained_weights/audionav/av_nav/mp3d/heard.pth EVAL.SPLIT val_mini USE_SYNC_VECENV True
211+
python ss_baselines/av_nav/run.py --run-type eval --exp-config ss_baselines/av_nav/config/audionav/mp3d/test_telephone/audiogoal_depth.yaml EVAL_CKPT_PATH_DIR data/pretrained_weights/audionav/av_nav/mp3d/heard.pth EVAL.SPLIT val_mini TASK_CONFIG.SIMULATOR.USE_RENDERED_OBSERVATIONS True
212+
213+
workflows:
214+
version: 2
215+
install_and_test:
216+
jobs:
217+
- python_lint
218+
- install_and_test_ubuntu

configs/audionav/av_nav/mp3d/interactive_demo.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ SIMULATOR:
1818
VIEW_CHANGE_FPS: 30
1919
AUDIO:
2020
RIR_SAMPLING_RATE: 16000
21-
SOURCE_SOUND_DIR: "data/sounds/demo"
21+
SOURCE_SOUND_DIR: "data/sounds/1s_all"
2222

2323
TASK:
2424
TYPE: AudioNav
@@ -39,7 +39,7 @@ TASK:
3939

4040
DATASET:
4141
TYPE: "AudioNav"
42-
SPLIT: "test_demo"
42+
SPLIT: "val_telephone"
4343
CONTENT_SCENES: ["*"]
4444
VERSION: 'v1'
4545
SCENES_DIR: "data/scene_datasets/mp3d"

scripts/interactive_demo.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ def following(config, env, keys):
173173

174174

175175
def main():
176+
# import os
177+
# os.environ["SDL_VIDEODRIVER"] = "dummy"
176178
parser = argparse.ArgumentParser()
177179
# parser.add_argument('--sound', default=False, action='store_true')
178180
parser.add_argument(
@@ -184,7 +186,7 @@ def main():
184186
parser.add_argument(
185187
"--exp-config",
186188
type=str,
187-
required=True,
189+
required=False,
188190
default='ss_baselines/av_nav/config/audionav/mp3d/interactive_demo.yaml',
189191
help="path to config yaml containing info about experiment",
190192
)

setup.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
'ss_baselines'
1616
],
1717
install_requires=[
18-
'habitat',
19-
'habitat-sim',
2018
'torch',
2119
'gym==0.10.9',
2220
'numpy>=1.16.1',

soundspaces/simulator.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def __init__(self, config: Config) -> None:
120120

121121
self._sensor_suite = SensorSuite(sim_sensors)
122122
self.sim_config = self.create_sim_config(self._sensor_suite)
123-
self._current_scene = self.sim_config.sim_cfg.scene.id
123+
self._current_scene = self.sim_config.sim_cfg.scene_id
124124
self._action_space = spaces.Discrete(
125125
len(self.sim_config.agents[0].action_space)
126126
)
@@ -173,7 +173,7 @@ def create_sim_config(
173173
overwrite_config(
174174
config_from=self.config.HABITAT_SIM_V0, config_to=sim_config
175175
)
176-
sim_config.scene.id = self.config.SCENE
176+
sim_config.scene_id = self.config.SCENE
177177
agent_config = habitat_sim.AgentConfiguration()
178178
overwrite_config(
179179
config_from=self.get_agent_config(), config_to=agent_config
@@ -301,6 +301,13 @@ def current_source_sound(self):
301301
def is_silent(self):
302302
return self._episode_step_count > self._duration
303303

304+
@property
305+
def pathfinder(self):
306+
return self._sim.pathfinder
307+
308+
def get_agent(self, agent_id):
309+
return self._sim.get_agent(agent_id)
310+
304311
def reconfigure(self, config: Config) -> None:
305312
self.config = config
306313
if hasattr(self.config.AGENT_0, 'OFFSET'):

ss_baselines/av_nav/config/audionav/mp3d/interactive_demo.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ RL:
4141
reward_window_size: 50
4242

4343
EVAL:
44-
SPLIT: "test_demo"
44+
SPLIT: "val_telephone"
4545
USE_CKPT_CONFIG: True

ss_baselines/av_nav/config/audionav/replica/interactive_demo.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ RL:
4141
reward_window_size: 50
4242

4343
EVAL:
44-
SPLIT: "test_demo"
44+
SPLIT: "val_telephone"
4545
USE_CKPT_CONFIG: True

ss_baselines/common/sync_vector_env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
import gym
2626
import numpy as np
27-
from gym.spaces.dict_space import Dict as SpaceDict
27+
from gym.spaces import Dict as SpaceDict
2828

2929
import habitat
3030
from habitat.config import Config

0 commit comments

Comments
 (0)