Paddlepaddle (v0.10.0) source mode installation

Source: Internet
Author: User
Tags install go tar xz jupyter jupyter notebook
This is a creation in Article, where the information may have evolved or changed.

0. Preface

Paddlepaddle, Baidu's deep learning open source platform.
September 27, 2016, Baidu announced its new deep learning open-source platform Paddlepaddle in the open source community GitHub and Baidu Brain platform open for the vast number of developers to download and use. Baidu has become the first technology giant to open up artificial intelligence technology to Google, Facebook and IBM, and is also the country's leading technology company to open-source deep learning platforms.

---from Baidu Encyclopedia: Paddlepaddle
Here are two useful URLs:
Paddlepaddle official website
Baidu Technical College-paddlepaddle deep Learning Practical Course
After watching the first three videos of the actual combat course, feel good, at the same time, the official only to provide Docker installation mode, so the study, with this source way to install the way.
See "Paddlepaddle Deep Learning actual combat course" words are recommended with Google Chrome, because URL compatibility issues, other browsers may not be able to play the full screen sound.

On GitHub's words, here are two things to look at:
Paddlepaddle/book
Paddlepaddle/paddle

    • Paddlepaddle/book: This is an offline tutorial, try to download it yourself, the lack of Jupyter notebook source files (. ipynb), only the generated files, so notebook interactive files, download the Docker version, all the files are alive.

    • Paddlepaddle/paddle: This is the source code, download the time remember to use Git clone, do not directly download zip compressed files, because when the dependency is satisfied, compile the need to get the version number from Git.

From my Docker installation, I found that the environment running paddle was a Linux distribution called Moby, and then learned:



Photo from: How to evaluate Baidu just open source paddle platform?
From the table, the difficulty is moderate, and a lot of Chinese documents, as well as video tutorials, tried before into the pit TensorFlow, the amount, I did not go to school, the pit is still submerged, looked at the video tutorial title, I want something, use it, happy decision.

After the installation of the source code, I would like to say very very time-consuming, mainly various walls (the celestial is strong, and so on to my everlasting), in fact, ready-made tutorials in the paddle project, there is a dockerfile



Although this is the installation script that installs paddle for Moby inside Docker, but Linux, it can also be used

Note that the kernel version is not too high, I am in Deepin15.4.1 (kernel version 4.9), in the Make source error (that is, report error warning, can not continue compiling), and finally went to Ubuntu under the test to succeed.

The approximate process is as follows: Meeting environmental->cmke->make->make Install->
Pip Install/usr/local/opt/paddle/share/wheels/*.whl->paddle version

1. System environment

System: Ubuntu16.04.2lts
Python version: 2.7
Paddle version: v0.10.0

2. Meet the Environment

How to use Docker containers in paddlepaddle--developing images
Official note: The development image contains the following tools:

    • Gcc/clang-------------Compiled
    • NVCC-------------Cuda, no GPU can be installed
    • Python
    • Sphinx
    • Woboq-------------refers to the Woboq_codebrowser under the Woboq.
    • The sshd-------------is understood in the documentation, as it is used by SSH to access Docker

The following content is from the source of Dockerfile
The following actions are performed under the root user

2.1 Installing the software from the source

    apt-get update && \    apt-get install -y \    git python-pip python-dev openssh-server bison  \    wget unzip unrar tar xz-utils bzip2 gzip coreutils ntp \    curl sed grep graphviz libjpeg-dev zlib1g-dev  \    python-numpy python-matplotlib gcc g++ \    automake locales clang-format-3.8 swig doxygen cmake  \    liblapack-dev liblapacke-dev libboost-dev \    clang-3.8 llvm-3.8 libclang-3.8-dev \    net-tools && \    apt-get clean -y

You can see that you need the PIP Package Manager to install the Python environment, OpenSSH remote, python-numpy Some scientific computing libraries, clang-3.8 llvm-3.8 Libclang-3.8-dev These are Golang compiler tools, because there is a go folder in the source code to put the go language. Without the go compiler, I tried to give an error, but that was before I found Dockerfile.

2.2 Install Go

wget -O go.tgz https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gztar -C /usr/local -xzf go.tgzmkdir /root/gopathmkdir /root/gopath/binmkdir /root/gopath/src

In/etc/profile, add the environment variable:

export GOROOT=/usr/local/goexport GOPATH=/root/gopathPATH=${PATH}:${GOROOT}/bin:${GOPATH}/bin


Above is the environment variable to install go and configure go

2.3 Installing Glide

curl -q https://glide.sh/get | sh

↑ installation of Glide. Actually very slow, I installed directly from the source warehouse:

apt-get install libglide3

2.4 Execute some commands

git config --global credential.helper store

↑ This is a command to automatically save a git user name and password

localedef -i en_US -f UTF-8 en_US.UTF-8
apt-get install -y libssl-dev libffi-devpip install certifi urllib3[secure]

2.5PIP installation Software

    pip install --upgrade pip && \    pip install -U 'protobuf==3.1.0' && \    pip install -U wheel pillow BeautifulSoup && \    pip install -U docopt PyYAML sphinx && \    pip install -U sphinx-rtd-theme==0.1.9 recommonmark && \    pip install pre-commit 'requests==2.9.2' 'ipython==5.3.0' && \    pip install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \    pip install rarfile

First update the PIP local cache, and then install the software, the inside of the Protobuf no this is compiled does not pass, there are some jupyter notebook things

2.3 Installing Woboq_codebrowser to/woboq

git clone https://github.com/woboq/woboq_codebrowser /woboqcd /woboqcmake -DLLVM_CONFIG_EXECUTABLE=/usr/bin/llvm-config-3.8 \           -DCMAKE_BUILD_TYPE=Release .make

The WOBOQ here is the directory under the root directory, because the/start path.

3, CMake

At the paddle root directory:

cmake -DWITH_GPU=OFF -DWITH_AVX=ON -WITH_DOC=OFF

4. Make

At the paddle root directory:

make

5. Make install

At the paddle root directory:

make install

Make installs the general is uses the command to use, but still is the error, we can see some. WHL end of the file, which is the PIP Package Manager things, we have not installed these packages, so the installation is good, the wrong time I did not, so will be the text description it.

6. PIP installs the Python package generated by paddle

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple /usr/local/opt/paddle/share/wheels/*.whl

This adds a parameter option for adding a source.
In fact, there is a trace to this command:



At the end of Dockerfile know this file path, locate this file, open:



See the installation of the command, and to match the error, run this clearly sure enough, OK.

7. Paddle version

Run paddle version directly to see the information and the switching of some features:

paddle version


Environment installation is complete!

8. Testing

Under the ordinary User:

jupyter notebook


In the process of installing the software earlier, we have jupyter notebook Direct input command, the browser will pop up the window, then create a python file, run



Code provenance https://github.com/PaddlePaddle/book/blob/develop/01.fit_a_line/train.py
Paste in the following code:

Import Paddle.v2 as Paddleimport paddle.v2.dataset.uci_housing as Uci_housingdef main (): # init Paddle.init (use_gpu=    False, trainer_count=1) # Network config x = paddle.layer.data (name= ' x ', Type=paddle.data_type.dense_vector (13)) Y_predict = PADDLE.LAYER.FC (input=x, size=1, Act=paddle.activation.linear ()) y = paddle.layer.data (name= ' y ', type=padd Le.data_type.dense_vector (1)) cost = Paddle.layer.mse_cost (Input=y_predict, label=y) # Create Parameters Paramete rs = Paddle.parameters.create (cost) # Create Optimizer optimizer = Paddle.optimizer.Momentum (momentum=0) trainer    = Paddle.trainer.SGD (Cost=cost, parameters=parameters, update_equation=optimizer) feeding = {' X ': 0, ' y ': 1} # Event_handler to print training and testing Info def event_handler (event): If Isinstance (event, Paddle.event.                    Enditeration): if event.batch_id% = = 0:print "Pass%d, batch%d, cost%f"% ( EVENT.PASS_ID, Eve.nt.batch_id, Event.cost) if Isinstance (event, paddle.event.EndPass): result = Trainer.test ( Reader=paddle.batch (Uci_housing.test (), batch_size=2), feeding=feeding) print "Test%d, cost %f "% (event.pass_id, result.cost) # Training Trainer.train (Reader=paddle.batch (paddle.reader.sh Uffle (Uci_housing.train (), buf_size=500), batch_size=2), feeding=feeding, Event_handler=event_han Dler, num_passes=30) if __name__ = = ' __main__ ': Main ()


The end of the tutorial, the last nagging, unless very free, or it is very slow, it is recommended to use Docker, I have a desktop in the home is the result of downloading Docker does not support virtualization technology, I just so toss, Docker this way is also good, at least not to waste so much time, Look over and over again if not, Paddlepaddle Docker container usage, which has already taught the integration of the image of the download steps and image building steps , in fact, this thing is from the inside of the automatic image of the script to do it manually.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.