error I met
guoqiangszu
这个作者很懒,什么都没留下…
展开
-
RuntimeError: Attempting to deserialize object on CUDA device 5 but torch.cuda.device_count() is 1.
问题:RuntimeError: Attempting to deserialize object on CUDA device 5 but torch.cuda.device_count() is 1. Please use torch.load with map_location to map your storages to an existing device.Process finished with exit code 1原因checkpoint = torch.load(os.path原创 2020-05-28 15:03:52 · 2234 阅读 · 2 评论 -
解决问题:ValueError: only one element tensors can be converted to Python scalars
问题代码:def exp_sum(self, x1, x2, x3, x4): sum = math.exp(x1) + math.exp(x2) + math.exp(x3) + math.exp(x4) return x1 / sum, x2 / sum, x3 / sum, x4 / sumx1等都是tensors。出现问题:ValueError: only one...原创 2020-03-14 22:31:34 · 13736 阅读 · 0 评论 -
torch.backends.cudnn.benchmark = true
设置这个 flag 可以让内置的 cuDNN 的 auto-tuner 自动寻找最适合当前配置的高效算法,来解决达到优化运行效率的问题。如果网络的输入数据维度或类型上变化不大,设置 torch.backends.cudnn.benchmark = true 可以增加运行效率;如果网络的输入数据在每次 iteration 都变化的话,会导致 cuDNN 每次都会去寻找一遍最优配置,这样反而...原创 2020-03-08 20:23:31 · 461 阅读 · 0 评论 -
解决问题“RuntimeError: DataLoader worker (pid(s) 29888, 16444, 21832) exited unexpectedly”
出现类似的问题是因为PyTorch的DataLoader中有一个参数叫做num_workersnum_workers (int, optional): how many subprocesses to use for data loading. 0 means that the data will be loaded in the main process. (default: ``0``)在...原创 2020-03-08 15:15:48 · 3134 阅读 · 2 评论 -
python3无法导入cPickle,将python2中的cPickle修改成python3中的pickle
python3中cPickle模块已经更名为pickle,所以在python3中导入时可以使用:import pickle as cPicklecPickle 是 python2 的库,到 python3,改名为 pickle:import pickle在python3中,直接使用pickle模块更为方便。因为pickle可以把字典、列表等结构化数据存到本地文件,读取后返回的还是字典...原创 2019-05-29 20:03:10 · 1763 阅读 · 2 评论 -
ModuleNotFoundError: No module named 'pyximport'
conda install pyximport找不到包pip install pyximport没有匹配的版本pyCharm->settings->Project Interpreter也找不到可安装的pyximportanaconda也一样以上方法都不行。。。以上方法都不行。。。以上方法都不行解决方法:首先,确保安装了cythonpip install Cyth...原创 2019-06-03 00:22:39 · 9948 阅读 · 7 评论