ai studio上运行正常,本地环境运行报错
- 标题:ai studio上运行正常,本地环境运行报错
- 版本、环境信息: 1)PaddlePaddle版本:1.5.2 2)CPU:CPU 4)Python版本:3.5.3
- 复现信息:将ai studio行运行无误的代码(公开链接:https://aistudio.baidu.com/aistudio/projectdetail/96351),迁移到本地环境。在预测过程中报错。
报错信息如下:
Traceback (most recent call last):
File "C:/Users/user/Desktop/code/project/06_text_classification/text_classification.py", line 288, in
fetch_list=fetch_targets) File "C:\Users\user\AppData\Roaming\Python\Python35\site-packages\paddle\fluid\executor.py", line 657, in run use_program_cache=use_program_cache) File "C:\Users\user\AppData\Roaming\Python\Python35\site-packages\paddle\fluid\executor.py", line 755, in _run exe.run(program.desc, scope, 0, True, True, fetch_var_name) paddle.fluid.core_avx.EnforceNotMet: Invoke operator lookup_table error. Python Call stacks: File "C:\Users\user\AppData\Roaming\Python\Python35\site-packages\paddle\fluid\framework.py", line 1774, in append_op attrs=kwargs.get("attrs", None)) File "C:\Users\user\AppData\Roaming\Python\Python35\site-packages\paddle\fluid\layer_helper.py", line 43, in append_op return self.main_program.current_block().append_op(*args, **kwargs) File "C:\Users\user\AppData\Roaming\Python\Python35\site-packages\paddle\fluid\layers\nn.py", line 414, in embedding 'padding_idx': padding_idx File "C:/Users/user/Desktop/code/project/06_text_classification/text_classification.py", line 141, in CNN_net emb = fluid.layers.embedding(input=data,size=[dict_dim, emb_dim]) File "C:/Users/user/Desktop/code/project/06_text_classification/text_classification.py", line 167, in model = CNN_net(words, dict_dim) C++ Call stacks: Tensor holds the wrong type, it holds int, but desires to be int64_t at [D:\1.5.2\paddle\paddle/fluid/framework/tensor_impl.h:30] PaddlePaddle Call Stacks: Windows not support stack backtrace yet.
怀疑是create_lod_tensor接口使用问题,但为何在ai studio上运行正常,但在本地环境报错?
AI Studio应该是默认运行在Linux上的,但我看你的代码是跑在windows上出的错,目前Linux和Windows可能在有些小的地方会有些区别,我尝试一下是否能复现你这个问题
你好,我把你的代码移植到了windows本地试了一下,并没有复现你的问题:
https://pan.baidu.com/s/1BKa6LkbGCdpfc9l8jpsSOA 提取码: rwmc

我用的Paddle版本是paddlepaddle-gpu 1.5.2.post107
我的本地环境,训练也是没问题的,预测阶段报错的。您那边预测阶段有报错么
可以把预测代码里面的两行改成这样: data.append(data1) data.append(data2)
data.append(np.array(data1).astype(np.int64)) data.append(np.array(data2).astype(np.int64))
Since you haven't replied for more than a year, we have closed this issue/pr. If the problem is not solved or there is a follow-up one, please reopen it at any time and we will continue to follow up. 由于您超过一年未回复,我们将关闭这个issue/pr。 若问题未解决或有后续问题,请随时重新打开,我们会继续跟进。