dk-liang / CLTR

[ECCV 2022] An End-to-End Transformer Model for Crowd Localization

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when running video_demo.py

mariosconsta opened this issue · comments

I am running on google colab with GPU enabled. I downloaded the weights and have a video ready to play with. When I run the specified command, I get this error:

"RuntimeError: Attempting to deserialize object on CUDA device 1 but torch.cuda.device_count() is 1. Please use torch.load with map_location to map your storages to an existing device."

Can somebody help me? I do have a GPU ready, I do not know why it doesn't run.

Managed to fix it by changing these lines in the video_demo.py file:

checkpoint = torch.load(args['pre'], map_location='cuda:0')['state_dict']

checkpoint = torch.load(args['pre'], map_location='cuda:0')

Basically I added the map_location parameter and set it to my gpu ID