bert-base-uncased使用

1.下载模型

https://github.com/google-research/bert?tab=readme-ov-file

2.下载config.json和pytorch_model.bin

https://huggingface.co/google-bert/bert-base-uncased/tree/main

3.解压缩到同一文件夹

4.代码测试

复制代码
from transformers import BertModel,BertTokenizer

BERT_PATH = 'D:/bert/241109'

tokenizer = BertTokenizer.from_pretrained(BERT_PATH)

print(tokenizer.tokenize('I have an apple, thank you.'))

bert = BertModel.from_pretrained(BERT_PATH)

print('load bert model over')
相关推荐
城电科技8 分钟前
城电科技|零碳美丽示范村建设方案 能源+景观+教育
人工智能·科技·生活·能源
opentrending5 小时前
Github 热点项目 awesome-mcp-servers MCP 服务器合集,3分钟实现AI模型自由操控万物!
服务器·人工智能·github
lisw055 小时前
DeepSeek原生稀疏注意力(Native Sparse Attention, NSA)算法介绍
人工智能·深度学习·算法
whaosoft-1436 小时前
51c深度学习~合集4
人工智能
逢生博客6 小时前
阿里 FunASR 开源中文语音识别大模型应用示例(准确率比faster-whisper高)
人工智能·python·语音识别·funasr
白夜易寒6 小时前
Docker学习之私有仓库(day10)
学习·docker·容器
淮北4946 小时前
ros调试工具foxglove使用指南三:在3d空间写写画画(Panel->3D ->Scene entity)
python·学习·3d·机器人
哲讯智能科技6 小时前
智慧能源新篇章:SAP如何赋能光伏行业数字化转型
大数据·人工智能
云卓SKYDROID6 小时前
无人机DSP处理器工作要点!
人工智能·无人机·科普·云卓科技
gang_unerry7 小时前
量子退火与机器学习(2):少量实验即可找到新材料,黑盒优化➕量子退火
人工智能·机器学习·量子计算·量子退火