diff --git a/README.en.md b/README.en.md index ad5b19abf35928a5e0d587d3e2b75558ba24cc1c..a7bd3b9dbf3f50cf58069232699e85dbf7856dd8 100644 --- a/README.en.md +++ b/README.en.md @@ -29,6 +29,33 @@ If you are living in somewhere slow to access DockerHub.com, you might try our m docker run -d -p 8888:8888 docker.paddlepaddle.org/book ``` +### Training with GPU + +By default we are using CPU for training, if you want to train with GPU, the steps are a little different. + +To make sure GPU can be successfully used from inside container, please install [nvidia-docker](https://github.com/NVIDIA/nvidia-docker). Then run: + +```bash +nvidia-docker run -d -p 8888:8888 paddlepaddle/book:0.10.0rc2-gpu +``` + +Or you can use the image registry mirror in China: + +```bash +nvidia-docker run -d -p 8888:8888 docker.paddlepaddle.org/book:0.10.0rc2-gpu +``` + +Change the code in the chapter that you are reading from +```python +paddle.init(use_gpu=False, trainer_count=1) +``` + +to: +```python +paddle.init(use_gpu=True, trainer_count=1) +``` + + ## Contribute Your contribution is welcome! Please feel free to file Pull Requests to add your chapter as a directory under `/pending`. Once it is going stable, the community would like to move it to `/`. diff --git a/README.md b/README.md index 94b98c6287b44c5c42b889fed5e3d45aa7372e7a..99cce7c0f373b5fa4a6a35d4041687a7a8606ab5 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,31 @@ docker run -d -p 8888:8888 paddlepaddle/book docker run -d -p 8888:8888 docker.paddlepaddle.org/book ``` +### 使用GPU训练 + +本书默认使用CPU训练,若是要使用GPU训练,使用步骤会稍有变化。为了保证GPU驱动能够在镜像里面正常运行,我们推荐使用[nvidia-docker](https://github.com/NVIDIA/nvidia-docker)来运行镜像。请先安装nvidia-docker,之后请运行: + +```bash +nvidia-docker run -d -p 8888:8888 paddlepaddle/book:0.10.0rc2-gpu +``` + +或者使用国内的镜像请运行: + +```bash +nvidia-docker run -d -p 8888:8888 docker.paddlepaddle.org/book:0.10.0rc2-gpu +``` + +还需要将以下代码 +```python +paddle.init(use_gpu=False, trainer_count=1) +``` + +改成: +```python +paddle.init(use_gpu=True, trainer_count=1) +``` + + ## 贡献内容 您要是能贡献新的章节那就太好了!请发Pull Requests把您写的章节加入到`/pending`下面的一个子目录里。当这一章稳定下来,我们一起把您的目录挪到根目录。