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

运行完main.py后运行predict.py出现报错 #46

Open
okfmeplz opened this issue Nov 22, 2024 · 2 comments
Open

运行完main.py后运行predict.py出现报错 #46

okfmeplz opened this issue Nov 22, 2024 · 2 comments

Comments

@okfmeplz
Copy link

SyntaxError: Non-UTF-8 code starting with '\xe5' in file .........NER\BERT-BILSTM-CRF\predict.py on line 74, but no encoding declared

@taishan1994
Copy link
Owner

文件最开头加上# coding=utf-8

@okfmeplz
Copy link
Author

谢谢大佬,我改过之后好像还报了不一样的:
Traceback (most recent call last):
File "D\NER\BERT-BILSTM-CRF\predict.py", line 70, in
predictor = Predictor("dgre")
File "D:\NER\BERT-BILSTM-CRF\predict.py", line 24, in init
self.ner_args = get_args(os.path.join("./checkpoint/{}/".format(data_name), "ner_args.json"), "ner_args")
File "D:\NER\BERT-BILSTM-CRF\predict.py", line 15, in get_args
args_dict = json.load(fp)
File "C:\ProgramData\anaconda3\envs\pytorch-gpu\lib\json_init_.py", line 293, in load
return loads(fp.read(),
File "C:\ProgramData\anaconda3\envs\pytorch-gpu\lib\codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb9 in position 180: invalid start byte
(TAT

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

2 participants