1.报错信息如下:
RuntimeError: BUG: Failed to find context for: SequentialCell.3, parent: Default_wrapper.1 from contexts: [{FuncGraph: hasattr.4 Args:
出错代码如下:
解决方案:
将hasattr删除!!该代码是从pytorch迁移过来的,难免出一些奇奇怪怪的问题。
不应该在construct()中使用hasattr(),换成其它形式判断,比如:
if self.small_conv==True:......
2.报错信息如下:
AttributeError: The 'ReparamLargeKernelConv' object has no attribute 'compile_cache'.
TypeError: __init__() takes from 7 to 8 positional arguments but 9 were given
解决方案:
只看TypeError就行,参数给多了
3.报错信息如下:
RuntimeError: The 'getitem' operation does not support the type [Int64, Tuple[Slice[None : None : None],None]].
The supported types of overload function `getitem` is:
解决方案:
网络的输入类型出错了,比如网络要(1,)维度的[20],而给了int类型的20。
如果是维度不匹配的话,报错信息中会指出。这里不属于维度问题。
代码如下:
4、报错信息如下
PRE_ACT(195,ffff8c04da40,python):2023-05-26-19:21:00.307.467 [mindspore/ccsrc/plugin/device/ascend/optimizer/format_type/check_consistency.cc:68] CheckFormatForConsistency]
Found inconsistent format! input format 1: DefaultFormat, selected input format: NC1HWC0
File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.7/site-packages/mindspore/common/api.py", line 555, in staging_specialize out = _MindsporeFunctionExecutor(func, hash_obj, input_signature, process_obj, jit_config)(*args)
File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.7/site-packages/mindspore/common/api.py", line 97, in wrapper results = fn(*arg, **kwargs)
File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.7/site-packages/mindspore/common/api.py", line 295, in __call__ phase = self.compile(args_list, self.fn.__name__)
File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.7/site-packages/mindspore/common/api.py", line 357, in compile is_compile = self._graph_executor.compile(self.fn, compile_args, phase, True)
RuntimeError: Found inconsistent format or data type! Op: Concat[@kernel_graph_16:[CNode]1899{[0]: ValueNode<Primitive> Concat, [1]: [CNode]1899, [2]: [CNode]1899}], fullname: Default/online_model-GaussianDiffusion/model-Unet/Concat-op51609
解决方案
检查一下create_dataset()相关的代码,应该是对数据进行预处理trans时出了错误
5.报错信息如下
AttributeError: The 'Conv2d' object does not inherit attribute from 'cell'. Please use 'super().__init__()
解决方案
Conv2d的group参数,写成了groups