ZJU-Robotics-Lab / model-based-social-navigation

Learning World Transition Model for Socially Aware Robot Navigation
57 stars 11 forks source link

RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. #5

Closed chetanchandc closed 2 years ago

chetanchandc commented 2 years ago

Hi, when I´m running the node Screenshot from 2022-02-21 10-58-20 , the above error arises. Would anyone let me know exactly what´s the issue is about? Thanks!

chetanchandc commented 2 years ago

Found solution!

In ensemble_model.py: from lines 286-287 286 - self.model_list[idx].generator.load_state_dict(torch.load(filename` + "_generator", map_location= torch.device('cuda:0')) 287 - self.model_list[idx].optimizer_G.load_state_dict(torch.load(filename + "_generator_optimizer", map_location=torch.device('cuda:0'))

Modified the above to 286 - self.model_list[idx].generator.load_state_dict(torch.load(filename` + "_generator", map_location= torch.device('cpu'))) 287 - self.model_list[idx].optimizer_G.load_state_dict(torch.load(filename + "_generator_optimizer", map_location=torch.device('cpu')))

Thanks!