File tree Expand file tree Collapse file tree 5 files changed +14
-11
lines changed
paddlenlp/experimental/transformers Expand file tree Collapse file tree 5 files changed +14
-11
lines changed Original file line number Diff line number Diff line change 11# cpu-custom-ops
22
33## 快速开始
4-
5- ### 1.环境准备
4+ ### 1. 详细 cpu 推理教程
5+ [cpu](../../llm/docs/cpu_install.md)
6+ ###
7+ ### 2.环境准备
68``` shell
7- cmake > =3.18
89# 查询机器是否支持 avx512指令
910lscpu | grep avx512*
1011```
1112
12- ### 2 .安装 cpu 自定义算子和第三方库
13+ ### 3 .安装 cpu 自定义算子和第三方库
1314``` shell
1415# 建议在 gcc 9.4.0 下安装第三方库
1516bash setup.sh
Original file line number Diff line number Diff line change @@ -55,12 +55,12 @@ rm -rf build
5555mkdir build && cd build
5656cmake ..
5757make -j
58+ cd ..
5859
5960# xft
6061export XFT_HEADER_DIR=$PWD
6162export XFT_LIB_DIR=$XFT_HEADER_DIR /build
6263export LD_LIBRARY_PATH=$XFT_LIB_DIR :$LD_LIBRARY_PATH
63-
6464# setup cpu paddle_nlp ops
65- cd ../../
66- python ./src/setup_cpu.py install
65+ cd ..
66+ python ./src/setup_cpu.py install --user
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ def check_avx512_bf16__support():
112112
113113custom_kernel_dot_module = CppExtension (
114114 sources = [
115- "../generation /save_with_output.cc" ,
115+ "../gpu /save_with_output.cc" ,
116116 "./src/token_penalty_multi_scores.cc" ,
117117 "./src/stop_generation_multi_ends.cc" ,
118118 "./src/set_value_by_flags.cc" ,
@@ -129,6 +129,6 @@ def check_avx512_bf16__support():
129129setup (
130130 name = "paddlenlp_ops" ,
131131 version = "1.0" ,
132- description = "custom kernel fot compiling" ,
132+ description = "custom kernel for compiling" ,
133133 ext_modules = [custom_kernel_dot_module ],
134134)
Original file line number Diff line number Diff line change 4040 "The paddlenlp_ops package is not installed. you can read the docs and install it by hand, "
4141 "you can refer to: https://github.com/PaddlePaddle/PaddleNLP/blob/develop/csrc/README.md"
4242 )
43- from paddlenlp_ops import rebuild_padding_v2
43+ if (
44+ paddle .device .get_all_custom_device_type () is not None and len (paddle .device .get_all_custom_device_type ()) > 0
45+ ) or core .is_compiled_with_cuda ():
46+ from paddlenlp_ops import rebuild_padding_v2
4447
4548if core .is_compiled_with_cuda ():
4649 if os .getenv ("FLAGS_CUTLASS_FP8_GEMM" , "False" ) == "True" :
Original file line number Diff line number Diff line change @@ -291,7 +291,6 @@ def forward(
291291 @paddle .no_grad ()
292292 # avx
293293 def set_state_dict (self , state_dict ):
294- self .transformer_block .init_weight ()
295294 unfused_state_dict = {}
296295 head_size = self .hidden_size // self .num_attention_heads
297296 split_fn = split_param_func ()
You can’t perform that action at this time.
0 commit comments