1 of 20

INTRODUCCIÓN A TENSORFLOW 2.0

jobs@santexgroup.com

Cristian Cardellino - FAMAFyC

2 of 20

CREDITS

The material for this meetup is heavily based on the amazing work by François Chollet in his TensorFlow 2.0 + Keras Crash Course.

3 of 20

CONTENIDOS

TensorFlow y Keras

Instalación de TF 2.0

Google Colab

TF 2.0 en Google Colab

01

02

03

04

4 of 20

DISCLAIMER

Este no es un curso de introducción a redes neuronales ni aprendizaje automático.

Se espera que tengan una idea general de estos temas para poder entender el contenido.

5 of 20

TENSORFLOW Y KERAS

6 of 20

¿QUÉ ES TENSORFLOW?

FRAMEWORK GENERAL PARA TAREAS DE

APRENDIZAJE AUTOMÁTICO

  • Pone el foco en el deep learning.
  • Tiene varios niveles de abstracción.
  • Originalmente basado en computación de grafos.
  • Muy eficiente. Pensado para ambientes de producción.
  • Tiene APIs para Python, C++, JavaScript, Java, Go, etc.
  • Developed by Google.

7 of 20

¿QUÉ ES KERAS?

  • Facilita el proceso de crear (y entrenar) redes neuronales.
  • Muy sencillo de llevar a ambientes de producción.
  • Tiene muchos tipos de redes neuronales implementadas.
  • Muy poderoso y eficiente a pesar de su facilidad.

FRAMEWORK PARA DEEP LEARNING DE

ALTO NIVEL

8 of 20

¿QUÉ TRAE TENSORFLOW 2.0?

TENSORFLOW CON COMPUTACIÓN EAGER

  • Una de las grandes críticas a TF 1.x era su curva de aprendizaje.
  • La herramienta es muy flexible y eficiente, pero pensar en computación de grafos se vuelve pesado.
  • Keras es difícil de modificar a nivel más granular.
  • TF 2.0 viene a brindar una interfaz intermedia entre el bajo nivel de TF 1.x y Keras, intentando no perder la flexibilidad ni la eficiencia.

9 of 20

INSTALACIÓN DE TF 2.0

10 of 20

INSTALACIÓN DE TENSORFLOW 2.0

$ virtualenv --python python3 tf-env # or conda

$ source ./tf-env/bin/activate

(tf-env) $ pip install --upgrade pip

(tf-env) $ pip install tensorflow==2.0 # or version

(tf-env) $ python

>>> import tensorflow as tf

>>> print(tf.__version__) # check it is working

2.0.0

INSTALACIÓN LOCAL DE TENSORFLOW (PIP)

11 of 20

INSTALACIÓN DE TENSORFLOW 2.0

# Only TF 2.0

$ docker pull tensorflow/tensorflow:2.0.0-py3

$ docker run -it tensorflow/tensorflow:2.0.0 bash # run python

# With jupyter support

$ docker pull tensorflow/tensorflow:2.0.0-py3-jupyter

$ docker run -it -p 8888:8888 tensorflow/tensorflow:2.0.0-py3-jupyter

INSTALACIÓN LOCAL DE TENSORFLOW (DOCKER)

12 of 20

INSTALACIÓN DE TENSORFLOW 2.0

INSTALACIÓN LOCAL DE TENSORFLOW (GPU)

  • Para utilizar GPUs (casi mandatorio trabajando con redes neuronales), se requiere hardware específico y ciertas configuraciones.
  • La instalación luego de eso es casi la misma.
  • Para Docker se necesita NVIDIA Docker.
  • Es importante tener correctamente definida la variable de entorno LD_LIBRARY_PATH para linux y la variable PATH para Windows (no hay soporte GPU para Apple)

13 of 20

GOOGLE COLAB

14 of 20

¿QUÉ ES GOOGLE COLAB?

  • Google Colaboratory es un entorno web basado en Jupyter que permite ejecutar código en la nube.
  • Viene con instalación por defecto de muchas librerías de Python para aprendizaje automático y ciencia de datos.
  • Ofrece herramientas para poder utilizar GPUs y TPUs directamente en la web gratis!
  • Es excelente para probar cosas rápidas que no requieran mucha configuración.

NOTEBOOKS DE JUPYTER SIN INSTALACIÓN

15 of 20

TF 2.0 EN GOOGLE COLAB

16 of 20

TENSORFLOW 2.0 EN GOOGLE COLAB

EJECUCIÓN DEL GOOGLE COLAB

  • Utilizaré Google Colab para aprender y experimentar con TensorFlow 2.0 y Keras.
  • En este link continua el resto de esta charla.
  • Hay que seguir las instrucciones del notebook para configurar TF 2.0 con un GPU.

17 of 20

¡MUCHAS GRACIAS!

18 of 20

CONTACTO

EMAIL

ccardellino@unc.edu.ar

WEBSITE

https://crscardellino.github.io

TWITTER

@crscardellino

MEDIUM

https://medium.com/@crscardellino/

19 of 20

SLIDES

  • Presentation template by Slidesgo
  • Icons by Flaticon
  • Infographics by Freepik
  • Author introduction slide photo created by Freepik
  • Text & Image slide photo created by Freepik.com

20 of 20