Skip to content

Commit

Permalink
Update instructions for supercloud cpu-only iGibson usage! (#76)
Browse files Browse the repository at this point in the history
* Update instructions for supercloud cpu-only iGibson usage!

* fix tests by porting fix from predicators

* remove CNNRegressor

* fix

* test collecting aluminum cans data collection speed

* revert commenting out stuff in the yaml
  • Loading branch information
NishanthJKumar authored Apr 6, 2023
1 parent d7f2be3 commit f159b5b
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 13 deletions.
7 changes: 5 additions & 2 deletions behavior.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ python predicators/main.py --env behavior --approach oracle --option_model_name
## Installing on MIT Supercloud
First, follow steps in our [Supercloud guide](supercloud.md) to get an account and setup this repository on Supercloud.
Next, simply follow the steps linked in the [above section](#installation) (though ignore the first step; supercloud already has the iGibson pre-reqs installed)! Note that for various driver-related reasons, this code only works on GPU-machines with supercloud (so always remember to request a GPU when submitting jobs involving this codebase).
Next, simply follow the steps linked in the [above section](#installation) (though ignore the first step; supercloud already has the iGibson pre-reqs installed)! Importantly, we have a separate branch of iGibson that *completely disables* rendering so that (1) the simulator runs on CPU-only nodes on SuperCloud, and (2) planning is extremely fast. To use this branch (recommended), `cd` to the iGibson repo and run:
`git checkout no-render`
Note that if you want to use the master branch of iGibson on SuperCloud, you will need to exclusively request GPU nodes.
To test installation, do:
```
Expand Down Expand Up @@ -86,7 +89,7 @@ python predicators/main.py --env behavior --approach oracle --option_model_name
* Set `--behavior_scene_name` to the name of the house setting (e.g. `Pomaria_1_int`) you want to try running the particular task in. Note that not all tasks are available in all houses (e.g. `re-shelving_library_books` might only be available with `Pomaria_1_int`).
* If you'd like to see a visual of the agent planning in iGibson, set the command line argument `--behavior_mode simple`. If you want to run in headless mode without any visuals, leave the default (i.e `--behavior_mode headless`).
* Be sure to set `--plan_only_eval True`: this is necessary to account for the fact that the iGibson simulator is non-deterministic when saving and loading states (which is currently an unresolved bug).
* Example command: `python predicators/main.py --env behavior --approach oracle --option_model_name oracle_behavior --num_train_tasks 0 --num_test_tasks 1 --behavior_scene_name Pomaria_2_int --behavior_task_list "[opening_packages]" --seed 1000 --offline_data_planning_timeout 500.0 --timeout 500.0 --behavior_option_model_eval True --plan_only_eval True`.
* Example command: `python predicators/main.py --env behavior --approach oracle --option_model_name oracle_behavior --num_train_tasks 0 --num_test_tasks 1 --behavior_train_scene_name Pomaria_2_int --behavior_test_scene_name Pomaria_2_int --behavior_task_list "[opening_packages]" --seed 1000 --offline_data_planning_timeout 500.0 --timeout 500.0 --behavior_option_model_eval True --plan_only_eval True`.
## Troubleshooting
### Visualizing what the robot is doing
Expand Down
2 changes: 1 addition & 1 deletion scripts/configs/behavior_20_evaluation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@ FLAGS: # general flags
num_test_tasks: 5
START_SEED: 0
NUM_SEEDS: 1
USE_GPU: True
USE_GPU: False
2 changes: 1 addition & 1 deletion scripts/configs/behavior_all_tasks_oracle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -717,4 +717,4 @@ FLAGS: # general flags
num_test_tasks: 5
START_SEED: 0
NUM_SEEDS: 1
USE_GPU: True
USE_GPU: False
2 changes: 1 addition & 1 deletion scripts/configs/behavior_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ FLAGS: # general flags
num_test_tasks: 10
START_SEED: 456
NUM_SEEDS: 3
USE_GPU: True
USE_GPU: False
4 changes: 2 additions & 2 deletions scripts/configs/behavior_pick_place_data_collection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ FLAGS: # general flags
num_train_tasks: 10
num_test_tasks: 0
START_SEED: 456
NUM_SEEDS: 10
USE_GPU: True
NUM_SEEDS: 1
USE_GPU: False
2 changes: 1 addition & 1 deletion scripts/configs/behavior_pick_place_evaluation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ FLAGS: # general flags
num_test_tasks: 0
START_SEED: 463
NUM_SEEDS: 2
USE_GPU: True
USE_GPU: False
2 changes: 1 addition & 1 deletion scripts/configs/behavior_pick_place_learning.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ FLAGS: # general flags
num_test_tasks: 10
START_SEED: 456
NUM_SEEDS: 3
USE_GPU: True
USE_GPU: False
10 changes: 6 additions & 4 deletions tests/test_ml_models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Tests for models."""

import logging
import time
from unittest.mock import patch

import numpy as np
import pytest
Expand Down Expand Up @@ -172,17 +174,17 @@ def test_mlp_classifier():
assert prediction
assert model.predict_proba(np.ones(input_size)) > 0.5
# Test for early stopping
start_time = time.perf_counter()
model = MLPBinaryClassifier(seed=123,
balance_data=True,
max_train_iters=100000,
learning_rate=1e-2,
n_iter_no_change=1,
n_iter_no_change=-1,
hid_sizes=[32, 32],
n_reinitialize_tries=1,
weight_init="default")
model.fit(X, y)
assert time.perf_counter() - start_time < 3, "Didn't early stop"
with patch.object(logging, "info", return_value=None) as mock_logging_info:
model.fit(X, y)
assert mock_logging_info.call_count < 5
# Test with no positive examples.
num_class_samples = 1000
X = np.concatenate([
Expand Down

0 comments on commit f159b5b

Please sign in to comment.