AnandSingh-0619 / home-robot

Mobile manipulation research tools for roboticists
MIT License
0 stars 0 forks source link

AttributeError: 'tuple' object has no attribute 'pop' #8

Closed AnandSingh-0619 closed 2 weeks ago

AnandSingh-0619 commented 4 months ago

Original code

Traceback (most recent call last): File "/srv/kira-lab/share4/asingh3064/miniforge3/envs/home-robot/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/srv/kira-lab/share4/asingh3064/miniforge3/envs/home-robot/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/nethome/asingh3064/flash/home-robot/projects/habitat_uncertainity/run.py", line 154, in main() File "/nethome/asingh3064/flash/home-robot/projects/habitat_uncertainity/run.py", line 105, in main execute_exp(config, "train") File "/coc/pskynet4/asingh3064/home-robot/src/third_party/habitat-lab/habitat-baselines/habitat_baselines/run.py", line 60, in execute_exp trainer.train() File "/srv/kira-lab/share4/asingh3064/miniforge3/envs/home-robot/lib/python3.9/contextlib.py", line 79, in inner return func(*args, **kwds) File "/coc/pskynet4/asingh3064/home-robot/src/third_party/habitat-lab/habitat-baselines/habitat_baselines/rl/ppo/ppo_trainer.py", line 675, in train self._agent.load_state_dict(resume_state) File "/coc/pskynet4/asingh3064/home-robot/src/third_party/habitat-lab/habitat-baselines/habitat_baselines/rl/ppo/single_agent_access_mgr.py", line 258, in load_state_dict self._lr_scheduler.load_state_dict(state["lr_sched_state"]) File "/srv/kira-lab/share4/asingh3064/miniforge3/envs/home-robot/lib/python3.9/site-packages/torch/optim/lr_scheduler.py", line 249, in load_state_dict lr_lambdas = state_dict.pop('lr_lambdas') AttributeError: 'tuple' object has no attribute 'pop'

home_robo-ver-842723.log

Here is a log file from a previous run New changes to the code: lr_sched_state = state["lr_sched_state"] if isinstance(lr_sched_state, tuple): lr_sched_state = lr_sched_state[0] # Assuming the relevant dictionary is at index 0 self._lr_scheduler.load_state_dict(lr_sched_state)

yusufali98 commented 4 months ago

So what is the length of the tuple actually ? Is there just on element in the tuple ?

AnandSingh-0619 commented 4 months ago

Yes it has length 1

yusufali98 commented 2 weeks ago

Okay I think we can close this but can you please post the link to code which fixes this issue ?

AnandSingh-0619 commented 2 weeks ago

lr_sched_state = state["lr_sched_state"] if isinstance(lr_sched_state, tuple): lr_sched_state = lr_sched_state[0] # Assuming the relevant dictionary is at index 0 self._lr_scheduler.load_state_dict(lr_sched_state)

single_agent_access_manager.py