clvrai / skill-chaining

Adversarial Skill Chaining for Long-Horizon Robot Manipulation via Terminal State Regularization (CoRL 2021)
https://clvrai.com/skill-chaining
28 stars 4 forks source link

Policy Sequencing Error #7

Closed feup-jmc closed 2 years ago

feup-jmc commented 2 years ago

Hello, I would like to share an error that I found occurring when running the policy sequencing script.

Traceback (most recent call last):
  File "~/anaconda3/envs/IKEA_1/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "~/anaconda3/envs/IKEA_1/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "~/skill-chaining/run.py", line 43, in <module>
    SkillChainingRun(parser).run()
  File "~/skill-chaining/method/robot_learning/main.py", line 143, in run
    trainer.train()
  File "~/skill-chaining/policy_sequencing_trainer.py", line 133, in train
    partial=False,
  File "~/skill-chaining/policy_sequencing_trainer.py", line 255, in _evaluate_partial
    is_train=False, record_video=record_video, partial=partial
  File "~/skill-chaining/policy_sequencing_rollout.py", line 272, in run_episode
    ac, ac_before_activation = agent[subtask].act(ob, is_train=is_train)
  File "~/skill-chaining/policy_sequencing_agent.py", line 128, in __getitem__
    return self._rl_agents[key]
IndexError: list index out of range

It occurred attempting to chain the first two table leg assembly subtasks (as so far I can't get GAIL to do the remaining legs, see issue #6)

mpirun -np 8 python -m run --algo ps --furniture_name table_lack_0825 --num_connects 2 --run_prefix ours \
--ps_ckpts log/table_lack_0825.gail.p0.123/ckpt_00018124800.pt,log/table_lack_0825.gail.p1.123/ckpt_00036556800.pt \
--ps_load_init_states log/table_lack_0825.gail.p0.123/success_00018124800.pkl,log/table_lack_0825.gail.p1.123/success_00036556800.pkl \
--ps_demo_paths demos/table_lack/Sawyer_table_lack_0825_0,demos/table_lack/Sawyer_table_lack_0825_1

I found that the agent array in the following code only had the policy sequencing agent, even though the program was trying to access further agents. https://github.com/clvrai/skill-chaining/blob/172f1334cacdc81e2483125a87d9283cd64bcb70/policy_sequencing_rollout.py#L272 A quick fix seems to be replacing subtask with 0 but while it does not crash the script anymore, I am not sure if this doesn't cause issues with result quality. I should also ask if the policy sequencing stage of the training (section 4) needs a further evaluation step (like section 3 for the subtask algorithm).