pytorch 常见错误类型(持续更新)

一、TypeError: 'list' object is not callable

发生重名现象

 

二、Tensorflow

1、出现PermissionDeniedError

pytorch 常见错误类型(持续更新)_第1张图片

解决方法:将相对路径改为绝对路径

参考:https://www.jianshu.com/p/9088ccb5e32c

 

三、出现下面这个错误

pytorch 常见错误类型(持续更新)_第2张图片

参考:https://github.com/pytorch/pytorch/issues/14931

将python改成3.6.3可能会解决问题,感觉这个好像是线程的原因,还需研究

 

四、出现下面这个问题

    if _streams[device] is None:
IndexError: list index out of range

是因为:

This CUDA_VISIBLE_DEVICES=6 might be the problem.

验证模型的时候,去掉CUDA_VISIBLE_DEVICE 这一块

参考:https://github.com/yjxiong/tsn-pytorch/issues/4

五、Pytorch —— AttributeError: ‘DataParallel’ object has no attribute ‘xxxx’

出现这个问题的原因:

1、第一个解决方法pytorch 常见错误类型(持续更新)_第3张图片

2、因为你是加载已经训练好的模型,可能是因为你现在测试模型的环境和之前训练模型的环境不一样的原因,所以需要把环境重新配置一下

You're probably using different versions of torchvision for training and inference. See this answer: https://discuss.pytorch.org/t/issues-with-densenet-model/54941

六、当加载之前保存的模型时候,出现这个问题"RuntimeError: Error(s) in loading state_dict for ***: Missing key(s) in state_dict:"--pytorch框架

 

解决方法:分析:加载模型参数时,关键字不匹配,每个都多了“module”

pytorch 常见错误类型(持续更新)_第4张图片

所以在代码上加上这一句就可以解决(ps:之前一直以为是哪里代码写错了,但是仔细核对发现没错哈,结果是这个原因)

 

 

更多精彩内容

QQ交流群:1039977800

公众号:硬核的程序猿

 

 

欢迎大家点赞与评论

你可能感兴趣的:(pytorch,pytorch,常见错误类型(持续更新))