macanv / BERT-BiLSTM-CRF-NER

Tensorflow solution of NER task Using BiLSTM-CRF model with Google BERT Fine-tuning And private Server services
https://github.com/macanv/BERT-BiLSMT-CRF-NER
4.67k stars 1.25k forks source link

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

Open 23-zhou opened 4 years ago

23-zhou commented 4 years ago

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 commented 4 years ago

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

MAJIN123 commented 2 years ago

+1