Windows环境下triple的predict.py测试样例,打开文件需指定UTF-8编码
Describe the bug
A clear and concise description of what the bug is.
example\triple\predict.py文件中存在的两个打开文件代码,未指定编码,Windows环境下会因编码导致处理失败。 添加编码信息即可。
(vdeepke) D:\NLP\DeepKE-main-6808f15\example\triple>python predict.py
wandb: WARNING W&B installed but not logged in. Run wandb login or set the WANDB_API_KEY env variable.
D:\NLP\vdeepke\lib\site-packages\hydra\plugins\config_source.py:190: UserWarning:
Missing @package directive hydra/output/custom.yaml in file://D:\NLP\DeepKE-main-6808f15\example\triple\conf.
See https://hydra.cc/docs/next/upgrades/0.11_to_1.0/adding_a_package_directive
warnings.warn(message=msg, category=UserWarning)
D:\NLP\vdeepke\lib\site-packages\hydra\plugins\config_source.py:190: UserWarning:
Missing @package directive preprocess.yaml in file://D:\NLP\DeepKE-main-6808f15\example\triple\conf.
See https://hydra.cc/docs/next/upgrades/0.11_to_1.0/adding_a_package_directive
warnings.warn(message=msg, category=UserWarning)
D:\NLP\vdeepke\lib\site-packages\hydra\plugins\config_source.py:190: UserWarning:
Missing @package directive train.yaml in file://D:\NLP\DeepKE-main-6808f15\example\triple\conf.
See https://hydra.cc/docs/next/upgrades/0.11_to_1.0/adding_a_package_directive
warnings.warn(message=msg, category=UserWarning)
D:\NLP\vdeepke\lib\site-packages\hydra\plugins\config_source.py:190: UserWarning:
Missing @package directive embedding.yaml in file://D:\NLP\DeepKE-main-6808f15\example\triple\conf.
See https://hydra.cc/docs/next/upgrades/0.11_to_1.0/adding_a_package_directive
warnings.warn(message=msg, category=UserWarning)
D:\NLP\vdeepke\lib\site-packages\hydra\plugins\config_source.py:190: UserWarning:
Missing @package directive predict.yaml in file://D:\NLP\DeepKE-main-6808f15\example\triple\conf.
See https://hydra.cc/docs/next/upgrades/0.11_to_1.0/adding_a_package_directive
warnings.warn(message=msg, category=UserWarning)
D:\NLP\vdeepke\lib\site-packages\hydra\plugins\config_source.py:190: UserWarning:
Missing @package directive model/lm.yaml in file://D:\NLP\DeepKE-main-6808f15\example\triple\conf.
See https://hydra.cc/docs/next/upgrades/0.11_to_1.0/adding_a_package_directive
warnings.warn(message=msg, category=UserWarning)
Traceback (most recent call last):
File "predict.py", line 42, in main
data = f.readlines()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa7 in position 15: illegal multibyte sequence
Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
Environment (please complete the following information):
- OS: [e.g. mac / window]
- Python Version [e.g. 3.6]
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.