Open KangChou opened 2 years ago
你需要在 bert 预训练模型同目录下加个 config.json 文件
比如我用的 bert-base-chinese 就是
{
"attention_probs_dropout_prob": 0.1,
"directionality": "bidi",
"hidden_act": "gelu",
"hidden_dropout_prob": 0.1,
"hidden_size": 768,
"initializer_range": 0.02,
"intermediate_size": 3072,
"max_position_embeddings": 512,
"num_attention_heads": 12,
"num_hidden_layers": 12,
"pooler_fc_size": 768,
"pooler_num_attention_heads": 12,
"pooler_num_fc_layers": 3,
"pooler_size_per_head": 128,
"pooler_type": "first_token_transform",
"type_vocab_size": 2,
"vocab_size": 21128
}
具体方法可参考 此博客
of word in train: 55304:
of n-gram in memory: 71499
Traceback (most recent call last): File "wmseg_main.py", line 677, in
main()
File "wmseg_main.py", line 667, in main
train(args)
File "wmseg_main.py", line 101, in train
seg_model = WMSeg(word2id, gram2id, label_map, hpara, args)
File "/data/my_project/nlp_text/WMSeg/wmseg_model.py", line 98, in init
self.hpara['config'] = self.bert.config
AttributeError: 'NoneType' object has no attribute 'config'