-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RuntimeError: The 'getitem' operation does not support the type [None, Int64]. #596
Comments
@sevennotmouse
参考您提供的错误日志局部,该问题应该不是由自定义数据集类lmdbDataset的
import mindspore as ms
ms.set_context(mode=ms.PYNATIVE_MODE)
此外,在开发自定义数据集类的过程中,如怀疑存在问题,您可以尝试对lmdbDataset类进行单元测试,确认该类的行为是否符合预期。MindOCR项目中也实现了一些自定义数据集类(包括类似的lmdbDataset类),相关代码可供参考。 |
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: