Skip to content

Commit 873a93a

Browse files
guoshengCSZeyuChen
andauthored
Refine SM description in FT docs. (#1158)
* Refine SM description in FT docs. * Refine jit build warning condition. * Refine fastertransformer.rst Co-authored-by: Zeyu Chen <[email protected]>
1 parent f02435a commit 873a93a

File tree

3 files changed

+26
-22
lines changed

3 files changed

+26
-22
lines changed

docs/advanced_guide/fastertransformer.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@ PaddleNLP 准备
8080
8181
mkdir build
8282
cd build/
83-
cmake .. -DSM=xx -DCMAKE_BUILD_TYPE=Release -DPY_CMD=python3.x
83+
cmake .. -DCMAKE_BUILD_TYPE=Release -DPY_CMD=python3.x
8484
make -j
8585
cd ../
8686
8787
可以使用的编译选项包括:
8888

89-
* `-DSM`: 是指的所用 GPU 的 compute capability。举例来说,可以将之指定为 70(V100) 或是 75(T4)
9089
* `-DPY_CMD`: 指定当前装有 PaddlePaddle 版本的 python 环境,比如 `-DPY_CMD=python3.7`。若未指定 `-DPY_CMD` 将会默认使用系统命令 `python` 对应的 Python。
90+
* `-DSM`: 是指的所用 GPU 的 compute capability,建议不使用该选项设置,未设置时将自动检测。如要设置,需根据 [compute capability](https://developer.nvidia.com/zh-cn/cuda-gpus#compute) 进行设置,如 V100 时设置 `-DSM=70` 或 T4 时设置 `-DSM=75`。
9191
* `-DWITH_GPT`: 是否编译带有 GPT 相关的 lib。若使用 GPT-2 高性能推理,需要加上 `-DWITH_GPT=ON`。默认为 OFF。
9292
* `-DWITH_UNIFIED`: 是否编译带有 Unified Transformer 或是 UNIMOText 相关的 lib。若使用,需要加上 `-DWITH_UNIFIED=ON`。默认为 ON。
9393
* `-DWITH_BART`: 是否编译带有 BART 支持的相关 lib。若使用,需要加上 `-DWITH_BART=ON`。默认为 ON。
@@ -254,13 +254,12 @@ PaddleNLP 准备
254254
255255
mkdir build
256256
cd build/
257-
cmake .. -DSM=xx -DCMAKE_BUILD_TYPE=Release -DPADDLE_LIB=/path/to/paddle_inference_lib/ -DDEMO=./demo/transformer_e2e.cc -DON_INFER=ON -DWITH_MKL=ON
257+
cmake .. -DCMAKE_BUILD_TYPE=Release -DPADDLE_LIB=/path/to/paddle_inference_lib/ -DDEMO=./demo/transformer_e2e.cc -DON_INFER=ON -DWITH_MKL=ON
258258
make -j
259259
cd ../
260260
261-
注意
261+
可以使用的编译选项包括
262262

263-
* `-DSM`: 是指的所用 GPU 的 compute capability。举例来说,可以将之指定为 70(V100) 或是 75(T4)
264263
* `-DPADDLE_LIB`: 需要指明使用的 PaddlePaddle 预测库的路径 `/path/to/paddle_inference_install_dir/`,需要使用的 PaddlePaddle 的 lib 可以选择自行编译或者直接从官网下载 `paddle_inference_linux_lib <https://paddleinference.paddlepaddle.org.cn/user_guides/download_lib.html#linux>`_。需要注意的是,在该路径下,预测库的组织结构满足:
265264
.. code-block::
266265
@@ -276,6 +275,7 @@ PaddleNLP 准备
276275
└── version.txt
277276
278277
* `-DDEMO`: 说明预测库使用 demo 的位置。比如指定 -DDEMO=./demo/transformer_e2e.cc 或是 -DDEMO=./demo/gpt.cc。最好使用绝对路径,若使用相对路径,需要是相对于 `PaddleNLP/paddlenlp/ops/faster_transformer/src/` 的相对路径。
278+
* `-DSM`: 是指的所用 GPU 的 compute capability,建议不使用该选项设置,未设置时将自动检测。如要设置,需根据 [compute capability](https://developer.nvidia.com/zh-cn/cuda-gpus#compute) 进行设置,如 V100 时设置 `-DSM=70` 或 T4 时设置 `-DSM=75`。
279279
* `-DWITH_GPT`: 是否编译带有 GPT 相关的 lib。若使用 GPT-2 高性能推理,需要加上 `-DWITH_GPT=ON`。默认为 OFF。
280280
* `-DWITH_UNIFIED`: 是否编译带有 Unified Transformer 或是 UNIMOText 相关的 lib。若使用,需要加上 `-DWITH_UNIFIED=ON`。默认为 ON。
281281
* `-DWITH_BART`: 是否编译带有 BART 支持的相关 lib。若使用,需要加上 `-DWITH_BART=ON`。默认为 ON。

paddlenlp/ops/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ cd PaddleNLP/paddlenlp/ops/
7979
``` sh
8080
mkdir build
8181
cd build/
82-
cmake .. -DSM=xx -DCMAKE_BUILD_TYPE=Release -DPY_CMD=python3.x
82+
cmake .. -DCMAKE_BUILD_TYPE=Release -DPY_CMD=python3.x
8383
make -j
8484
cd ../
8585
```
8686

8787
可以使用的编译选项包括:
88-
* `-DSM`: 是指的所用 GPU 的 compute capability。举例来说,可以将之指定为 70(V100) 或是 75(T4)
8988
* `-DPY_CMD`: 指定当前装有 PaddlePaddle 版本的 python 环境,比如 `-DPY_CMD=python3.7`。若未指定 `-DPY_CMD` 将会默认使用系统命令 `python` 对应的 Python。
89+
* `-DSM`: 是指的所用 GPU 的 compute capability,建议不使用该选项设置,未设置时将自动检测。如要设置,需根据 [compute capability](https://developer.nvidia.com/zh-cn/cuda-gpus#compute) 进行设置,如 V100 时设置 `-DSM=70` 或 T4 时设置 `-DSM=75`
9090
* `-DWITH_GPT`: 是否编译带有 GPT 相关的 lib。若使用 GPT-2 高性能推理,需要加上 `-DWITH_GPT=ON`。默认为 OFF。
9191
* `-DWITH_UNIFIED`: 是否编译带有 Unified Transformer 或是 UNIMOText 相关的 lib。若使用,需要加上 `-DWITH_UNIFIED=ON`。默认为 ON。
9292
* `-DWITH_BART`: 是否编译带有 BART 支持的相关 lib。若使用,需要加上 `-DWITH_BART=ON`。默认为 ON。
@@ -242,13 +242,12 @@ cd PaddleNLP/paddlenlp/ops/
242242
``` sh
243243
mkdir build
244244
cd build/
245-
cmake .. -DSM=xx -DCMAKE_BUILD_TYPE=Release -DPADDLE_LIB=/path/to/paddle_inference_lib/ -DDEMO=./demo/transformer_e2e.cc -DON_INFER=ON -DWITH_MKL=ON
245+
cmake .. -DCMAKE_BUILD_TYPE=Release -DPADDLE_LIB=/path/to/paddle_inference_lib/ -DDEMO=./demo/transformer_e2e.cc -DON_INFER=ON -DWITH_MKL=ON
246246
make -j
247247
cd ../
248248
```
249249

250-
注意:
251-
* `-DSM`: 是指的所用 GPU 的 compute capability。举例来说,可以将之指定为 70(V100) 或是 75(T4)
250+
可以使用的编译选项包括:
252251
* `-DPADDLE_LIB`: 需要指明使用的 PaddlePaddle 预测库的路径 `/path/to/paddle_inference_install_dir/`,需要使用的 PaddlePaddle 的 lib 可以选择自行编译或者直接从官网下载 [paddle_inference_linux_lib](https://paddleinference.paddlepaddle.org.cn/user_guides/download_lib.html#linux)。需要注意的是,在该路径下,预测库的组织结构满足:
253252
```text
254253
.
@@ -263,6 +262,7 @@ cd ../
263262
└── version.txt
264263
```
265264
* `-DDEMO`: 说明预测库使用 demo 的位置。比如指定 -DDEMO=./demo/transformer_e2e.cc 或是 -DDEMO=./demo/gpt.cc。最好使用绝对路径,若使用相对路径,需要是相对于 `PaddleNLP/paddlenlp/ops/faster_transformer/src/` 的相对路径。
265+
* `-DSM`: 是指的所用 GPU 的 compute capability,建议不使用该选项设置,未设置时将自动检测。如要设置,需根据 [compute capability](https://developer.nvidia.com/zh-cn/cuda-gpus#compute) 进行设置,如 V100 时设置 `-DSM=70` 或 T4 时设置 `-DSM=75`
266266
* `-DWITH_GPT`: 是否编译带有 GPT 相关的 lib。若使用 GPT-2 高性能推理,需要加上 `-DWITH_GPT=ON`。默认为 OFF。
267267
* `-DWITH_UNIFIED`: 是否编译带有 Unified Transformer 或是 UNIMOText 相关的 lib。若使用,需要加上 `-DWITH_UNIFIED=ON`。默认为 ON。
268268
* `-DWITH_BART`: 是否编译带有 BART 支持的相关 lib。若使用,需要加上 `-DWITH_BART=ON`。默认为 ON。

paddlenlp/ops/faster_transformer/transformer/decoding.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,10 @@ def __init__(self,
406406
paddle.utils.cpp_extension.load_op_meta_info_and_register_op(
407407
decoding_lib)
408408
else:
409-
logger.warning(
410-
"The specified decoding_lib does not exist, and it will be built automatically."
411-
)
409+
if decoding_lib is not None:
410+
logger.warning(
411+
"The specified decoding_lib does not exist, and it will be built automatically."
412+
)
412413
load("FasterTransformer", verbose=True)
413414

414415
super(InferTransformerDecoding, self).__init__()
@@ -597,9 +598,10 @@ def __init__(self,
597598
paddle.utils.cpp_extension.load_op_meta_info_and_register_op(
598599
decoding_lib)
599600
else:
600-
logger.warning(
601-
"The specified decoding_lib does not exist, and it will be built automatically."
602-
)
601+
if decoding_lib is not None:
602+
logger.warning(
603+
"The specified decoding_lib does not exist, and it will be built automatically."
604+
)
603605
load("FasterTransformer", verbose=True)
604606

605607
super(InferGptDecoding, self).__init__()
@@ -770,9 +772,10 @@ def __init__(self,
770772
paddle.utils.cpp_extension.load_op_meta_info_and_register_op(
771773
decoding_lib)
772774
else:
773-
logger.warning(
774-
"The specified decoding_lib does not exist, and it will be built automatically."
775-
)
775+
if decoding_lib is not None:
776+
logger.warning(
777+
"The specified decoding_lib does not exist, and it will be built automatically."
778+
)
776779
load("FasterTransformer", verbose=True)
777780

778781
super(InferUnifiedDecoding, self).__init__()
@@ -1133,9 +1136,10 @@ def __init__(
11331136
paddle.utils.cpp_extension.load_op_meta_info_and_register_op(
11341137
decoding_lib)
11351138
else:
1136-
logger.warning(
1137-
"The specified decoding_lib does not exist, and it will be built automatically."
1138-
)
1139+
if decoding_lib is not None:
1140+
logger.warning(
1141+
"The specified decoding_lib does not exist, and it will be built automatically."
1142+
)
11391143
load("FasterTransformer", verbose=True)
11401144

11411145
super(InferBartDecoding, self).__init__()

0 commit comments

Comments
 (0)