Skip to content

Instantly share code, notes, and snippets.

@morenoh149
Last active August 6, 2018 01:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morenoh149/8bc94ee73b848592a916e030b8c3ae7c to your computer and use it in GitHub Desktop.
Save morenoh149/8bc94ee73b848592a916e030b8c3ae7c to your computer and use it in GitHub Desktop.
import tensorflow as tf
from keras import backend as K
from tensorflow.python.saved_model import builder as saved_model_builder
from tensorflow.python.saved_model import tag_constants, signature_constants
from tensorflow.python.saved_model.signature_def_utils_impl import predict_signature_def
builder = saved_model_builder.SavedModelBuilder('vgg16_no_augmentation_export')
signature = predict_signature_def(inputs={'input': parallel_model.inputs[0]},
outputs={'income': parallel_model.outputs[0]})
with K.get_session() as sess:
builder.add_meta_graph_and_variables(
sess=sess,
tags=[tag_constants.SERVING],
signature_def_map={
signature_constants.DEFAULT_SERVING_SIGNATURE_DEF_KEY: signature}
)
builder.save()
attempting to create this model
$ gcloud ml-engine versions create v2 --model=plantDisease01 --origin=gs://${BUCKET_NAME}/plantDisease01 --runtime-version=1.4
Creating version (this might take a few minutes)......failed.
ERROR: (gcloud.ml-engine.versions.create) Bad model detected with error: "Failed to load model: Loading servable: {name: default version: 1} failed: Not found: Op type not registered 'ClipByValue' in binary running on localhost. Make sure the Op and Kernel are registered
in the binary running in this process.\n\n (Error code: 0)"
INFO:tensorflow:No assets to save.
INFO:tensorflow:No assets to write.
INFO:tensorflow:SavedModel written to: b'vgg16_no_augmentation_export/saved_model.pb'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment