Created
August 14, 2019 21:17
-
-
Save zmjjmz/1ec864404e4fed80e5ccf52c7589ea30 to your computer and use it in GitHub Desktop.
Vespa Keras tf experiment export_saved_model issues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{'error-code': 'INVALID_APPLICATION_PACKAGE', | |
'message': 'Invalid application package: default.default: Error loading ' | |
'model: Could not import TensorFlow model from directory ' | |
"'/opt/vespa/var/db/vespa/config_server/serverdb/tenants/default/sessions/175/.preprocessed/models/plike_test/tf114_export': " | |
"_output_shapes attribute of 'init_1' does not exist"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{'error-code': 'INVALID_APPLICATION_PACKAGE', | |
'message': 'Invalid application package: default.default: Error loading ' | |
'model: Could not import TensorFlow model from directory ' | |
"'/opt/vespa/var/db/vespa/config_server/serverdb/tenants/default/sessions/187/.preprocessed/models/plike_test/tf114_export_servonly': " | |
"NodeDef mentions attr 'config_proto' not in " | |
'Op<name=StatefulPartitionedCall; signature=args: -> output:; ' | |
'attr=Tin:list(type),min=0; attr=Tout:list(type),min=0; ' | |
'attr=f:func; is_stateful=true>; NodeDef: {{node ' | |
'StatefulPartitionedCall_2}} = ' | |
'StatefulPartitionedCall[Tin=[DT_STRING, DT_RESOURCE, DT_RESOURCE, ' | |
'DT_RESOURCE, DT_RESOURCE, DT_RESOURCE, DT_RESOURCE, DT_RESOURCE, ' | |
'DT_RESOURCE, DT_RESOURCE, DT_RESOURCE, DT_RESOURCE, DT_RESOURCE, ' | |
'DT_RESOURCE], Tout=[DT_STRING], ' | |
'_gradient_op_type="PartitionedCall-445", _output_shapes=[[]], ' | |
'config_proto="\\n\\007\\n\\003GPU\\020\\000\\n\\007\\n\\003CPU\\020\\0012\\002J\\0008\\001", ' | |
'f=__inference__traced_restore_444[], ' | |
'_device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_saver_filename_0_0, ' | |
'layer_1/kernel, layer_1/bias, output/kernel, output/bias, ' | |
'RMSprop/iter, RMSprop/decay, RMSprop/learning_rate, ' | |
'RMSprop/momentum, RMSprop/rho, RMSprop/layer_1/kernel/rms, ' | |
'RMSprop/layer_1/bias/rms, RMSprop/output/kernel/rms, ' | |
'RMSprop/output/bias/rms). (Check whether your ' | |
'GraphDef-interpreting binary is up to date with your ' | |
'GraphDef-generating binary.).\n' | |
'\t [[{{node StatefulPartitionedCall_2}} = ' | |
'StatefulPartitionedCall[Tin=[DT_STRING, DT_RESOURCE, DT_RESOURCE, ' | |
'DT_RESOURCE, DT_RESOURCE, DT_RESOURCE, DT_RESOURCE, DT_RESOURCE, ' | |
'DT_RESOURCE, DT_RESOURCE, DT_RESOURCE, DT_RESOURCE, DT_RESOURCE, ' | |
'DT_RESOURCE], Tout=[DT_STRING], ' | |
'_gradient_op_type="PartitionedCall-445", _output_shapes=[[]], ' | |
'config_proto="\\n\\007\\n\\003GPU\\020\\000\\n\\007\\n\\003CPU\\020\\0012\\002J\\0008\\001", ' | |
'f=__inference__traced_restore_444[], ' | |
'_device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_saver_filename_0_0, ' | |
'layer_1/kernel, layer_1/bias, output/kernel, output/bias, ' | |
'RMSprop/iter, RMSprop/decay, RMSprop/learning_rate, ' | |
'RMSprop/momentum, RMSprop/rho, RMSprop/layer_1/kernel/rms, ' | |
'RMSprop/layer_1/bias/rms, RMSprop/output/kernel/rms, ' | |
'RMSprop/output/bias/rms)]]'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ saved_model_cli show --dir tf114_export_servonly --all | |
MetaGraphDef with tag-set: 'serve' contains the following SignatureDefs: | |
signature_def['__saved_model_init_op']: | |
The given SavedModel SignatureDef contains the following input(s): | |
The given SavedModel SignatureDef contains the following output(s): | |
outputs['__saved_model_init_op'] tensor_info: | |
dtype: DT_INVALID | |
shape: unknown_rank | |
name: NoOp | |
Method name is: | |
signature_def['serving_default']: | |
The given SavedModel SignatureDef contains the following input(s): | |
inputs['input'] tensor_info: | |
dtype: DT_FLOAT | |
shape: (-1, 1) | |
name: serving_default_input:0 | |
The given SavedModel SignatureDef contains the following output(s): | |
outputs['output'] tensor_info: | |
dtype: DT_FLOAT | |
shape: (-1, 1) | |
name: StatefulPartitionedCall:0 | |
Method name is: tensorflow/serving/predict |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# note: set serving_only=False (which is the default) and it will export a lot of tag sets other than serve. | |
MetaGraphDef with tag-set: 'eval' contains the following SignatureDefs: | |
signature_def['__saved_model_init_op']: | |
The given SavedModel SignatureDef contains the following input(s): | |
The given SavedModel SignatureDef contains the following output(s): | |
outputs['__saved_model_init_op'] tensor_info: | |
dtype: DT_INVALID | |
shape: unknown_rank | |
name: init_1 | |
Method name is: | |
signature_def['eval']: | |
The given SavedModel SignatureDef contains the following input(s): | |
inputs['input'] tensor_info: | |
dtype: DT_FLOAT | |
shape: (-1, 1) | |
name: input:0 | |
inputs['output_target'] tensor_info: | |
dtype: DT_FLOAT | |
shape: (-1, -1) | |
name: output_target:0 | |
The given SavedModel SignatureDef contains the following output(s): | |
outputs['loss'] tensor_info: | |
dtype: DT_FLOAT | |
shape: () | |
name: loss/mul:0 | |
outputs['predictions/output'] tensor_info: | |
dtype: DT_FLOAT | |
shape: (-1, 1) | |
name: output/BiasAdd:0 | |
Method name is: tensorflow/supervised/eval | |
MetaGraphDef with tag-set: 'serve' contains the following SignatureDefs: | |
signature_def['__saved_model_init_op']: | |
The given SavedModel SignatureDef contains the following input(s): | |
The given SavedModel SignatureDef contains the following output(s): | |
outputs['__saved_model_init_op'] tensor_info: | |
dtype: DT_INVALID | |
shape: unknown_rank | |
name: init_1 | |
Method name is: | |
signature_def['serving_default']: | |
The given SavedModel SignatureDef contains the following input(s): | |
inputs['input'] tensor_info: | |
dtype: DT_FLOAT | |
shape: (-1, 1) | |
name: input:0 | |
The given SavedModel SignatureDef contains the following output(s): | |
outputs['output'] tensor_info: | |
dtype: DT_FLOAT | |
shape: (-1, 1) | |
name: output/BiasAdd:0 | |
Method name is: tensorflow/serving/predict | |
MetaGraphDef with tag-set: 'train' contains the following SignatureDefs: | |
signature_def['__saved_model_init_op']: | |
The given SavedModel SignatureDef contains the following input(s): | |
The given SavedModel SignatureDef contains the following output(s): | |
outputs['__saved_model_init_op'] tensor_info: | |
dtype: DT_INVALID | |
shape: unknown_rank | |
name: init_1 | |
Method name is: | |
signature_def['__saved_model_train_op']: | |
The given SavedModel SignatureDef contains the following input(s): | |
The given SavedModel SignatureDef contains the following output(s): | |
outputs['__saved_model_train_op'] tensor_info: | |
dtype: DT_INVALID | |
shape: unknown_rank | |
name: training_1/group_deps | |
Method name is: | |
signature_def['train']: | |
The given SavedModel SignatureDef contains the following input(s): | |
inputs['input'] tensor_info: | |
dtype: DT_FLOAT | |
shape: (-1, 1) | |
name: input:0 | |
inputs['output_target'] tensor_info: | |
dtype: DT_FLOAT | |
shape: (-1, -1) | |
name: output_target:0 | |
The given SavedModel SignatureDef contains the following output(s): | |
outputs['loss'] tensor_info: | |
dtype: DT_FLOAT | |
shape: () | |
name: loss/mul:0 | |
outputs['predictions/output'] tensor_info: | |
dtype: DT_FLOAT | |
shape: (-1, 1) | |
name: output/BiasAdd:0 | |
Method name is: tensorflow/supervised/training |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
import numpy as np | |
input_l = tf.keras.Input(shape=(1,), name='input') | |
layer_1 = tf.keras.layers.Dense(1, activation='relu', name='layer_1')(input_l) | |
output_l = tf.keras.layers.Dense(1, activation='linear', name='output')(layer_1) | |
model = tf.keras.Model(inputs=[input_l], outputs=[output_l]) | |
model.compile(loss='mean_absolute_error', optimizer='rmsprop') | |
x = np.array(np.arange(1, 100000)) | |
y = np.array(np.arange(1, 100000)) | |
model.fit(np.array(x).reshape(-1),np.array(y), epochs=2, shuffle=False, batch_size=100) | |
print("TF Version: {0}".format(tf.VERSION)) # should be 1.14 | |
tf.keras.experimental.export_saved_model( | |
model, | |
'tf114_export_servonly', | |
serving_only=True | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment