问题:

当运行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'))

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐