Skip to content

Commit 63a3e11

Browse files
add npu paddlex (#1380)
1 parent 61c490d commit 63a3e11

File tree

1 file changed

+82
-13
lines changed

1 file changed

+82
-13
lines changed

backends/npu/tools/pr_ci_npu.sh

Lines changed: 82 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,75 @@ function card_test() {
158158
}
159159

160160

161+
function run_paddlex() {
162+
163+
# PaddleX test
164+
export DEVICE=($(echo $ASCEND_RT_VISIBLE_DEVICES | tr "," "\n"))
165+
export DEVICE_LIST=$(echo $ASCEND_RT_VISIBLE_DEVICES)
166+
unset USE_910B
167+
unset ASCEND_RT_VISIBLE_DEVICES
168+
echo "Start Download"
169+
git clone --depth 1000 https://gitee.com/PaddlePaddle/PaddleX.git
170+
cd PaddleX
171+
pip install -e .
172+
paddlex --install PaddleClas
173+
paddlex --install PaddleDetection
174+
paddlex --install PaddleSeg
175+
176+
wget -q https://paddle-model-ecology.bj.bcebos.com/paddlex/data/cls_flowers_examples.tar -P ./dataset
177+
tar -xf ./dataset/cls_flowers_examples.tar -C ./dataset/
178+
wget -q https://paddle-model-ecology.bj.bcebos.com/paddlex/data/det_coco_examples.tar -P ./dataset
179+
tar -xf ./dataset/det_coco_examples.tar -C ./dataset/
180+
wget -q https://paddle-model-ecology.bj.bcebos.com/paddlex/data/seg_optic_examples.tar -P ./dataset
181+
tar -xf ./dataset/seg_optic_examples.tar -C ./dataset/
182+
echo "End Download"
183+
184+
echo "Start PaddleX ResNet50"
185+
python main.py -c paddlex/configs/image_classification/ResNet50.yaml \
186+
-o Global.mode=train \
187+
-o Global.dataset_dir=./dataset/cls_flowers_examples \
188+
-o Global.output=resnet50_output \
189+
-o Global.device="npu:${DEVICE_LIST}"
190+
191+
#python main.py -c paddlex/configs/image_classification/ResNet50.yaml \
192+
#-o Global.mode=predict \
193+
#-o Predict.model_dir="./resnet50_output/best_model" \
194+
#-o Predict.input_path="https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg" \
195+
#-o Global.device="npu:${DEVICE}"
196+
echo "End PaddleX ResNet50"
197+
198+
echo "Start PP-YOLOE+"
199+
python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \
200+
-o Global.mode=train \
201+
-o Global.dataset_dir=./dataset/det_coco_examples \
202+
-o Global.output=ppyolo_plus_s_output \
203+
-o Global.device="npu:${DEVICE_LIST}"
204+
205+
#python main.py -c paddlex/configs/object_detection/PP-YOLOE_plus-S.yaml \
206+
#-o Global.mode=predict \
207+
#-o Predict.model_dir="./ppyolo_plus_s_output/best_model" \
208+
#-o Predict.input_path="https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_object_detection_002.png" \
209+
#-o Global.device="npu:${DEVICE}"
210+
echo "End PP-YOLOE+"
211+
212+
echo "Start DeepLabv3+"
213+
python main.py -c paddlex/configs/semantic_segmentation/Deeplabv3_Plus-R50.yaml \
214+
-o Global.mode=train \
215+
-o Global.dataset_dir=./dataset/seg_optic_examples \
216+
-o Global.output=deeplabv3p_output \
217+
-o Global.device="npu:${DEVICE_LIST}"
218+
219+
#python main.py -c paddlex/configs/semantic_segmentation/Deeplabv3_Plus-R50.yaml \
220+
#-o Global.mode=predict \
221+
#-o Predict.model_dir="./deeplabv3p_output/best_model/model/" \
222+
#-o Predict.input_path="https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_semantic_segmentation_001.jpg" \
223+
#-o Global.device="npu:${DEVICE}"
224+
echo "End DeepLabv3+"
225+
}
226+
227+
161228
function main() {
162229
# skip paddlepaddle cpu install as npu docker image already have cpu whl package installed
163-
164230
# custom_npu build and install
165231
cd ${CODE_ROOT}
166232
bash tools/compile.sh
@@ -225,18 +291,16 @@ function main() {
225291
done <<< "$disable_ut_npu";
226292
disable_ut_list+="^disable_ut_npu$"
227293

228-
if [ "${TEST_IMPORTANT:-OFF}" == "OFF" ]; then
229-
disable_ut_list+="|"
230-
while read -r line; do
231-
res=$(echo "${changed_ut_list[@]}" | grep "${line}" | wc -l)
232-
if [ $res -eq 0 ]; then
233-
disable_ut_list+="^"${line}"$|"
234-
else
235-
echo "Found ${line} code changed, ignore ut list disabled in disable_ut_npu"
236-
fi
237-
done <<< "$important_ut_npu";
238-
disable_ut_list+="^important_ut_npu$"
239-
fi
294+
disable_ut_list+="|"
295+
while read -r line; do
296+
res=$(echo "${changed_ut_list[@]}" | grep "${line}" | wc -l)
297+
if [ $res -eq 0 ]; then
298+
disable_ut_list+="^"${line}"$|"
299+
else
300+
echo "Found ${line} code changed, ignore ut list disabled in disable_ut_npu"
301+
fi
302+
done <<< "$important_ut_npu";
303+
disable_ut_list+="^important_ut_npu$"
240304

241305
echo "disable_ut_list=${disable_ut_list}"
242306
IFS=$IFS_DEFAULT
@@ -361,6 +425,11 @@ function main() {
361425
if [[ "${WITH_COVERAGE:-OFF}" == "ON" ]];then
362426
bash ${CODE_ROOT}/tools/coverage/coverage_process.sh
363427
fi
428+
429+
# Run PaddleX Test
430+
if [[ "${TEST_IMPORTANT:-OFF}" == "OFF" ]];then
431+
run_paddlex
432+
fi
364433
}
365434

366435
main $@

0 commit comments

Comments
 (0)