Pretrained.ner下的模型加载都失败了

对照了官网的包和安装命令都没问题,其他的多任务模型和单任务模型加载也没有问题,只有ner下的模型加载都失败了

下载命令: pip install hanlp[full]

ner = hanlp.load(hanlp.pretrained.ner.MSRA_NER_BERT_BASE_ZH)
OS: Windows-10-10.0.19044-SP0
Python: 3.9.12
PyTorch: 1.11.0+cpu
TensorFlow: 2.6.0
HanLP: 2.1.0-beta.27
Traceback (most recent call last):
  File "D:\work_py\hanlpTest\myhanlp\hanlp_test.py", line 30, in <module>
    ner = hanlp.load(hanlp.pretrained.ner.MSRA_NER_BERT_BASE_ZH)
  File "D:\work\Anaconda3\envs\hanlpTest\lib\site-packages\hanlp\__init__.py", line 43, in load
    return load_from_meta_file(save_dir, 'meta.json', verbose=verbose, **kwargs)
  File "D:\work\Anaconda3\envs\hanlpTest\lib\site-packages\hanlp\utils\component_util.py", line 171, in load_from_meta_file
    raise e from None
  File "D:\work\Anaconda3\envs\hanlpTest\lib\site-packages\hanlp\utils\component_util.py", line 99, in load_from_meta_file
    obj.load(save_dir, verbose=verbose, **kwargs)
  File "D:\work\Anaconda3\envs\hanlpTest\lib\site-packages\hanlp\common\keras_component.py", line 214, in load
    self.build(**merge_dict(self.config, training=False, logger=logger, **kwargs, overwrite=True, inplace=True))
  File "D:\work\Anaconda3\envs\hanlpTest\lib\site-packages\hanlp\common\keras_component.py", line 224, in build
    self.model = self.build_model(**merge_dict(self.config, training=kwargs.get('training', None),
  File "D:\work\Anaconda3\envs\hanlpTest\lib\site-packages\hanlp\components\taggers\transformers\transformer_tagger_tf.py", line 34, in build_model
    model, tokenizer = build_transformer(transformer, max_seq_length, len(self.transform.tag_vocab), tagging=True)
  File "D:\work\Anaconda3\envs\hanlpTest\lib\site-packages\hanlp\layers\transformers\loader_tf.py", line 14, in build_transformer
    l_bert = TFAutoModel.from_pretrained(transformer)
  File "D:\work\Anaconda3\envs\hanlpTest\lib\site-packages\transformers\utils\import_utils.py", line 773, in __getattr__
    requires_backends(cls, cls._backends)
  File "D:\work\Anaconda3\envs\hanlpTest\lib\site-packages\transformers\utils\import_utils.py", line 761, in requires_backends
    raise ImportError("".join(failed))
ImportError: 
TFAutoModel requires the TensorFlow library but it was not found in your environment. Checkout the instructions on the
installation page: https://www.tensorflow.org/install and follow the ones that match your environment.


Process finished with exit code 1

我用的 hanlp.pipeline,一开始前面使用了 electras模型分词,后面用 albert 做ner,报了类似的错误。后面改成albert模型分词,可以执行成功
报错代码

HanLP = hanlp.pipeline() \
            .append(hanlp.load(hanlp.pretrained.tok.COARSE_ELECTRA_SMALL_ZH), output_key='tok') \
            .append(hanlp.load(hanlp.pretrained.ner.MSRA_NER_ALBERT_BASE_ZH), output_key='ner')

成功代码

HanLP = hanlp.pipeline() \
            .append(hanlp.load(hanlp.pretrained.tok.LARGE_ALBERT_BASE), output_key='tok') \
            .append(hanlp.load(hanlp.pretrained.ner.MSRA_NER_ALBERT_BASE_ZH), output_key='ner')