Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building ML Models with TensorFlow on GCP

Building ML Models with TensorFlow on GCP

For attendees of Cloud study Jam of GDG Ebolowa, in this presentation, we walk through the process of building a complete machine learning pipeline covering ingest, exploration, training, evaluation, deployment, and prediction.

Yannick Serge Obam

March 31, 2019
Tweet

More Decks by Yannick Serge Obam

Other Decks in Programming

Transcript

  1. Yannick Serge Obam • Co- founder IsoMora • Teacher •

    AI/ML Evangelist • Organiser GDG Ebolowa
  2. 1- Machine Learning with Tensorflow …………………………………………………………………………. 2- Machine Learning on

    Google Cloud ………………………………………………………………………... 3- What’s next ………………………………………………………………………. AGENDA
  3. AI Make machines solve problems commonly associated with human intelligence

    ML Make machines learn from experience instead of explicit programming DL Machine Learning using deep neural networks
  4. Activity Detection if(speed<4){ status=WALKING; } if(speed<4){ status=WALKING; } else {

    status=RUNNING; } if(speed<4){ status=WALKING; } else if(speed<12){ status=RUNNING; } else { status=BIKING; } // Oh crap
  5. Activity Detection 0101001010100101010 1001010101001011101 0100101010010101001 0101001010100101010 Label = WALKING 1010100101001010101

    0101010010010010001 0010011111010101111 1010100100111101011 Label = RUNNING 1001010011111010101 1101010111010101110 1010101111010101011 1111110001111010101 Label = BIKING 1111111111010011101 0011111010111110101 0101110101010101110 1010101010100111110 Label = GOLFING (Sort of)
  6. Experiment with wide-n-deep Wide Models Deep Models Wide & Deep

    Models Sigmoid Rectified Linear Units Output Hidden Layers Dense Embeddings Sparse Features
  7. 2.b Compute loss Weights Training data 1. Read, decompress, parse,

    perform data augmentation, batch 3. Update weights (2.a) Compute forward pass (2.c) Compute backward pass The ML training loop
  8. Experiment with Keras Model import tensorflow as tf mnist =

    tf.keras.datasets.mnist (x_train, y_train),(x_test, y_test) = mnist.load_data() x_train, x_test = x_train / 255.0, x_test / 255.0 model = tf.keras.model.Sequential([ tf.keras.layers.Flatten(input_shape=(28, 28)), tf.keras.layers.Dense(512, activation=tf.nn.relu), tf.keras.layers.Dropout(0.2), tf.keras.layers.Dense(10,activation= tf.nn.softmax), ]) model.compile(loss='categorical_crossentropy', optimizer=‘adam', metrics=['accuracy']) model.fit(x_train, y_train, epochs=5) model.evaluate(x_test, y_test)
  9. Hyperparameter Optimization Tuner Trainer learning_rate: 0.01, dropout_rate: 0.9 Train Validation

    Accuracy: 0.5 Existing systems/services: Spearmint, HyperOpt, Google HyperTune (May learn from feedback)
  10. Data Collection and Storage - Data generation at scale -

    Storage based on datatypes Storage BigQuery Pub-Sub Functions
  11. KubeFlow - The complete stack! - Jupyter Notebooks - Training

    and Serving - Packaging TFX - tf.Transform - tf.DataValidation - TF Serving - TF Model Analysis No-Cloud? Multi-Cloud?
  12. 180 teraflops per device / 64 GB high-bandwidth memory Programmed

    via TensorFlow Now available in beta at cloud.google.com/tpu Cloud TPU
  13. … at scale ResNet-50 on Cloud TPU v2 Pod Real

    data: 219,000+ images/sec Final accuracy: 93% excluding startup overhead Training time: (90 epochs) 8m 45s
  14. Ressources youtube.com/tensorflow twitter.com/tensorflow medium.com/tensorflow End-to-end Machine Learning with Tensorflow on

    GCP @Vikram_Tiwari Slide https://www.coursera.org/learn/end-to-end-ml-tensorflow-gcp