Skip to content

Instantly share code, notes, and snippets.

@Mistobaan
Created May 11, 2020 06:04
Show Gist options
  • Save Mistobaan/cc85464a1d32742581d97ba215f150e5 to your computer and use it in GitHub Desktop.
Save Mistobaan/cc85464a1d32742581d97ba215f150e5 to your computer and use it in GitHub Desktop.
TPU tricks
from google.cloud import storage
from tensorflow import MetaGraphDef
client = storage.Client()
bucket = client.get_bucket(Config.MODEL_BUCKET)
blob = bucket.get_blob('model.ckpt.meta')
model_graph = blob.download_as_string()
mgd = MetaGraphDef()
mgd.ParseFromString(model_graph)
with tf.Session() as sess:
saver = tf.train.import_meta_graph(mgd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment