OSError: Can‘t load tokenizer for ‘bert-base-chinese‘

文章目录

  • [OSError: Can't load tokenizer for 'bert-base-chinese'](#OSError: Can't load tokenizer for 'bert-base-chinese')

OSError: Can't load tokenizer for 'bert-base-chinese'

1.问题描述

使用from_pretrained()函数从预训练的权重中加载模型时报错:

OSError: Can't load tokenizer for 'bert-base-chinese'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'bert-base-chinese' is the correct path to a directory containing allrelevant files for a BertTokenizer tokenizer.

原因:主机或服务器 不能访问https://huggingface.co/页面,因此不能下载相应的权重。

2.解决办法

将权重文件下载到本地或服务器,使用本地权重文件实现加载,而不是在线下载。

  • 进入官网,Models页面,下载对应的Bert模型的权重。
  • 将下载的权重文件,放到某个文件夹下(加载路径的位置)
  • 修改权重文件的加载路径,也就是from_pretrained()函数里面的权重文件路径。注意:必须是绝对路径

成功解决!!!

😃😃😃

相关推荐
AI语宙漫游指南7 分钟前
从 CV 扩散到 NLP:详解 Google DiffusionGemma 架构、推理机制与优劣
深度学习·llm
逻辑君3 小时前
认知神经科学研究报告【20260089】
人工智能·深度学习·机器学习
装不满的克莱因瓶4 小时前
掌握语义分割经典模型 FCN——从像素分类到端到端分割的奠基之作
人工智能·python·深度学习·算法·机器学习·分类·数据挖掘
chen_zn955 小时前
VLA 的 Co-training:通过多源数据提升机器人泛化能力
人工智能·深度学习·具身智能·vla
大模型最新论文速读5 小时前
06-15 · LLM 最新论文速览
论文阅读·人工智能·深度学习·自然语言处理
_codemonster5 小时前
手语识别损失函数
人工智能·深度学习·机器学习
装不满的克莱因瓶5 小时前
了解3D卷积原理——从空间感知到时空建模的深度学习核心算子
人工智能·pytorch·python·深度学习·机器学习·3d·ai
人工智能培训6 小时前
数字孪生的未来发展方向探析
gpt·深度学习·机器学习·容器·知识图谱
江畔柳前堤6 小时前
github实战指南03-Pull Request 全流程实战
开发语言·人工智能·python·深度学习·github·word