好的,下面是使用Python和PyTorch实现一个基于BERT的文本分类模型的示例代码:
import torch
from transformers import BertTokenizer, BertForSequenceClassification
# 加载BERT预训练模型和tokenizer
model_name = 'bert-base-chinese'
tokenizer = BertTokenizer.from_pretrained(model_name)
model = BertForSequenceClassification.from_pretr