Skip to content

Commit b6dd437

Browse files
author
Tyler Lum
committed
Refactor train.py and cfg to allow hydra tab completion
1 parent d0b81c1 commit b6dd437

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

isaacgymenvs/cfg/config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ headless: False
6161
defaults:
6262
- task: Ant
6363
- train: ${task}PPO
64-
- hydra/job_logging: disabled
64+
- override hydra/job_logging: disabled
6565
- pbt: no_pbt
66+
- _self_
6667

6768
# set the directory where the output files get saved
6869
hydra:

isaacgymenvs/train.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,11 @@
2828
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2929
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3030
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31-
import logging
32-
import os
33-
from datetime import datetime
34-
35-
# noinspection PyUnresolvedReferences
36-
import isaacgym
3731

3832
import hydra
3933

40-
from isaacgymenvs.utils.rlgames_utils import multi_gpu_get_rank
41-
42-
from isaacgymenvs.pbt.pbt import PbtAlgoObserver, initial_pbt_check
4334
from omegaconf import DictConfig, OmegaConf
44-
from hydra.utils import to_absolute_path
45-
from isaacgymenvs.tasks import isaacgym_task_map
4635
from omegaconf import DictConfig, OmegaConf
47-
import gym
48-
49-
from isaacgymenvs.utils.reformat import omegaconf_to_dict, print_dict
50-
from isaacgymenvs.utils.utils import set_np_formatting, set_seed
5136

5237

5338
def preprocess_train_config(cfg, config_dict):
@@ -83,9 +68,23 @@ def preprocess_train_config(cfg, config_dict):
8368
return config_dict
8469

8570

86-
@hydra.main(config_name="config", config_path="./cfg")
71+
@hydra.main(version_base="1.1", config_name="config", config_path="./cfg")
8772
def launch_rlg_hydra(cfg: DictConfig):
8873

74+
import logging
75+
import os
76+
from datetime import datetime
77+
78+
# noinspection PyUnresolvedReferences
79+
import isaacgym
80+
from isaacgymenvs.pbt.pbt import PbtAlgoObserver, initial_pbt_check
81+
from isaacgymenvs.utils.rlgames_utils import multi_gpu_get_rank
82+
from hydra.utils import to_absolute_path
83+
from isaacgymenvs.tasks import isaacgym_task_map
84+
import gym
85+
from isaacgymenvs.utils.reformat import omegaconf_to_dict, print_dict
86+
from isaacgymenvs.utils.utils import set_np_formatting, set_seed
87+
8988
if cfg.pbt.enabled:
9089
initial_pbt_check(cfg)
9190

0 commit comments

Comments
 (0)