Notebook镜像选择的mindspore1.7.0-cuda10.1-py3.7-ubuntu18.04,资源类型选择GPU,本地是mindspore1.8.1 CPU。
本地执行的代码是将mindspore_nlp_application.ipynb中的代码Cell组合在一起的,线上执行的也是mindspore_nlp_application.ipynb。
本地执行报错:
[mindspore/nn/layer/rnn_cells.py:69] LSTMCell has been changed from 'single LSTM layer' to 'single LSTM cell', if you still need use single LSTM layer, please use `nn.LSTM` instead.
Traceback (most recent call last):
File "rnn_sample.py", line 461, in
batch_size=cfg.batch_size)
File "rnn_sample.py", line 425, in __init__
dropout=0.0)
File "rnn_sample.py", line 361, in __init__
dropout=dropout))
File "/usr/local/lib/python3.7/dist-packages/mindspore/nn/layer/rnn_cells.py", line 73, in wrapper
raise ValueError(f"The arguments of `nn.LSTMCell` from old MindSpore version(<1.6) are detected, "
ValueError: The arguments of `nn.LSTMCell` from old MindSpore version(<1.6) are detected, if you still need use single LSTM layer, please use `nn.LSTM` instead.
Exception ignored in:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/mindspore/nn/cell.py", line 338, in __del__
if self.compile_cache:
File "/usr/local/lib/python3.7/dist-packages/mindspore/nn/cell.py", line 329, in __getattr__
raise AttributeError("The '{}' object has no attribute '{}'.".format(type(self).__name__, name))
AttributeError: The 'LSTMCell' object has no attribute 'compile_cache'.
貌似代码的版本太低造成的。可是Notebook的镜像是mindspore1.7.0,为什么可以执行呢?
****************************************************解答*****************************************************
因为不同版本之间是存在一些接口的变更的。比如脚本在1.7版本可以正常运行,1.8版本对一些接口做了变更,那么同样的脚本在1.8版本上可能就会报错。 还有就是一些算子对硬件的支持情况,比如有的算子仅支持GPU,那么在GPU上运行没有问题,在CPU上就会报错