strongio / keras-bert

A simple technique to integrate BERT from tf hub to keras
258 stars 108 forks source link

Unable to run the code in Google Colaboratory #17

Closed ghost closed 5 years ago

ghost commented 5 years ago

I got this error when I run the code in google colaboratory

TypeError: The following are legacy tf.layers.Layers: <main.BertLayer object at 0x7fa94d2f5048> To use keras as a framework (for instance using the Network, Model, or Sequential classes), please use the tf.keras.layers implementation instead. (Or, if writing custom layers, subclass from tf.keras.layers rather than tf.layers)

diamondspark commented 5 years ago

Replace BertLayer(tf.layers.Layer) with BertLayer(tf.keras.layers.Layer)