google-research / bert

TensorFlow code and pre-trained models for BERT
https://arxiv.org/abs/1810.04805
Apache License 2.0
38.23k stars 9.62k forks source link

How can I use the model in my own computer? #1284

Closed pppppkun closed 2 years ago

pppppkun commented 2 years ago

I have trained a bert model in my colab using TPU and saved the checkpoint (.ckpt.meta and .ckpt.data), how can I use it on my own computer to predict?

I have tried to use tf.train.import_meta_graph to load .ckpt.meta but it report that

tensorflow.python.framework.errors_impl.InvalidArgumentError: No OpKernel was registered to support Op 'TPUReplicatedInput' used by {{node input0}}with these attrs: [T=DT_INT32, N=8]

Maybe it is caused by the trained process which uses TPU? Should I try to use model.save() to save the model as .h5 format to use it?