最简单的demo运行失败-语料库load失败

遇到问题报错如下:

Failed to load https://file.hankcs.com/hanlp/mtl/close_tok_pos_ner_srl_dep_sdp_con_electra_small_20210111_124159.zip. See traceback below:
================================ERROR LOG BEGINS================================
Traceback (most recent call last):
  File "D:\Anaconda3\envs\buaa_crawler\lib\site-packages\hanlp\utils\component_util.py", line 81, in load_from_meta_file
    obj.load(save_dir, verbose=verbose, **kwargs)
  File "D:\Anaconda3\envs\buaa_crawler\lib\site-packages\hanlp\common\torch_component.py", line 173, in load
    self.load_config(save_dir, **kwargs)
  File "D:\Anaconda3\envs\buaa_crawler\lib\site-packages\hanlp\common\torch_component.py", line 125, in load_config
    self.config[k] = Configurable.from_config(v)
  File "D:\Anaconda3\envs\buaa_crawler\lib\site-packages\hanlp_common\configurable.py", line 30, in from_config
    return cls(**deserialized_config)
  File "D:\Anaconda3\envs\buaa_crawler\lib\site-packages\hanlp\layers\embeddings\contextual_word_embedding.py", line 143, in __init__
    do_basic_tokenize=do_basic_tokenize)
  File "D:\Anaconda3\envs\buaa_crawler\lib\site-packages\hanlp\layers\transformers\encoder.py", line 124, in build_transformer_tokenizer
    return AutoTokenizer.from_pretrained(transformer, use_fast=use_fast, do_basic_tokenize=do_basic_tokenize)
  File "D:\Anaconda3\envs\buaa_crawler\lib\site-packages\transformers\models\auto\tokenization_auto.py", line 395, in from_pretrained
    return tokenizer_class_fast.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
  File "D:\Anaconda3\envs\buaa_crawler\lib\site-packages\transformers\tokenization_utils_base.py", line 1750, in from_pretrained
    use_auth_token=use_auth_token,
  File "D:\Anaconda3\envs\buaa_crawler\lib\site-packages\transformers\file_utils.py", line 1086, in cached_path
    local_files_only=local_files_only,
  File "D:\Anaconda3\envs\buaa_crawler\lib\site-packages\transformers\file_utils.py", line 1265, in get_from_cache
    "Connection error, and we cannot find the requested files in the cached path."
ValueError: Connection error, and we cannot find the requested files in the cached path. Please try again or make sure your Internet connection is on.
=================================ERROR LOG ENDS=================================
If the problem still persists, please submit an issue to https://github.com/hankcs/HanLP/issues
When reporting an issue, make sure to paste the FULL ERROR LOG above.```


代码如下:

import hanlp
HanLP = hanlp.load(hanlp.pretrained.mtl.CLOSE_TOK_POS_NER_SRL_DEP_SDP_CON_ELECTRA_SMALL_ZH) 

我昨天还运行正常,今天就成这样了

最简单的答案,今天大陆无法访问hugging face transformers

1 Like

1 个帖子已被合并到了现有主题:hanlp是否可以先下载预训练模型在本地加载