Skip to content

Commit a09e911

Browse files
authored
some problems in doc, compile from source code in install/index_en.html linked to chinese document. (PaddlePaddle#3344)
* the link without _en in url is zh_CN document * some problems in FAQ using img tag using quote not codeblock for this using quote not codeblock for this * format the inline codes * update the .gitignore * plural Issues
1 parent fe7daa0 commit a09e911

8 files changed

Lines changed: 61 additions & 52 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
/doc/fluid/menu.en.json
55
.idea
66
build
7+
*_en.rst

doc/paddle/faq/2.0.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
##### 问题:从1.x版本升级为2.0版本,哪些API有变动 ?
4646

47-
+ 答复:飞桨框架2.0.0版本推荐用户使用位于paddle根目录下的API,同时在paddle.fluid目录下保留了所有的1.x版本的API,保留对之前版本API体系的支持。
47+
+ 答复:飞桨框架2.0.0版本推荐用户使用位于paddle根目录下的API,同时在`paddle.fluid`目录下保留了所有的1.x版本的API,保留对之前版本API体系的支持。
4848

4949
查看API变动的两种方法:
5050

@@ -76,17 +76,17 @@
7676

7777
+ 问题分析:
7878

79-
2.0版本默认开启了动态图模式。即当用户调用import paddle后,此时Paddle已经运行在动态图模式下。基于1.8开发的静态图代码,在2.0版本下直接执行会出错。为此,我们在静态图的一些入口API 中加入了报错检查,例如直接调用fluid.data会遇到如下错误
79+
2.0版本默认开启了动态图模式。即当用户调用`import paddle`,此时Paddle已经运行在动态图模式下。基于1.8开发的静态图代码,在2.0版本下直接执行会出错。为此,我们在静态图的一些入口API 中加入了报错检查,例如直接调用`fluid.data`会遇到如下错误
8080

8181
![图片](https://paddlepaddleimage.cdn.bcebos.com/faqimage%2Fbj-fcd837654fa8c5bb15b071ecaad6b92ef632d872.png)
8282

8383
+ 解决方案:
8484

85-
1. 旧版本(1.8及之前版本)静态图下的代码,需要在import paddle后的头部位置加入paddle.enable_static()来开启静态图模式,这样才能正常运行。
85+
1. 旧版本(1.8及之前版本)静态图下的代码,需要在`import paddle`后的头部位置加入`paddle.enable_static()`来开启静态图模式,这样才能正常运行。
8686

8787
2. 原来通过dygraph guard写的动态图代码仍然可以正常执行。但在2.0下可以不需要像以前写dygraph guard,直接按照动态图模式编写代码。
8888

89-
3. 同时,请注意对于GPU版本的paddle,在import paddle时默认开启动态图会选择CUDAPlace作为默认place。如果要修改place,可以通过paddle.set_device()来完成。
89+
3. 同时,请注意对于GPU版本的paddle,`import paddle`时默认开启动态图会选择`CUDAPlace`作为默认place。如果要修改place,可以通过`paddle.set_device()`来完成。
9090

9191

9292
----------
@@ -96,8 +96,8 @@
9696

9797
+ 答复:
9898

99-
2.0版本新增动态图梯度累加功能,起到变相“扩大BatchSize”的作用,backward()接口默认不清空上个step梯度。
99+
2.0版本新增动态图梯度累加功能,起到变相“扩大BatchSize”的作用,`backward()`接口默认不清空上个step梯度。
100100

101101
+ 解决方案:
102102

103-
调用optimizer.minimize()后,显式调用optimizer.clear_grad()来清空梯度。
103+
调用`optimizer.minimize()`后,显式调用`optimizer.clear_grad()`来清空梯度。

doc/paddle/faq/data_cn.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
+ 答复:当训练时使用的数据集数据量较大或者预处理逻辑复杂时,如果串行地进行数据读取,数据读取往往会成为训练效率的瓶颈。这种情况下通常需要利用多线程或者多进程的方法异步地进行数据载入,从而提高数据读取和整体训练效率。
77

8-
paddle中推荐使用 DataLoader,这是一种灵活的异步加载方式。
8+
paddle中推荐使用 `DataLoader`,这是一种灵活的异步加载方式。
99

10-
该API提供了多进程的异步加载支持,可以配置num_workers指定异步加载数据的进程数目从而满足不同规模数据集的读取需求
10+
该API提供了多进程的异步加载支持,可以配置`num_workers`指定异步加载数据的进程数目从而满足不同规模数据集的读取需求
1111

1212
具体使用方法及示例请参考API文档:[paddle.io.DataLoader](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/io/DataLoader_cn.html#dataloader)
1313

@@ -42,7 +42,7 @@ paddle中推荐使用 DataLoader,这是一种灵活的异步加载方式。
4242

4343
+ 答复:在动态图模式下,可以参考如下示例:
4444

45-
```
45+
```python
4646
import paddle
4747
import numpy as np
4848

doc/paddle/faq/index_cn.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
本栏目以问答对的形式收录了用户开发过程中遇到的高频咨询类问题,包含了2.0版本的变化、安装、数据与数据处理、模型组网、训练、预测、模型保存与加载、参数调整等几类常见问题。
66

7-
除次之外,你也可以查看 `官网API文档 <https://www.paddlepaddle.org.cn/documentation/docs/zh/guides/index_cn.html>`_ 、 `历史Issue <https://github.com/PaddlePaddle/Paddle/issues>`_ 、 `AI社区 <https://ai.baidu.com/forum/topic/list/168>`_ 来寻求解答。
7+
除次之外,你也可以查看 `官网API文档 <https://www.paddlepaddle.org.cn/documentation/docs/zh/guides/index_cn.html>`_ 、 `历史Issues <https://github.com/PaddlePaddle/Paddle/issues>`_ 、 `AI社区 <https://ai.baidu.com/forum/topic/list/168>`_ 来寻求解答。
88

9-
同时,你也可以在 `Github Issue <https://github.com/PaddlePaddle/Paddle/issues>`_ 中进行提问,我们会有专门的技术人员为您解答。
9+
同时,你也可以在 `Github Issues <https://github.com/PaddlePaddle/Paddle/issues>`_ 中进行提问,我们会有专门的技术人员为您解答。
1010

1111
本栏目收录的问题集:
1212

doc/paddle/faq/install_cn.md

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,12 @@
55

66
+ 问题描述:
77

8-
TensorRT dynamic library (libnvinfer.so) that Paddle depends on is not configured correctly. (error code is libnvinfer.so: cannot open shared object file: No such file or directory)
9-
10-
Suggestions:
11-
12-
Check if TensorRT is installed correctly and its version is matched with paddlepaddle you installed.
13-
14-
Configure TensorRT dynamic library environment variables as follows:
15-
16-
Linux: set LD_LIBRARY_PATH by export LD_LIBRARY_PATH=...
17-
18-
Windows: set PATH by `set PATH=XXX;
19-
8+
> TensorRT dynamic library (libnvinfer.so) that Paddle depends on is not configured correctly. (error code is libnvinfer.so: cannot open shared object file: No such file or directory)
9+
> Suggestions:
10+
> Check if TensorRT is installed correctly and its version is matched with paddlepaddle you installed.
11+
> Configure TensorRT dynamic library environment variables as follows:
12+
> Linux: set LD_LIBRARY_PATH by export LD_LIBRARY_PATH=...
13+
> Windows: set PATH by `set PATH=XXX;
2014
+ 问题分析:
2115

2216
遇到该问题是因为使用的paddle默认开始了TensorRT,但是本地环境中没有找到TensorRT的库,该问题只影响使用[Paddle Inference](https://paddleinference.paddlepaddle.org.cn/master/product_introduction/inference_intro.html)开启TensorRT预测的场景,对其它方面均不造成影响。
@@ -37,17 +31,21 @@ Windows: set PATH by `set PATH=XXX;
3731

3832
1. Python2情况下,使用如下命令安装PaddlePaddle。
3933

40-
`pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple/`
34+
```bash
35+
pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple/`
36+
```
4137

4238
2. Python3情况下,使用如下命令安装PaddlePaddle。
4339

44-
`pip3 install paddlepaddle -i https://mirror.baidu.com/pypi/simple/`
40+
```bash
41+
pip3 install paddlepaddle -i https://mirror.baidu.com/pypi/simple/`
42+
```
4543

4644
你还可以通过如下三个地址获取pip安装包,只需修改 `-i` 后网址即可:
4745

48-
https://pypi.tuna.tsinghua.edu.cn/simple
49-
https://mirrors.aliyun.com/pypi/simple/
50-
https://pypi.douban.com/simple/
46+
1. https://pypi.tuna.tsinghua.edu.cn/simple
47+
2. https://mirrors.aliyun.com/pypi/simple/
48+
3. https://pypi.douban.com/simple/
5149

5250
------
5351

@@ -57,15 +55,15 @@ https://pypi.douban.com/simple/
5755

5856
使用pip install时报错,`PermissionError: [WinError 5]`
5957

60-
`C:\\program fiels\\python35\\Lib\\site-packages\\graphviz`
58+
`C:\\Program Files\\python35\\Lib\\site-packages\\graphviz`
6159

6260
+ 报错分析:
6361

64-
用户权限问题导致,由于用户的Python安装到系统文件内(如Program Files/),任何的操作都需要管理员权限。
62+
用户权限问题导致,由于用户的Python安装到系统文件内(如`Program Files/`),任何的操作都需要管理员权限。
6563

6664
+ 解决方法:
6765

68-
选择“以管理员身份运行”运行CMD,重新执行安装过程, 使用命令sudo pip install paddlepaddle
66+
选择“以管理员身份运行”运行CMD,重新执行安装过程, 使用命令`pip install paddlepaddle`
6967

7068
------
7169

@@ -75,8 +73,9 @@ https://pypi.douban.com/simple/
7573

7674
使用pip install时报错,`ERROR: Could not find a version that satisfies the requirement paddlepaddle (from versions: none)`
7775

78-
``ERROR: No matching distribution found for paddlepaddle`
79-
![图片](https://agroup-bos-bj.cdn.bcebos.com/bj-febb18fb78004dc17f18d60a009dc6a8bd907251)
76+
`ERROR: No matching distribution found for paddlepaddle`
77+
78+
<img src="https://agroup-bos-bj.cdn.bcebos.com/bj-febb18fb78004dc17f18d60a009dc6a8bd907251" alt="图片" />
8079

8180
+ 报错分析:
8281

@@ -92,11 +91,11 @@ Python版本不匹配导致。用户使用的是32位Python,但是对应的32
9291

9392
+ 报错分析:
9493

95-
原因在于用户的计算机上可能安装了多个版本的Python,而安装PaddlePaddle时的Python和import paddle时的Python版本不一致导致报错。如果用户熟悉PyCharm等常见的IDE配置包安装的方法,配置运行的方法,则可以避免此类问题。
94+
原因在于用户的计算机上可能安装了多个版本的Python,而安装PaddlePaddle时的Python和`import paddle`时的Python版本不一致导致报错。如果用户熟悉PyCharm等常见的IDE配置包安装的方法,配置运行的方法,则可以避免此类问题。
9695

9796
+ 解决方法:
9897

99-
用户明确安装Paddle的python位置,并切换到该python进行安装。可能需要使用python -m pip install paddlepaddle命令确保paddle是安装到该python中
98+
用户明确安装Paddle的python位置,并切换到该python进行安装。可能需要使用`python -m pip install paddlepaddle`命令确保paddle是安装到该python中
10099

101100
------
102101

@@ -124,11 +123,13 @@ CUDA安装错误导致。
124123

125124
+ 解决方法:
126125

127-
查找“libcudart.so”所在目录,并将其添加到LD_LIBRARY_PATH中。
126+
查找“libcudart.so”所在目录,并将其添加到`LD_LIBRARY_PATH`中。
128127

129-
例如:执行`find / -name libcudart.so`, 发现libcudart.so在/usr/local/cuda-10.0/targets/x86_64-linux/lib/libcudart.so路径下, 使用如下命令添加即可。
128+
例如:执行`find / -name libcudart.so`, 发现libcudart.so在`/usr/local/cuda-10.0/targets/x86_64-linux/lib/libcudart.so`路径下, 使用如下命令添加即可。
130129

131-
`export LD_LIBRARY_PATH=/usr/local/cuda-10.0/targets/x86_64-linux/lib/libcudart.so$LD_LIBRARY_PATH`
130+
```bash
131+
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/targets/x86_64-linux/lib/libcudart.so:${LD_LIBRARY_PATH}
132+
```
132133

133134
------
134135

@@ -138,19 +139,26 @@ CUDA安装错误导致。
138139

139140
1. GPU环境:
140141

141-
`pip install -U paddlepaddle-gpu`
142+
```bash
143+
pip install -U paddlepaddle-gpu`
144+
```
142145

143146
或者
144147

145-
`pip install paddlepaddle-gpu == 需要安装的版本号(如2.0)`
148+
```bash
149+
pip install paddlepaddle-gpu == 需要安装的版本号(如2.0)`
150+
```
146151

147152
2. CPU环境:
148153

149-
`pip install -U paddlepaddle`
150-
154+
```bash
155+
pip install -U paddlepaddle`
156+
```
151157
或者
152158

153-
`pip install paddlepaddle == 需要安装的版本号(如2.0)`
159+
```bash
160+
pip install paddlepaddle == 需要安装的版本号(如2.0)`
161+
```
154162

155163
------
156164

doc/paddle/faq/params_cn.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
+ 答复:
2525

26-
1. 在动态图中,使用`paddle.save` API, 并将最后一层的layer.state_dict() 传入至save方法的obj 参数即可, 然后> 使用`paddle.load` 方法加载对应层的参数值。详细可参考API文档[save](https://www.paddlepaddle.org.cn/documentat ion/docs/zh/api/paddle/framework/io/save_cn.html#save) 和[load](https://www.paddlepaddle.org.cn/documentatio n/docs/zh/api/paddle/framework/io/load_cn.html#load)。
26+
1. 在动态图中,使用`paddle.save` API, 并将最后一层的`layer.state_dict()` 传入至save方法的obj 参数即可, 然后使用`paddle.load` 方法加载对应层的参数值。详细可参考API文档[save](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/framework/io/save_cn.html#save)[load](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/framework/io/load_cn.html#load)
2727
2. 在静态图中,使用`paddle.static.save_vars`保存指定的vars,然后使用`paddle.static.load_vars`加载对应层的参数值。具体示例请见API文档:[load_vars](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/fluid/io/load_vars_cn.html)[save_vars](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/fluid/io/save_vars_cn.html)
2828

2929
----------
@@ -46,7 +46,7 @@
4646

4747
`step`表示的是经历了多少组mini_batch,其统计方法为`exe.run`(对应Program)运行的当前次数,即每运行一次`exe.run`,step加1。举例代码如下:
4848

49-
```text
49+
```python
5050
# 执行下方代码后相当于step增加了N x Epoch总数
5151
for epoch in range(epochs):
5252
# 执行下方代码后step相当于自增了N

doc/paddle/faq/train_cn.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414

1515
##### 问题:在模型组网时,inplace参数的设置会影响梯度回传吗?经过不带参数的op之后,梯度是否会保留下来?
1616

17-
+ 答复:inplace 参数不会影响梯度回传。只要用户没有手动设置stop_gradient=True,梯度都会保留下来。
17+
+ 答复:inplace 参数不会影响梯度回传。只要用户没有手动设置`stop_gradient=True`,梯度都会保留下来。
1818

1919
----------
2020

2121
##### 问题:如何不训练某层的权重?
2222

23-
+ 答复:在`ParamAttr`里设置learning_rate=0或trainable设置为False。具体请参考文档:https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/fluid/param_attr/ParamAttr_cn.html
23+
+ 答复:在`ParamAttr`里设置`learning_rate=0``trainable`设置为`False`。具体请[参考文档](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/fluid/param_attr/ParamAttr_cn.html)
2424

2525
----------
2626

@@ -30,7 +30,7 @@
3030

3131
1. 使用多进程DataLoader加速数据读取:训练数据较多时,数据处理往往会成为训练速度的瓶颈,paddle提供了异步数据读取接口DataLoader,可以使用多进程进行数据加载,充分利用多处理的优势,具体使用方法及示例请参考API文档:[paddle.io.DataLoader](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/io/DataLoader_cn.html#dataloader)
3232

33-
2. 推荐使用支持MKL(英特尔数学核心函数库)的paddle安装包,MKL相比Openblas等通用计算库在计算速度上有显著的优势,能够提升您的训练效率。
33+
2. 推荐使用支持[MKL(英特尔数学核心函数库)](https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl.html)的paddle安装包,MKL相比Openblas等通用计算库在计算速度上有显著的优势,能够提升您的训练效率。
3434

3535
----------
3636

@@ -60,7 +60,7 @@
6060

6161
2. 开启以下三个选项:
6262

63-
```
63+
```bash
6464
#一旦不再使用即释放内存垃圾,=1.0 垃圾占用内存大小达到10G时,释放内存垃圾`
6565
export FLAGS_eager_delete_tensor_gb=0.0`
6666
#启用快速垃圾回收策略,不等待cuda kernel 结束,直接释放显存`
@@ -123,9 +123,9 @@ export FLAGS_fraction_of_gpu_memory_to_use=0`
123123

124124
----------
125125

126-
##### 问题:load_inference_model在加载预测模型时能否用py_reader读取
126+
##### 问题:`load_inference_model`在加载预测模型时能否用`py_reader`读取
127127

128-
+ 答复:目前`load_inference_model`加载进行的模型还不支持py_reader输入
128+
+ 答复:目前`load_inference_model`加载进行的模型还不支持`py_reader`输入
129129

130130
----------
131131

doc/paddle/install/index_en.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ The second way to install: compile and install with source code
221221
===============================================================
222222

223223
- If you use PaddlePaddle only, we suggest you installation methods **pip** to install.
224-
- If you need to develop PaddlePaddle, please refer to `compile from source code <compile/fromsource.html>`_
224+
- If you need to develop PaddlePaddle, please refer to `compile from source code <compile/fromsource_en.html>`_
225225

226226
.. toctree::
227227
:hidden:

0 commit comments

Comments
 (0)