Package: habitat-baselines
baselinesInstallationThehabitat_baselinessub-package is NOT included upon installation by default. To installhabitat_baselines, use the following command instead:pipinstall-ehabitat-lab
pipinstall-ehabitat-baselinesThis will also install additional requirements for each sub-module inhabitat_baselines/, which are specified inrequirements.txtfiles located in the sub-module directory.Reinforcement Learning (RL)Proximal Policy Optimization (PPO)paper:https://arxiv.org/abs/1707.06347code: The PPO implementation is based onpytorch-a2c-ppo-acktr.dependencies: A recent version of pytorch, for installing refer topytorch.orgFor training on sample data please follow steps in the repository README. You should download the sampletest scene data, extract it under the main repo (habitat-lab/, extraction will create a data folder athabitat-lab/data) and run the below training command.train:python-u-mhabitat_baselines.run\--config-name=pointnav/ppo_pointnav_example.yamlYou can reduce training time by changing the trainer from the default implement toVERby
settingtrainer_nameto"ver"in either the config or via the command line.python-u-mhabitat_baselines.run\--config-name=pointnav/ppo_pointnav_example.yaml\habitat_baselines.trainer_name=vertest:python-u-mhabitat_baselines.run\--config-name=pointnav/ppo_pointnav_example.yaml\habitat_baselines.evaluate=TrueWe also provide trained RGB, RGBD, and Depth PPO  models for MatterPort3D and Gibson.
To use them download pre-trained pytorch models fromlinkand unzip and specify model pathhere.Thehabitat_baselines/config/pointnav/ppo_pointnav.yamlconfig has better hyperparameters for large scale training and loads theGibson PointGoal Navigation Datasetinstead of the test scenes.
Change the/benchmark/nav/pointnav: pointnav_gibsoninhabitat_baselines/config/pointnav/ppo_pointnav.yamlto/benchmark/nav/pointnav: pointnav_mp3din the defaults list for training onMatterPort3D PointGoal Navigation Dataset.Hierarchical Reinforcement Learning (HRL)We provide a two-layer hierarchical policy class, consisting of a low-level skill that moves the robot, and a high-level policy that reasons about which low-level skill to use in the current state. This can be especially powerful in long-horizon mobile manipulation tasks, like those introduced inHabitat2.0. Both the low- and high- level can be either learned or an oracle. For oracle high-level we usePDDL, and for oracle low-level we use instantaneous transitions, with the environment set to the final desired state. Additionally, for navigation, we provide an oracle navigation skill that uses A-star and the map of the environment to move the robot to its goal.To run the following examples, you need theReplicaCAD dataset.To train a high-level policy, while using pre-learned low-level skills (SRL baseline fromHabitat2.0), you can run:python-u-mhabitat_baselines.run\--config-name=rearrange/rl_hierarchical.yamlTo run a rearrangement episode with oracle low-level skills and a fixed task planner, run:python-u-mhabitat_baselines.run\--config-name=rearrange/rl_hierarchical.yaml\habitat_baselines.evaluate=True\habitat_baselines/rl/policy=hl_fixed\habitat_baselines/rl/policy/hierarchical_policy/defined_skills=oracle_skillsTo change the task (like set table) that you train your skills on, you can change the line/habitat/task/rearrange: rearrange_easyto/habitat/task/rearrange: set_tablein the defaults of your config.Habitat-3.0 Multi-Agent TrainingFirst download the necessary data withpython -m habitat_sim.utils.datasets_download --uids hssd-hab hab3-episodes habitat_humanoids hab3_bench_assets.Social NavigationTo run multi-agent training with a Spot robot's policy being a low-level navigation policy and a humanoid's policy being a fixed (non-trainable) policy that navigates a sequence of navigation targets.python habitat_baselines/run.py --config-name=social_nav/social_nav.yamlFor evaluating the trained Spot robot's policypython habitat_baselines/run.py --config-name=social_nav/social_nav.yaml habitat_baselines.evaluate=True habitat_baselines.eval_ckpt_path_dir=/checkpoints/latest.pth habitat_baselines.eval.should_load_ckpt=TrueSocial RearrangementTo run multi-agent training with a Spot robot and humanoid on the social rearrangement task.Learn-Single:python habitat_baselines/run.py --config-name=social_rearrange/pop_play.yamlLearn-Pop with 8 humanoid policies during training:python habitat_baselines/run.py --config-name=social_rearrange/pop_play.yaml habitat_baselines.rl.agent.num_pool_agents_per_type=[1,8]Plan-Pop-4:python habitat_baselines/run.py --config-name=social_rearrange/plan_pop.yaml habitat_baselines.rl.policy.agent_1.hierarchical_policy.high_level_policy.plan_idx=4. To run Plan-Pop-p for otherpvalues, sethabitat_baselines.rl.policy.agent_1.hierarchical_policy.high_level_policy.plan_idx.For zero-shot evaluate against the unseen agent population:With planner-based collaborators:python habitat_baselines/run.py --config-name=social_rearrange/pop_play.yaml habitat_baselines.evaluate=True habitat_baselines.eval_ckpt_path_dir=PATH_TO_CKPT.pth +habitat_baselines.rl.policy.agent_1.hierarchical_policy.high_level_policy.select_random_goal=False +habitat_baselines.rl.policy.agent_1.hierarchical_policy.high_level_policy.plan_idx=1changeplan_idxto be 1, 2, 3, or 4 to evaluate against the other 4 planner agents.