pytorch-buglist:

编程入门 行业动态 更新时间:2024-10-28 07:32:31
pytorch报错:RuntimeError: CUDA error: device-side assert triggered
参数:unable to get repr for class 'torch.tensor'

错误定位:类别数目不对;
RuntimeError: Given groups=1, weight of size 40 3 3 3, 
expected input[4, 300, 302, 5] to have 3 channels, but got 300 channels instead

问题描述:训练完第一个epoch后出现上述bug,
原因:验证阶段,图像数据输入维数存在问题,需要变换通道。
RuntimeError: Error(s) in loading state_dict for EfficientNet:
	Missing key(s) in state_dict: "_conv_stem.weight", "_bn0.weight", "_bn0.bias", .... ,"_bn1.running_mean", "_bn1.running_var", "_fc.weight", "_fc.bias". 
	Unexpected key(s) in state_dict: "module._conv_stem.weight", "module._bn0.weight", "module._bn0.bias", ... ,"module._bn1.running_mean", "module._bn1.running_var", "module._bn1.num_batches_tracked", "module._fc.weight", "module._fc.bias". 

原因:模型没有放到GPU上,就载入权重。
改正:模型初始化model = EfficientNet.from_name('efficientnet-b3', 102)
后面加:model = torch.nn.DataParallel(model).cuda()
Traceback (most recent call last)
TypeError: 'module' object is not callable
原因:库没有正确加载
Traceback (most recent call last):
TypeError: 'list' object is not callable
原因:代码中使用内置函数名或关键字定义了变量。
yolov5中的调用问题:
ModuleNotFoundError: No module named 'models'
原因:序列化问题
import os, sys
root_path = os.getcwd()
sys.path.insert(0, root_path + '/project/yolov5')
from project.yolov5.predict import detect

更多推荐

pytorch-buglist:

本文发布于:2023-06-13 14:17:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1382431.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:pytorch   buglist

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!