How Do I Use TensorFlow 2.X in a Notebook Instance?
Notebook instances support TensorFlow 2.1. You can select Multi-Engine 2.0 (Python3) (containing the TensorFlow-2.1.0 engine) to create an instance.
For notebook instances created using other environments, such as Multi-Engine 1.0 (Python3, Recommended) or Multi-Engine 1.0 (Python2), if TensorFlow 2.X is required, perform the following steps:
Procedure
TensorFlow 2.0 can be installed and used in notebook instances. The procedure is as follows:
- Create a notebook instance, open and access the notebook instance, and select and access the kernel of TensorFlow 1.13.1.
- Go to the Kernel page and install TensorFlow 2.0 (GPU version). Enter the following code and click Run above the code.
1
!pip install tensorflow-gpu==2.0.0b1
Figure 1 Installing TensorFlow 2.0
- Restart the kernel for the update to take effect.
Figure 2 Restarting the kernel
- After the kernel is restarted, enter the following code to check the installation result. Then, you can use TensorFlow 2.0.
Run the following code. If 2.0.0-beta1 is displayed, TensorFlow 2.0 is installed.
1 2
import tensorflow as tf print(tf.__version__)
Run the following code. If True is displayed, the GPU version is installed.
1
print(tf.test.is_gpu_available())
Figure 3 Verifying the installed version
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.