dengxc1220 / bert4keras_ner_demo

bert4keras NER
26 stars 7 forks source link

Can i ask about this error ? #1

Open marcusau opened 4 years ago

marcusau commented 4 years ago

bert配置

transformer_model='multi_cased_L-12_H-768_A-12'
transformer_model_path=os.path.join(bert_model_path,transformer_model)

config_path = transformer_model_path+'/bert_config.json'
checkpoint_path = transformer_model_path+'/bert_model.ckpt'
dict_path = transformer_model_path+'/vocab.txt'

output_layer = 'Transformer-%s-FeedForward-Norm' % bert_layers
output = model.get_layer(output_layer).output

ValueError Traceback (most recent call last)

in () 1 output_layer = 'Transformer-%s-FeedForward-Norm' % bert_layers ----> 2 output = model.get_layer(output_layer).output 3 output = Dense(num_labels)(output) 4 CRF = ConditionalRandomField(lr_multiplier=crf_lr_multiplier) 5 output = CRF(output, mask='Sequence-Mask') /usr/local/lib/python3.6/dist-packages/keras/engine/network.py in get_layer(self, name, index) 363 return layer 364 --> 365 raise ValueError('No such layer: ' + name) 366 367 @property ValueError: No such layer: Transformer-12-FeedForward-Norm
dengxc1220 commented 4 years ago

sorry to reply after such a long time, I think it is because the source code had been changed after the time that I publish this project. You can see the and follow the instruction by the author change the model establishing(albert+CRF) step. URL: https://github.com/bojone/bert4keras/blob/master/examples/task_sequence_labeling_ner_crf.py