Setting up Google Cloud - Tensorflow Estimator
YOU MUST FOLLOW OFFICIAL directions ---this webpage to show you the idea---but, the
exact steps and proceedures can change and the process is owned by Google.
https://cloud.google.com/ml-engine/docs/tensorflow/getting-started-training-prediction
ASSUMES: you have google cloud account and have setup your credits (given to you in this class)
STEP 1: In dashboard for console.google.cloud you create a project AND enable theAI Platform ("Cloud Machine Learning Engine") and Compute Engine API
Follow the remaining instructions at https://cloud.google.com/ml-engine/docs/tensorflow/getting-started-training-prediction to activate google cloud shell inside of google console.
Configure the shell to associate with your project
MAKE sure that the cloudshell has SAME version of tensorflow as your model you will deploy (e.g. below doing tensorflow 2.0)
pip install --user tensorflow==2.0
STEP 2: Convert your .h5 model file to a SavedModel (if you have not already)
# Save the entire model as a SavedModel. saved_model_dir = os.path.join(BASE_DIRECTORY, 'saved_model\catsdogsCNN') !mkdir -p saved_model_dir model.save(saved_model_dir) |
>>> Optional : the following shows how to load a model from the SavedModel
STEP 3: Install and initialize the Google Cloud SDK if you have not
STEP 4:Follow instructions to create a S3 bucket (google's file storage cloud
service)
to save your SavedModel & upload it
STEP 5: Follow instructions OR these more specific instructions to Deploy your saved Model into your Google Cloud Project
STEP 6: Follow instructions to use your deployed model for prediction