Skip to content
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: Invalid UTF-8 sentence! #724

Open
Ech0Sakura opened this issue Feb 28, 2025 · 0 comments
Open

报错 RuntimeError: Invalid UTF-8 sentence! #724

Ech0Sakura opened this issue Feb 28, 2025 · 0 comments

Comments

@Ech0Sakura
Copy link

ltp为4.2.0。代码如下
`

    output = self.ltp.pipeline([sentence], tasks=["cws", "pos", "dep", "srl"])
    seg = output.get("cws")[0]
    postags = output.get("pos")[0]
    arcs = output.get("dep")[0]
    roles = output.get("srl")[0]

`

结果报错:

Traceback (most recent call last):
File "E:\PycharmProjects\Llama-API-Deploy\triple_extract.py", line 190, in
triple = extractor.triples_main(row['输入文本'])
File "E:\PycharmProjects\Llama-API-Deploy\triple_extract.py", line 170, in triples_main
words, postags, child_dict_list, roles_dict, arcs = self.parser.parser_main(sentence)
File "E:\PycharmProjects\Llama-API-Deploy\triple_extract.py", line 47, in parser_main
output = self.ltp.pipeline([sentence], tasks=["cws", "pos", "dep", "srl"])
File "C:\ProgramData\Anaconda3\lib\site-packages\ltp\nerual.py", line 24, in wrapper
return func(*args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\ltp\nerual.py", line 185, in pipeline
store[task] = self.post[task](result, hidden, store, inputs, tokenized)
File "C:\ProgramData\Anaconda3\lib\site-packages\ltp\nerual.py", line 24, in wrapper
return func(*args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\ltp\nerual.py", line 282, in _cws_post
words = [self.hook.hook(t, w) for t, w in zip(inputs, words)]
File "C:\ProgramData\Anaconda3\lib\site-packages\ltp\nerual.py", line 282, in
words = [self.hook.hook(t, w) for t, w in zip(inputs, words)]
RuntimeError: Invalid UTF-8 sentence!

看全网都没有遇到这个报错。有人知道吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant