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')
相关推荐
sunneo3 分钟前
S16.6第一性原理做产品(6·收官):从《定位》到“品类设计“——AI时代如何定义新品类
人工智能·产品运营·产品经理·用户运营·用户体验·ai-native
QN1幻化引擎3 分钟前
DalinX 自述:从认识自己到成为自己-黎明前的第七杯咖啡
人工智能·机器学习
dozenyaoyida3 分钟前
AI与大模型新闻日报 | 2026-07-12
人工智能·ai·大模型·新闻
用户1728839443845 分钟前
AI Coding Agent 如何做可观测性:从 OpenTelemetry 到工具调用回放
人工智能
阿虎儿5 分钟前
Dify Agent调用插件超时:PluginDaemonInternalServerError: killed by timeout
人工智能
Eating66666688 分钟前
沁言学术与 Elicit:硕士研究生文献综述工具对比
人工智能
ksueh9 分钟前
AI怎么写小说大纲?三层千章大纲+5维度章纲+提示词模板实操
人工智能·ai写作·ai助手
worilb12 分钟前
Spring Cloud 学习与实践(15):使用 TraceId 与 MDC 串联微服务日志
学习·spring cloud·微服务
不坑老师16 分钟前
怎么在Word中制作汉字书写笔顺——不坑盒子汉字笔顺步骤在小学低段识字教学中的应用
前端·数据库·人工智能·word·excel·office
乌恩大侠17 分钟前
【AI-RAN】面向电信行业的 NVIDIA DGX BasePOD
人工智能·fpga开发·o-ru