Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FAQ about FT compiling #1750

Merged
merged 7 commits into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/machine_translation/transformer/static/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def do_train(args):
paddle.enable_static()
if args.is_distributed:
fleet.init(is_collective=True)
assert args.device != "xpu","xpu doesn't support distributed training"
assert args.device != "xpu", "xpu doesn't support distributed training"
places = [paddle.set_device("gpu")] if \
args.device == "gpu" else paddle.static.cpu_places()
trainer_count = len(places)
Expand Down
26 changes: 26 additions & 0 deletions paddlenlp/ops/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,29 @@ python ./faster_transformer/sample/gpt_export_model_sample.py --model_name_or_pa
cd bin/
./gpt -batch_size 1 -gpu_id 0 -model_dir path/to/model -vocab_file path/to/vocab -start_token "<|endoftext|>" -end_token "<|endoftext|>"
```

## FAQ

**问题 1**:编译报错 `module not found: paddle`

解决方式:编译自定义 op,默认使用系统命令 `python` 所指定的 Python 的版本,需要启动相应的 conda 或是 virtualenv,或是在编译时候指定 `-DPY_CMD=python3.7`。

**问题 2**:编译报错:

``` shell
error: unrecognized command line option '-std=c++14'
```

解决方式:需要确认环境中是否有多个 `gcc8.2`。`nvcc` 默认使用系统默认的 `gcc`,所以需要将预期使用的 `gcc` 加入到相关环境变量中。

**问题 3**:编译自定义 op C++ Demo 报错,报错可能是但不限于:

``` shell
undefined reference to paddle_infer::Predictor::GetInputNames() ...
undefined reference to paddle_infer::Predictor::GetOutputNames() ...
undefined reference to paddle::AnalysisConfig::SetModel(std::string const&, std::string const&) ...

undefined reference to google::FlagRegisterer::FlagRegisterer ...
```

解决方式:PaddlePaddle 编译的时候如果使用了 CXX11 ABI,自行编写 demo 并编译自定义 OP 时候需要在 CMakeLists.txt 里面加 add_definitions(-D_GLIBCXX_USE_CXX11_ABI=1) 或是 cmake 时候加上对应选项。
4 changes: 2 additions & 2 deletions paddlenlp/ops/faster_transformer/transformer/decoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,8 @@ def _convert(module):
# temporarily. While size 0 seems all right in to_static.
dummy_tensor = paddle.zeros([1])
for key in [
f"slf_{m}_{n}"
for m in ("k", "v") for n in ("weight", "bias")
f"slf_{m}_{n}" for m in ("k", "v")
for n in ("weight", "bias")
]:
params[key].append((dummy_tensor, True
if key.endswith("bias") else False))
Expand Down