clovexcwz / ner_demo Goto Github PK
View Code? Open in Web Editor NEW中文命名实体识别NER。用keras实现BILSTM+CRF、IDCNN+CRF、BERT+BILSTM+CRF进行实体识别。结果当然是BERT+BILSTM+CRF最好啦。
中文命名实体识别NER。用keras实现BILSTM+CRF、IDCNN+CRF、BERT+BILSTM+CRF进行实体识别。结果当然是BERT+BILSTM+CRF最好啦。
I am so sorry to found that your f1score and recall are wrong.
yours:
f1score = f1_score(pre, test_label, average='macro')
recall = recall_score(pre, test_label, average='macro')
but:
def f1_score(y_true, y_pred, *, labels=None, pos_label=1, average='binary',
sample_weight=None, zero_division="warn")
def recall_score(y_true, y_pred, *, labels=None, pos_label=1, average='binary',
sample_weight=None, zero_division="warn")
the position of y_true and y_pred is reversed.
it is cost a long time for finding this difference when i use my DIY metricts.
为什么不对比BERT-IDCNN-CRF模型呢
遇到了这个问题,折腾了好久。
这是keras-transformer版本问题,换成0.31.0就ok了。
给后来者留个提醒。
想问一下keras-contrib怎么下载0.0.2版本 github上只有最新的版本
你好,这是什么原因造成的呢?
Traceback (most recent call last):
File "D:/研究生/NER_DEMO-master/NER_DEMO-master/train.py", line 108, in
info_list = train_sample(train_model='BERTBILSTMCRF', epochs=15, log=log)
File "D:/研究生/NER_DEMO-master/NER_DEMO-master/train.py", line 52, in train_sample
model = model_class.creat_model()
File "D:\研究生\NER_DEMO-master\NER_DEMO-master\Model\BERT_BILSTM_CRF.py", line 51, in creat_model
x = self.crf(x)
File "D:\Application\python3.6\lib\site-packages\keras\engine\base_layer.py", line 443, in call
previous_mask = _collect_previous_mask(inputs)
File "D:\Application\python3.6\lib\site-packages\keras\engine\base_layer.py", line 1311, in _collect_previous_mask
mask = node.output_masks[tensor_index]
AttributeError: 'Node' object has no attribute 'output_masks'
while training, BERTBILSTMCRF,when create model, it raise:
TypeError: get_encoders() got an unexpected keyword argument 'use_adapter'
Traceback (most recent call last):
File "train.py", line 101, in
info_list = train_sample(train_model=model, epochs=10, log=log)
File "train.py", line 51, in train_sample
model = model_class.creat_model()
File "/root/NER_DEMO-master/Model/BERT_BILSTM_CRF.py", line 39, in creat_model
trainable=True)
File "/root/miniconda3/envs/tf/lib/python3.6/site-packages/keras_bert/loader.py", line 169, in load_trained_model_from_checkpoint
**kwargs)
File "/root/miniconda3/envs/tf/lib/python3.6/site-packages/keras_bert/loader.py", line 58, in build_model_from_config
**kwargs)
File "/root/miniconda3/envs/tf/lib/python3.6/site-packages/keras_bert/bert.py", line 91, in get_model
dropout_rate=dropout_rate,
File "/root/miniconda3/envs/tf/lib/python3.6/site-packages/keras_bert/layers/embedding.py", line 56, in get_embedding
)(embed_layer)
File "/root/miniconda3/envs/tf/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 663, in call
inputs, outputs, args, kwargs)
File "/root/miniconda3/envs/tf/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1708, in set_connectivity_metadata
input_tensors=inputs, output_tensors=outputs, arguments=kwargs)
File "/root/miniconda3/envs/tf/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1796, in _add_inbound_node
input_tensors)
File "/root/miniconda3/envs/tf/lib/python3.6/site-packages/tensorflow/python/util/nest.py", line 515, in map_structure
structure[0], [func(*x) for x in entries],
File "/root/miniconda3/envs/tf/lib/python3.6/site-packages/tensorflow/python/util/nest.py", line 515, in
structure[0], [func(*x) for x in entries],
File "/root/miniconda3/envs/tf/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1795, in
inbound_layers = nest.map_structure(lambda t: t._keras_history.layer,
AttributeError: 'tuple' object has no attribute 'layer'
执行这句话
model = keras_bert.load_trained_model_from_checkpoint(config_file=config_path,
checkpoint_file=checkpoint_path,
)
报如下错误:
AttributeError: 'tuple' object has no attribute 'layer'
我训练了5Epochs,F1-score达到0.96,但是我写了代码预测测试集中的几句话,结果全是0
我按照data2的格式修改了我的数据集 并且在vocab.py里修改了实体类别 但我试验抛出的结果显示正确率没问题 但召回率和F值只有0.0几 请问下问题出在那里 歇息大佬
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.