How to Install Baidu PaddlePaddle Framework on Google Colab

Alifya Febriana
3 min readOct 19, 2021

--

PaddlePaddle Logo.

PaddlePaddle (PArallel Distributed Deep LEarning) is a machine learning framework for industrial or academic practices. PaddlePaddle is an easy-to-use, efficient, flexible, and scalable deep learning platform, which was originally developed by Baidu scientists and engineers for the purpose of applying deep learning to many products at Baidu such as NLP (Natural Language Processing), translation, and image processing. PaddlePaddle supports a wide range of neural network architectures and optimization algorithms. With PaddlePaddle, it is possible to leverage many CPUs/GPUs and machines to speed up training, achieving high throughput and performance via optimized communication.

Requirements for installing paddlepaddle:

  • python 3.x
  • You need to have an Nvidia graphics card that supports CUDA and install CUDA 10 correctly.
  • Ubuntu 14.04 supports CUDA 10.0/10.1
  • Ubuntu 16.04 supports CUDA 9.0/9.1/9.2/10.0/10.1
  • Ubuntu 18.04 supports CUDA 10.0/10.1
  • Need to use cuDNN 7.3+

Docker is recommended to run Paddleclas, for more detailed information about docker and Nvidia-docker, you can refer to the tutorial.

Oke, I will show you step-by-step install paddlepaddle on Colab.

Step 1: Make sure your runtime connects with GPU

You can see in Runtime-> Change runtime type-> Choose GPU-> Save

Set GPU in Colab.

Step 2: check if GPU is running or not and Check the Cuda version

!nvidia-smi

The output is:

Check the CUDA version.

As you can see, The Cuda version is 11.2 and then you can do the next step.

Step 3: Check the python version and location

!which python #view python location!python --version #view the python version

The output is:

/usr/local/bin/python Python 3.7.12

Okay, you have the python version is Python 3.7.12

Step 4: Check the pip version

!python -m pip — version

The output is:

pip 21.1.3 from /usr/local/lib/python3.7/dist-packages/pip (python 3.7)

Step 5: Confirm that Python and pip are 64 bit, and the processor architecture is x86_64 architecture.

!python -c “import platform;print(platform.architecture()[0]);print(platform.machine())”

The output is:

64bit x86_64

So far what we do is in accordance with the requirements, right? a little more finished, you can move on to the next step!

Step 6: Time to install paddlepaddle!

Previously, we have checked that our Cuda version is 11.2, if your Cuda version is different from mine, you can check the documentation here.

!python -m pip install paddlepaddle-gpu==2.1.3.post112 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html

If your Cuda version is different from mine, you can see like the picture below:

Choose your Cuda version like this:)

If you successfully installed paddlepaddle, The output is:

Successfully installed paddlepaddle on Google Colab.

Step 7: Verify and check your paddlepaddle version

!python3 -c “import paddle; print(paddle.__version__)”

At this point, you’re done, you can use paddlepaddle. Congrats!

References:

[1] NVIDIA Documentation

[2] PaddlePaddle Class

[3] PaddlePaddle Documentation

--

--

Alifya Febriana

I am in the process of practicing myself to be a good swimmer in the deep sea of deep learning.