Saving and loading BERT model in R

Viewed 104

I used this tutorial to partially train a model (pretrained BERT) on some text data. Except from data, all other code is the same.

I have problems saving and loading the trained model. If I use the following code:

save_model_hdf5(model, "model.h5")
model2 <- load_model_hdf5("model.h5")

I get this error:

Error in py_call_impl(callable, dots$args, dots$keywords) : 
  ValueError: Unknown layer: TokenEmbedding 

How can I succesfully save and load the model?

0 Answers
Related