0
$\begingroup$

Hello data scientists (I'm not), I adapted a multi-class-text-classification-cnn from https://github.com/jiegzhan/multi-class-text-classification-cnn (thanks Jie Zhang) It works ! 90% accuracy ! Now my issue ;-) I really need to load my model with java in order to allow my existing java service to predict categories. According to documentations, I need to use SavedModelBuilder which is the new way of modele saving. I tried for hours but I misse a lot of things... About signature, assets. If someone could help me with that ? => replace the old saver.save by tf.saved_model.builder.SavedModelBuilder into https://github.com/jiegzhan/multi-class-text-classification-cnn/blob/master/train.py He or she will have my infinite gratitude

$\endgroup$
1
$\begingroup$

train.py code:

builder = tf.saved_model.builder.SavedModelBuilder("/home/datam/cnn-text-classification-tf/model/20180423")
builder.add_meta_graph_and_variables(
    sess,
    [tf.saved_model.tag_constants.SERVING],
    clear_devices=True
)
builder.save()

Java Coding:

SavedModelBundle model = SavedModelBundle.load(SAVED_MODEL_PATH+"/20180423", "serve");
Session s = model.session();
Graph g = model.graph();
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.