BERT-BiLSTM-CRF-NER icon indicating copy to clipboard operation
BERT-BiLSTM-CRF-NER copied to clipboard

创建bert类时,传入的标签数“”num_labels=len(label_list) + 1“” 为什么要+1?

Open 23-zhou opened this issue 4 years ago • 2 comments

model_fn = model_fn_builder( bert_config=bert_config, num_labels=len(label_list) + 1, #######这里???为什么要加 1 有什么作用?? init_checkpoint=args.init_checkpoint, learning_rate=args.learning_rate, num_train_steps=num_train_steps, num_warmup_steps=num_warmup_steps, args=args)

23-zhou avatar Jun 23 '20 13:06 23-zhou

是不是在规范句子长度时中添加【padding】是不存在标签的,所添加一个不存在的标签,这就是+1的原因。。,。。个人理解,不太成熟,望大拿指教。

23-zhou avatar Jun 23 '20 15:06 23-zhou

+1

MAJIN123 avatar Sep 02 '21 13:09 MAJIN123