delft icon indicating copy to clipboard operation
delft copied to clipboard

save a pretrained model as .pb

Open mvss80 opened this issue 7 years ago • 2 comments

Is there a way to export a trained model as .pb file that can be served with tensorflow serving?

mvss80 avatar Jan 25 '19 00:01 mvss80

hello @mvss80 ! Yes you can use for instance https://github.com/amir-abdi/keras_to_tensorflow which is exactly doing this with one command line.

kermitt2 avatar Jan 25 '19 01:01 kermitt2

@kermitt2 thanks for the quick response and pointing me to the utility.

For the ner pretrained models, I can find the .hdf5 file with the weights but cannot find the network architecture .json file or the complete model .h5 files. Could you please let me know how I can export the network architecture so I can then export them both?

EDIT: I exported the model architecture as a .json file and also tried saving the model using model.save() that puts architecture+weights in one file. In both cases, the keras_to_tensorflow utility fails because looks like it doesn't support custom layers.

mvss80 avatar Jan 25 '19 02:01 mvss80