Coder Social home page Coder Social logo

github30 / adanet-ml-engine Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sararob/adanet-ml-engine

1.0 2.0 0.0 9 KB

Training an AdaNet AutoEnsembleEstimator on Cloud ML Engine. Blog post coming soon!

License: Apache License 2.0

Python 100.00%

adanet-ml-engine's Introduction

This is not a Google product.

Training AdaNet models on Cloud ML Engine

This is the code accompanying this blog post showing how to build an AdaNet model with AutoEnsembleEstimator and TF Hub, and train it on Cloud ML Engine.

See the blog post for details, and follow along below for a quick guide on how to train on ML Engine.

Prerequisits: Setting up your Cloud project

For this to work you'll need to create an account and project on Google Cloud Platform, and enable billing, and the necessary APIs. Steps 1-4 on this quickstart explain how to do that.

Install gcloud CLI

You'll use gcloud to kick off and manage training jobs for your model. If you don't have it, install it here.

Create a Cloud Storage bucket

You'll use this to store all of the checkpoints for your model along with the final model export. Follow this guide to create one.

Running a training job on Cloud ML Engine

Time to start your training. Open your terminal and make sure gcloud is set to the project you created for this tutorial: gcloud config set project your-project-name.

Define the following environment variables:

export JOB_ID=unique_job_name
export JOB_DIR=gs://your/gcs/bucket/path
export PACKAGE_PATH=trainer/
export MODULE=trainer.model
export REGION=your_cloud_project_region

From the root directory of this repo, run the following command:

gcloud ml-engine jobs submit training $JOB_ID --package-path trainer/ --module-name trainer.author --job-dir $JOB_DIR --region $REGION --runtime-version "1.12" --python-version 3.5 --config config.yaml

Navigate to the ML Engine UI in your cloud console to monitor the progress of your job.

Visualizing training progress with TensorBoard

You can also visualize metrics for your training job with TensorBoard. If you've got TensorFlow installed locally, it already comes with TensorBoard. Run the following command to start up TensorBoard:

tensorboard --logdir=$JOB_DIR

To start it, navigate to localhost:6006 in your browser.

Making a local prediction on your trained model

Once you've trained your model, it'll export the latest checkpoint to the Cloud Storage bucket path you specified. To quickly test out your model for prediction, you can use the local predict method via gcloud. Just create a newline delimited JSON file with your test instances in the format your model is expecting. An example file for this model is in trainer/test-instances.json. Then run:

gcloud ml-engine local predict --model-dir=gs://path/to/saved_model.pb --json-instances=path/to/test.json

adanet-ml-engine's People

Contributors

sararob avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.