该模型已针对中文进行预训练,训练过程中对词片段独立应用了随机输入掩码(与原始 BERT 论文中的做法一致)。
该模型可用于掩码语言建模。
内容警告:读者需注意,本节包含可能令人不安、冒犯性的内容,并可能传播历史及当前的刻板印象。
已有大量研究探讨了语言模型中的偏见与公平性问题(例如,参见 Sheng et al. (2021) 和 Bender et al. (2021))。
[需更多信息]
[需更多信息]
from transformers import AutoTokenizer, AutoModelForMaskedLM
import torch
import torch_npu
device=torch.device('npu:0')
tokenizer = AutoTokenizer.from_pretrained("bert-base-chinese")
model = AutoModelForMaskedLM.from_pretrained("bert-base-chinese")to(device)