universal-sentence-encoder-fine-tune icon indicating copy to clipboard operation
universal-sentence-encoder-fine-tune copied to clipboard

Issue in loading the saved model in Java

Open alpsholic opened this issue 4 years ago • 0 comments

I saved the trained model as follows (similar to how u do in convert_use.py)

tf.saved_model.simple_save(sess, save_path, inputs={'input':in_tensor}, outputs={'output':ou_tensor},legacy_init_op=tf.tables_initializer())

But when I load the resulting model in Java, I get the following exception. Can you please help?

W tensorflow/core/framework/op_kernel.cc:1318] OP_REQUIRES failed at lookup_table_op.cc:675 : Failed precondition: Table not initialized.
Exception in thread "main" java.lang.IllegalStateException: Table not initialized.
	 [[Node: finetune/module/string_to_index_Lookup/hash_table_Lookup = LookupTableFindV2[Tin=DT_STRING, Tout=DT_INT64, _output_shapes=[<unknown>], _device="/job:localhost/replica:0/task:0/device:CPU:0"](finetune/module/string_to_index/hash_table, finetune/module/compound_bigrams/boolean_mask/Gather, finetune/module/string_to_index/hash_table/Const)]]
	at org.tensorflow.Session.run(Native Method)

alpsholic avatar Apr 08 '20 02:04 alpsholic