kpe / bert-for-tf2

A Keras TensorFlow 2.0 implementation of BERT, ALBERT and adapter-BERT.
https://github.com/kpe/bert-for-tf2
MIT License
803 stars 193 forks source link

Get Each layer's output in Bert model #67

Closed zjrn closed 4 years ago

zjrn commented 4 years ago

I find all bert model is a single layer in final Keras Model. How can I get each layer's output in Bert Model?

kpe commented 4 years ago

you can use the out_layer_ndxs parameter, which is a list specifying the layer outputs BertModelLayer will return.