问题:运行少样本计数项目(Learning To Count Everything)将cuda改为cpu
·
问题:
当运行LearningToCountEverything(论文名称《Learning To Count Everything》)的test.py程序时,跳出错误:
RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=‘cpu’ to map your storages to the CPU.
原因:
本人笔记本没有CUDA,只能用cpu跑代码。
解决方法:
regressor.load_state_dict(torch.load(args.model_path))
改为
regressor.load_state_dict(torch.load(args.model_path,map_location='cpu'))
更多推荐
所有评论(0)