You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ValueError: A KerasTensor is symbolic: it's a placeholder for a shape an a dtype. It doesn't have any actual numerical value. You cannot convert it to a NumPy array.
#1401
Open
accioharshita opened this issue
Mar 26, 2024
· 4 comments
Hey, so I've downloaded the preprocessing & encoder layer of BERT in order to build a simple email classification model. When I'm finally building my model to pass the training data it throws this error. Can someone tell me what's wrong?
The text was updated successfully, but these errors were encountered:
@accioharshita Hi, I was having the same problem. In fact, I was using the exact same code as you. I managed to solve my problem by importing Bert through the keras_nlp library. Here is the code I ended up with:
@SoumyaCodes2020 can you please let me know how you saved model with this approach. I'm using this approach model3.save("model3.keras")
model3 = keras.models.load_model("model3.keras") but getting error
No vocabulary has been set for WordPieceTokenizer. Make sure to pass a `vocabulary` argument when creating the layer.
@SoumyaCodes2020 how many trainable params do you have in the model if you use that approach (when you call model.summary())? It seems that this approach leads to the Bert layer parameters being trainable (even if trainable=False).
EDIT: I solved the problem by looping through all layers in the encoder and setting the layers as non-trainable: for layer in encoder.layers: layer.trainable = False
Hey, so I've downloaded the preprocessing & encoder layer of BERT in order to build a simple email classification model. When I'm finally building my model to pass the training data it throws this error. Can someone tell me what's wrong?
The text was updated successfully, but these errors were encountered: