Use a GPU - Google Colab
colab.research.google.com › en › guideThe second method is to configure a virtual GPU device with tf.config.set_logical_device_configuration and set a hard limit on the total memory to allocate on the GPU. [ ] ↳ 0 cells hidden. [ ] gpus = tf.config.list_physical_devices ('GPU') if gpus: # Restrict TensorFlow to only allocate 1GB of memory on the first GPU.