hanlp2.1在离线情况下无法加载模型

hanlp2.1 在断网的时候,加载模型分词时,回去请求一个cached_path,不知道这样的作用是什么,想问一下,应该怎麽样才可以离线运行。

Failed to load https://file.hankcs.com/hanlp/mtl/ud_ontonotes_tok_pos_lem_fea_ner_srl_dep_sdp_con_mt5_small_20210228_123458.zip. See traceback below:
================================ERROR LOG BEGINS================================
Traceback (most recent call last):
  File "D:\python\env\venv\lib\site-packages\hanlp\utils\component_util.py", line 81, in load_from_meta_file
    obj.load(save_dir, verbose=verbose, **kwargs)
  File "D:\python\env\venv\lib\site-packages\hanlp\common\torch_component.py", line 173, in load
    self.load_config(save_dir, **kwargs)
  File "D:\python\env\venv\lib\site-packages\hanlp\common\torch_component.py", line 125, in load_config
    self.config[k] = Configurable.from_config(v)
  File "D:\python\env\venv\lib\site-packages\hanlp_common\configurable.py", line 30, in from_config
    return cls(**deserialized_config)
  File "D:\python\env\venv\lib\site-packages\hanlp\layers\embeddings\contextual_word_embedding.py", line 143, in __init__
    do_basic_tokenize=do_basic_tokenize)
  File "D:\python\env\venv\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:\python\env\venv\lib\site-packages\transformers\models\auto\tokenization_auto.py", line 379, in from_pretrained
    return tokenizer_class.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
  File "D:\python\env\venv\lib\site-packages\transformers\tokenization_utils_base.py", line 1750, in from_pretrained
    use_auth_token=use_auth_token,
  File "D:\python\env\venv\lib\site-packages\transformers\file_utils.py", line 1086, in cached_path
    local_files_only=local_files_only,
  File "D:\python\env\venv\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=================================

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