Skip to content

没有任何更改的官方教程运行错误 #1

@leftsl

Description

@leftsl

环境:在BML codelab中的vscode运行的代码,使用的全部默认配置

code如下:

import paddlehub as hub
lac = hub.Module(name="lac")
test_text = ["今天是个好天气。"]
results = lac.cut(text=test_text, use_gpu=False, batch_size=1, return_tag=True)
print(results)
#{'word': ['今天', '是', '个', '好天气', '。'], 'tag': ['TIME', 'v', 'q', 'n', 'w']}

报错内容如下:
File "/home/aistudio/.paddlehub/modules/lac/module.py", line 208, in cut
predictor.run()
ValueError: In user code:

InvalidArgumentError: The type of data we are trying to retrieve (float32) does not match the type of data (int64) currently contained in the container.
  [Hint: Expected dtype() == phi::CppTypeToDataType<T>::Type(), but received dtype():9 != phi::CppTypeToDataType<T>::Type():10.] (at ../paddle/phi/core/dense_tensor.cc:160)
  [operator < pd_kernel.phi_kernel > error]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions