zjunlp / DeepKE

[EMNLP 2022] An Open Toolkit for Knowledge Graph Extraction and Construction
http://deepke.zjukg.cn/
MIT License
3.52k stars 682 forks source link

cmd 运行example/re/standard/run.py一直报错 #480

Closed yin-xxxxxx closed 6 months ago

yin-xxxxxx commented 6 months ago

C:\Users\Ylab\deepke\example\re\standard>python run.py Traceback (most recent call last): File "C:\Users\Ylab\deepke\example\re\standard\run.py", line 2, in import hydra File "D:\python\Lib\site-packages\hydra__init.py", line 5, in from hydra import utils File "D:\python\Lib\site-packages\hydra\utils.py", line 10, in from hydra._internal.utils import ( File "D:\python\Lib\site-packages\hydra_internal\utils.py", line 21, in from hydra.core.utils import get_valid_filename, split_config_path File "D:\python\Lib\site-packages\hydra\core\utils.py", line 17, in from hydra.core.hydra_config import HydraConfig File "D:\python\Lib\site-packages\hydra\core\hydra_config.py", line 6, in from hydra.conf import HydraConf File "D:\python\Lib\site-packages\hydra\conf\init.py", line 62, in class JobConf: File "D:\python\Lib\site-packages\hydra\conf\init__.py", line 87, in JobConf @dataclass File "D:\python\Lib\dataclasses.py", line 1268, in dataclass return wrap(cls) File "D:\python\Lib\dataclasses.py", line 1258, in wrap return _process_class(cls, init, repr, eq, order, unsafe_hash, File "D:\python\Lib\dataclasses.py", line 994, in _process_class cls_fields.append(_get_field(cls, name, type, kw_only))

File "D:\python\Lib\dataclasses.py", line 852, in _get_field raise ValueError(f'mutable default {type(f.default)} for field ' ValueError: mutable default <class 'hydra.conf.JobConf.JobConfig.OverrideDirname'> for field override_dirname is not allowed: use default_factor

xxupiano commented 6 months ago

请问hydra版本是否安装正确? https://github.com/zjunlp/DeepKE/blob/main/requirements.txt#L2

yin-xxxxxx commented 6 months ago

请问hydra版本是否安装正确? https://github.com/zjunlp/DeepKE/blob/main/requirements.txt#L2

对的,1.0.6

xxupiano commented 6 months ago

numpy版本问题,请严格按照requirements中的版本号安装

zxlzr commented 6 months ago

您好,报错是bert模型下载问题,建议您科学上网下载,或在wisemodel modelscope 下载bert 拷贝到目录后运行,参见 https://github.com/zjunlp/DeepKE/issues/469 等先前issue

zxlzr commented 6 months ago

请问您还有其他问题吗?

dcosmice commented 6 months ago

请问您还有其他问题吗?

有的,参考469后还是和469一样的错误 [2024-04-26 09:33:11,404][main][INFO] - device: cpu [2024-04-26 09:33:11,404][deepke.relation_extraction.standard.tools.preprocess][INFO] - ===== start preprocess data ===== [2024-04-26 09:33:11,404][deepke.relation_extraction.standard.tools.preprocess][INFO] - load raw files... [2024-04-26 09:33:11,404][utils.ioUtils][INFO] - load csv from C:\Users\Ylab\DeepKE\example\re\standard\data/origin\train.csv [2024-04-26 09:33:11,410][utils.ioUtils][INFO] - load csv from C:\Users\Ylab\DeepKE\example\re\standard\data/origin\valid.csv [2024-04-26 09:33:11,412][utils.ioUtils][INFO] - load csv from C:\Users\Ylab\DeepKE\example\re\standard\data/origin\test.csv [2024-04-26 09:33:11,415][utils.ioUtils][INFO] - load csv from C:\Users\Ylab\DeepKE\example\re\standard\data/origin\relation.csv [2024-04-26 09:33:11,415][deepke.relation_extraction.standard.tools.preprocess][INFO] - clean data... [2024-04-26 09:33:11,415][deepke.relation_extraction.standard.tools.preprocess][INFO] - convert relation into index... [2024-04-26 09:33:11,418][deepke.relation_extraction.standard.tools.preprocess][INFO] - verify whether use pretrained language models... [2024-04-26 09:33:11,418][deepke.relation_extraction.standard.tools.preprocess][INFO] - use pretrained language models serialize sentence... [2024-04-26 09:33:11,418][deepke.relation_extraction.standard.tools.preprocess][INFO] - use bert tokenizer... Traceback (most recent call last): File "run.py", line 61, in main preprocess(cfg) File "C:\Users\Ylab\DeepKE\venv\lib\site-packages\deepke-2.2.7-py3.8.egg\deepke\relation_extraction\standard\tools\preprocess.py", line 208, in preprocess
_lm_serialize(train_data, cfg) File "C:\Users\Ylab\DeepKE\venv\lib\site-packages\deepke-2.2.7-py3.8.egg\deepke\relation_extraction\standard\tools\preprocess.py", line 120, in _lm_serialize
tokenizer = BertTokenizer.from_pretrained(cfg.lm_file) File "C:\Users\Ylab\DeepKE\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 1763, in from_pretrained resolved_vocab_files[file_id] = cached_file( File "C:\Users\Ylab\DeepKE\venv\lib\site-packages\transformers\utils\hub.py", line 409, in cached_file resolved_file = hf_hub_download( File "C:\Users\Ylab\DeepKE\venv\lib\site-packages\huggingface_hub\utils_validators.py", line 124, in _inner_fn return fn(*args, **kwargs) File "C:\Users\Ylab\DeepKE\venv\lib\site-packages\huggingface_hub\file_download.py", line 1148, in hf_hub_download with open(ref_path) as f: FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Ylab/.cache\huggingface\hub\models--bert-base-chinese\refs\main'

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

请问怎么解决

zxlzr commented 6 months ago

FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Ylab/.cache\huggingface\hub\models--bert-base-chinese\refs\main' 请您检查路径下是否有下载好的模型,路径是否正确

dcosmice commented 6 months ago

FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Ylab/.cache\huggingface\hub\models--bert-base-chinese\refs\main' 请您检查路径下是否有下载好的模型,路径是否正确

在MIAN中添加了模型,也在huggingface下载了TEXT,出现如下问题了捏:

requests.exceptions.SSLError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /bert-base-chinese/resolve/main/vocab.txt (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)')))

zxlzr commented 6 months ago

应该是这个文件vocab.txt 缺失

dcosmice commented 6 months ago

应该是这个文件vocab.txt 缺失

再次运行错误又变成无法访问了,这是咋回事呀,是看到有个/.cache,怎么改呢 PermissionError: [Errno 13] Permission denied: 'C:\Users\Ylab/.cache\huggingface\hub\models--bert-base-chinese\refs\main'

zxlzr commented 6 months ago

您可以检查下路径的权限设置,以及这路径是否存在。

dcosmice commented 6 months ago

应该是这个文件vocab.txt 缺失

这个文件还应该在哪个路径下添加呢? requests.exceptions.SSLError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /bert-base-chinese/resolve/main/vocab.txt (Caused by SSLError(SSLError(1, '[SSL] unknown error (_ssl.c:1131)')))

zxlzr commented 6 months ago

和bert模型权重同一个目录下

xxupiano commented 6 months ago

C:\Users\Ylab/.cache\huggingface\hub\models--bert-base-chinese\refs\main 路径斜杠错误,请使用linux跑实验。如果win,请尝试使用双斜杠\\

xxupiano commented 6 months ago
  1. example下有各种任务的代码
  2. 是指用了BERT,那是因为BERT模型里的BertPooler包含BiLSTM 请仔细阅读README后再使用DeepKE
dcosmice commented 6 months ago
  1. example下有各种任务的代码
  2. 是指用了BERT,那是因为BERT模型里的BertPooler包含BiLSTM 请仔细阅读README后再使用DeepKE

okk,非常感谢!

zxlzr commented 6 months ago

请问您还有其他问题吗?