dk-liang / CLTR

[ECCV 2022] An End-to-End Transformer Model for Crowd Localization
MIT License
87 stars 13 forks source link

Error when running video_demo.py #10

Closed mariosconsta closed 1 year ago

mariosconsta commented 1 year ago

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.

mariosconsta commented 1 year ago

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