facebookresearch / OccupancyAnticipation

This repository contains code for our publication "Occupancy Anticipation for Efficient Exploration and Navigation" in ECCV 2020.
MIT License
76 stars 26 forks source link

RuntimeError: Error(s) in loading state_dict for Mapper: #46

Open marcopremigit opened 2 years ago

marcopremigit commented 2 years ago

Hi, I'm trying to evaluate OccAnt(depth) checkpoint ([ckpt.11.pth]) using the yaml file ppo_navigation_evaluate_noisy.yaml provided https://github.com/facebookresearch/OccupancyAnticipation/blob/main/configs/model_configs/occant_depth/ppo_navigation_evaluate_noisy.yaml. The problem is that it outputs: I0215 15:12:23.423159 3373 simulator.py:170] Loaded navmesh data/scene_datasets/gibson/Cantwell.navmesh 2022-02-15 15:12:23,426 Initializing task Nav-v0 Traceback (most recent call last): File "run.py", line 70, in <module> main() File "run.py", line 39, in main run_exp(**vars(args)) File "run.py", line 66, in run_exp trainer.eval() File "/OccupancyAnticipation/environments/habitat/habitat-api/habitat_baselines/common/base_trainer.py", line 109, in eval checkpoint_index=prev_ckpt_ind, File "/OccupancyAnticipation/occant_baselines/rl/occant_nav_trainer.py", line 302, in _eval_checkpoint self.mapper.load_state_dict(mapper_dict, strict=False) File "/custom/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 845, in load_state_dict self.__class__.__name__, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for Mapper: size mismatch for projection_unit.main.main.gp_depth_proj_encoder.inc.conv.conv.0.weight: copying a param with shape torch.Size([64, 2, 3, 3]) from checkpoint, the shape in current model is torch.Size([16, 2, 3, 3]). size mismatch for projection_unit.main.main.gp_depth_proj_encoder.inc.conv.conv.0.bias: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([16]). size mismatch for projection_unit.main.main.gp_depth_proj_encoder.inc.conv.conv.1.weight: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([16]). size mismatch for projection_unit.main.main.gp_depth_proj_encoder.inc.conv.conv.1.bias: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([16]). size mismatch for projection_unit.main.main.gp_depth_proj_encoder.inc.conv.conv.1.running_mean: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([16]). ` and so on. If I use the same checkpoints for exploration with ppo_exploration_evaluate_noisy.yaml everything is perfect! What can be the problem?

GuoPingPan commented 1 year ago

I think it is because the channels between pretained model and evaluation config dosen't match. you can set unet_nsf=64 in https://github.com/facebookresearch/OccupancyAnticipation/blob/main/configs/model_configs/occant_depth/ppo_navigation_evaluate_noisy.yaml.