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')
相关推荐
武子康2 小时前
调查研究-186 LangChain 和 LangGraph 的区别:从快速构建 Agent 到生产级工作流编排
人工智能·langchain·llm
武子康3 小时前
调查研究-185 CodeGraph 调研:给 AI 编程 Agent 一张代码库地图,少一点反复 grep(2026)
人工智能·openai·claude
aqi004 小时前
15天学会AI应用开发(八)使用向量数据库实现RAG功能
人工智能·python·大模型·ai编程·ai应用
混沌福王5 小时前
Electron三端统一架构:运行时Adapter、IPC能力边界与分层设计
人工智能·agent·ai编程
说了很好5 小时前
马尔可夫扩散链+损失函数推导,手把手实现原生Diffusion
人工智能
聂二AI落地内参5 小时前
合同抽取别停在 JSON:标准规则和交易日历才是硬仗
人工智能
冬哥聊AI5 小时前
滴滴Agent岗二面:RAG 系统的 LLM 幻觉怎么治?从两类根源讲到四道防线
人工智能
lyshlc5 小时前
# AI Agent的推迟判定协议:不确定性下的最优策略
人工智能
用户329901675055 小时前
用zod在运行时兜住AI返回的JSON
人工智能