当前位置:   article > 正文

加载Bert预训练模型时报错:huggingface_hub.utils._validators.HFValidationError

huggingface_hub.utils._validators.hfvalidationerror: repo id must use alphan

具体报错情况如下:
huggingface_hub.utils._validators.HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': './bert/bert_base_cased_ICEWS14'. Userepo_typeargument if needed.

很简单,我download下来的代码没有并没有模型参数的文件,所以去https://huggingface.co/bert-base-cased/tree/main下载然后放到文件夹里就好了。

注意BertTokenizerFast.from_pretrained里面放的是模型参数文件所在的文件夹而不是文件本身。
在这里插入图片描述

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号