You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The supported types of overload function getitem is: [Tuple, Slice], [List, Slice], [Tensor, Ellipsis], [Tuple, Tensor], [List, Number], [Tensor, Slice], [Dictionary, String], [Tensor, Tensor], [String, Number], [Tensor, Tuple], [Tensor, None], [Tuple, Number], [Tensor, Number], [Tensor, List]. RuntimeError: The 'getitem' operation does not support the type [None, Int64].
2023昇腾AI创新大赛-算法创新-VisionLAN模型迁移复现
background:我们正在将pytorch源代码中的train_LF_1.py迁移至mindspore。遵循mindspore的训练范式,我们分别定义好模型、数据集、优化器、损失函数等,通过构造WithLossCell、调用Model类,使用model.train进行训练。
遇到的问题:训练时报了如下错误,是关于getitem这个方法的:
RuntimeError: The 'getitem' operation does not support the type [None, Int64].The supported types of overload function
getitem
is: [Tuple, Slice], [List, Slice], [Tensor, Ellipsis], [Tuple, Tensor], [List, Number], [Tensor, Slice], [Dictionary, String], [Tensor, Tensor], [String, Number], [Tensor, Tuple], [Tensor, None], [Tuple, Number], [Tensor, Number], [Tensor, List].注:调试环境:华为云modelarts平台的notebook,镜像:mindspore_1.10.0-cann_6.0.1-py_3.7-euler_2.8.3,规格:Ascend: 1*Ascend910|ARM: 24核 96GB
getitem是自定义的lmdbDataset类里定义的一个方法:
我们通过load_dataset函数加载数据集,其中包含调用lmdbDataset类、用mindspore的GeneratorDataset加载数据集和按batchsize划分数据集三步:
加载训练集,并传到model.train里
我们不清楚是getitem方法本身写法出现了问题,还是在哪里调用的时候传入了异常的数据类型,特别对于[None, Int64]中None的由来十分疑惑。现求助于各位专家、同行,期待百忙之中的回复,非常感谢!!!
The text was updated successfully, but these errors were encountered: