Skip to content

Commit

Permalink
test=huawei_ascend_npu
Browse files Browse the repository at this point in the history
  • Loading branch information
shentanyue committed Feb 19, 2022
1 parent a4c3167 commit f46f0a2
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 49 deletions.
50 changes: 23 additions & 27 deletions cmake/lite.cmake
Original file line number Diff line number Diff line change
@@ -1,41 +1,37 @@
set(LITE_URL "http://paddle-inference-dist.bj.bcebos.com" CACHE STRING "inference download url")

function(lite_download_and_uncompress INSTALL_DIR URL FILENAME)
message(STATUS "Download inference test stuff: ${FILENAME}")
string(REGEX REPLACE "[-%.]" "_" FILENAME_EX ${FILENAME})
set(EXTERNAL_PROJECT_NAME "extern_lite_download_${FILENAME_EX}")
set(UNPACK_DIR "${INSTALL_DIR}/src/${EXTERNAL_PROJECT_NAME}")
ExternalProject_Add(
${EXTERNAL_PROJECT_NAME}
${EXTERNAL_PROJECT_LOG_ARGS}
PREFIX ${INSTALL_DIR}
DOWNLOAD_COMMAND wget --no-check-certificate -q -O ${INSTALL_DIR}/${FILENAME} ${URL}/${FILENAME} && ${CMAKE_COMMAND} -E tar xzf ${INSTALL_DIR}/${FILENAME} && rm -f ${INSTALL_DIR}/${FILENAME}
DOWNLOAD_DIR ${INSTALL_DIR}
DOWNLOAD_NO_PROGRESS 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
UPDATE_COMMAND ""
INSTALL_COMMAND ""
)
endfunction()
set(options "")
set(oneValueArgs MODEL_PATH)
set(multiValueArgs "")
cmake_parse_arguments(args "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

if(DEFINED args_MODEL_PATH)
set(FILE_PATH ${args_MODEL_PATH}/${FILENAME})
set(PREFIX ${INSTALL_DIR}/${args_MODEL_PATH})
set(DOWNLOAD_DIR ${INSTALL_DIR}/${args_MODEL_PATH})
else()
set(FILE_PATH ${FILENAME})
set(PREFIX ${INSTALL_DIR})
set(DOWNLOAD_DIR ${INSTALL_DIR})
endif()

function(lite_download_and_uncompress_for_nnadapter INSTALL_DIR URL MODEL_PATH FILENAME)
message(STATUS "Download inference test stuff: ${FILENAME}")
string(REGEX REPLACE "[-%./]" "_" FILENAME_EX ${MODEL_PATH}/${FILENAME})
set(EXTERNAL_PROJECT_NAME "extern_lite_download_${FILENAME_EX}")
set(UNPACK_DIR "${INSTALL_DIR}/src/${EXTERNAL_PROJECT_NAME}")
ExternalProject_Add(
message(STATUS "Download inference test stuff: ${FILE_PATH}")
string(REGEX REPLACE "[-%./]" "_" FILENAME_EX ${FILE_PATH})
set(EXTERNAL_PROJECT_NAME "extern_lite_download_${FILENAME_EX}")
set(UNPACK_DIR "${INSTALL_DIR}/src/${EXTERNAL_PROJECT_NAME}")
ExternalProject_Add(
${EXTERNAL_PROJECT_NAME}
${EXTERNAL_PROJECT_LOG_ARGS}
PREFIX ${INSTALL_DIR}/${MODEL_PATH}
DOWNLOAD_COMMAND wget --no-check-certificate -q -O ${INSTALL_DIR}/${MODEL_PATH}/${FILENAME} ${URL}/${MODEL_PATH}/${FILENAME} && ${CMAKE_COMMAND} -E tar xzf ${INSTALL_DIR}/${MODEL_PATH}/${FILENAME} && rm -f ${INSTALL_DIR}/${MODEL_PATH}/${FILENAME}
DOWNLOAD_DIR ${INSTALL_DIR}/${MODEL_PATH}
PREFIX ${PREFIX}
DOWNLOAD_COMMAND wget --no-check-certificate -q -O ${INSTALL_DIR}/${FILE_PATH} ${URL}/${FILE_PATH} && ${CMAKE_COMMAND} -E tar xzf ${INSTALL_DIR}/${FILE_PATH} && rm -f ${INSTALL_DIR}/${FILE_PATH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
DOWNLOAD_NO_PROGRESS 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
UPDATE_COMMAND ""
INSTALL_COMMAND ""
)
)
endfunction()

function (lite_deps TARGET)
Expand Down
20 changes: 9 additions & 11 deletions lite/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,15 @@ if (WITH_TESTING)
lite_download_and_uncompress(${LITE_MODEL_DIR} ${LITE_URL_FOR_UNITTESTS} "SqueezeNet1_0_v2_0.tar.gz")
lite_download_and_uncompress(${LITE_MODEL_DIR} ${LITE_URL_FOR_UNITTESTS} "VGG16_v2_0.tar.gz")
lite_download_and_uncompress(${LITE_MODEL_DIR} ${LITE_URL_FOR_UNITTESTS} "VGG19_v2_0.tar.gz")
if (NNADAPTER_WITH_HUAWEI_ASCEND_NPU)
lite_download_and_uncompress_for_nnadapter(${LITE_MODEL_DIR} ${LITE_URL_FOR_NNADAPTER_UNITTESTS} "PaddleClas/v2.3/DarkNet" "DarkNet53.tar.gz")
lite_download_and_uncompress_for_nnadapter(${LITE_MODEL_DIR} ${LITE_URL_FOR_NNADAPTER_UNITTESTS} "PaddleClas/v2.3/DeiT" "DeiT_base_patch16_224.tar.gz")
lite_download_and_uncompress_for_nnadapter(${LITE_MODEL_DIR} ${LITE_URL_FOR_NNADAPTER_UNITTESTS} "PaddleClas/v2.3/DPN" "DPN68.tar.gz")
lite_download_and_uncompress_for_nnadapter(${LITE_MODEL_DIR} ${LITE_URL_FOR_NNADAPTER_UNITTESTS} "PaddleClas/v2.3/GhostNet" "GhostNet_x1_0.tar.gz")
lite_download_and_uncompress_for_nnadapter(${LITE_MODEL_DIR} ${LITE_URL_FOR_NNADAPTER_UNITTESTS} "PaddleClas/v2.3/HRNet" "HRNet_W18_C.tar.gz")
lite_download_and_uncompress_for_nnadapter(${LITE_MODEL_DIR} ${LITE_URL_FOR_NNADAPTER_UNITTESTS} "PaddleClas/v2.3/PPLCNet" "PPLCNet_x0_25.tar.gz")
lite_download_and_uncompress_for_nnadapter(${LITE_MODEL_DIR} ${LITE_URL_FOR_NNADAPTER_UNITTESTS} "PaddleClas/v2.3/Res2Net" "Res2Net50_26w_4s.tar.gz")
lite_download_and_uncompress_for_nnadapter(${LITE_MODEL_DIR} ${LITE_URL_FOR_NNADAPTER_UNITTESTS} "PaddleClas/v2.3/SENet" "SE_ResNet50_vd.tar.gz")
lite_download_and_uncompress_for_nnadapter(${LITE_MODEL_DIR} ${LITE_URL_FOR_NNADAPTER_UNITTESTS} "PaddleClas/v2.3/VisionTransformer" "ViT_base_patch16_224.tar.gz")
endif()
lite_download_and_uncompress(${LITE_MODEL_DIR} ${LITE_URL_FOR_NNADAPTER_UNITTESTS} "DarkNet53.tar.gz" MODEL_PATH "PaddleClas/v2.3/DarkNet")
lite_download_and_uncompress(${LITE_MODEL_DIR} ${LITE_URL_FOR_NNADAPTER_UNITTESTS} "DeiT_base_patch16_224.tar.gz" MODEL_PATH "PaddleClas/v2.3/DeiT")
lite_download_and_uncompress(${LITE_MODEL_DIR} ${LITE_URL_FOR_NNADAPTER_UNITTESTS} "DPN68.tar.gz" MODEL_PATH "PaddleClas/v2.3/DPN")
lite_download_and_uncompress(${LITE_MODEL_DIR} ${LITE_URL_FOR_NNADAPTER_UNITTESTS} "GhostNet_x1_0.tar.gz" MODEL_PATH "PaddleClas/v2.3/GhostNet")
lite_download_and_uncompress(${LITE_MODEL_DIR} ${LITE_URL_FOR_NNADAPTER_UNITTESTS} "HRNet_W18_C.tar.gz" MODEL_PATH "PaddleClas/v2.3/HRNet")
lite_download_and_uncompress(${LITE_MODEL_DIR} ${LITE_URL_FOR_NNADAPTER_UNITTESTS} "PPLCNet_x0_25.tar.gz" MODEL_PATH "PaddleClas/v2.3/PPLCNet")
lite_download_and_uncompress(${LITE_MODEL_DIR} ${LITE_URL_FOR_NNADAPTER_UNITTESTS} "Res2Net50_26w_4s.tar.gz" MODEL_PATH "PaddleClas/v2.3/Res2Net")
lite_download_and_uncompress(${LITE_MODEL_DIR} ${LITE_URL_FOR_NNADAPTER_UNITTESTS} "SE_ResNet50_vd.tar.gz" MODEL_PATH "PaddleClas/v2.3/SENet")
lite_download_and_uncompress(${LITE_MODEL_DIR} ${LITE_URL_FOR_NNADAPTER_UNITTESTS} "ViT_base_patch16_224.tar.gz" MODEL_PATH "PaddleClas/v2.3/VisionTransformer")
# PaddleDetection
lite_download_and_uncompress(${LITE_MODEL_DIR} ${LITE_URL_FOR_UNITTESTS} "ssd_mobilenet_v1_relu_voc_v2_2.tar.gz")
lite_download_and_uncompress(${LITE_MODEL_DIR} ${LITE_URL_FOR_UNITTESTS} "ssd_vgg16_voc_v2_2.tar.gz")
Expand Down
20 changes: 9 additions & 11 deletions lite/tests/api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,15 @@ if(LITE_WITH_NNADAPTER)
lite_cc_test_with_model_and_data(test_squeezenet_v1_fp32_v2_0_nnadapter SOURCE test_squeezenet_v1_fp32_v2_0_nnadapter.cc MODEL SqueezeNet1_0_v2_0 DATA ILSVRC2012_500)
lite_cc_test_with_model_and_data(test_vgg16_fp32_v2_0_nnadapter SOURCE test_vgg16_fp32_v2_0_nnadapter.cc MODEL VGG16_v2_0 DATA ILSVRC2012_500)
lite_cc_test_with_model_and_data(test_vgg19_fp32_v2_0_nnadapter SOURCE test_vgg19_fp32_v2_0_nnadapter.cc MODEL VGG19_v2_0 DATA ILSVRC2012_500)
if (NNADAPTER_WITH_HUAWEI_ASCEND_NPU)
lite_cc_test_with_model_and_data(test_darknet53_fp32_v2_3_nnadapter SOURCE test_darknet53_fp32_v2_3_nnadapter.cc MODEL PaddleClas/v2.3/DarkNet/DarkNet53 DATA ILSVRC2012_500)
lite_cc_test_with_model_and_data(test_deit_base_patch16_224_fp32_v2_3_nnadapter SOURCE test_deit_base_patch16_224_fp32_v2_3_nnadapter.cc MODEL PaddleClas/v2.3/DeiT/DeiT_base_patch16_224 DATA ILSVRC2012_500)
lite_cc_test_with_model_and_data(test_dpn68_fp32_v2_3_nnadapter SOURCE test_dpn68_fp32_v2_3_nnadapter.cc MODEL PaddleClas/v2.3/DPN/DPN68 DATA ILSVRC2012_500)
lite_cc_test_with_model_and_data(test_ghostnet_fp32_v2_3_nnadapter SOURCE test_ghostnet_fp32_v2_3_nnadapter.cc MODEL PaddleClas/v2.3/GhostNet/GhostNet_x1_0 DATA ILSVRC2012_500)
lite_cc_test_with_model_and_data(test_hrnet_w18_c_fp32_v2_3_nnadapter SOURCE test_hrnet_w18_c_fp32_v2_3_nnadapter.cc MODEL PaddleClas/v2.3/HRNet/HRNet_W18_C DATA ILSVRC2012_500)
lite_cc_test_with_model_and_data(test_pplcnet_x0_25_fp32_v2_3_nnadapter SOURCE test_pplcnet_x0_25_fp32_v2_3_nnadapter.cc MODEL PaddleClas/v2.3/PPLCNet/PPLCNet_x0_25 DATA ILSVRC2012_500)
lite_cc_test_with_model_and_data(test_res2net50_26w_4s_fp32_v2_3_nnadapter SOURCE test_res2net50_26w_4s_fp32_v2_3_nnadapter.cc MODEL PaddleClas/v2.3/Res2Net/Res2Net50_26w_4s DATA ILSVRC2012_500)
lite_cc_test_with_model_and_data(test_se_resnet50_vd_fp32_v2_3_nnadapter SOURCE test_se_resnet50_vd_fp32_v2_3_nnadapter.cc MODEL PaddleClas/v2.3/SENet/SE_ResNet50_vd DATA ILSVRC2012_500)
lite_cc_test_with_model_and_data(test_vit_base_patch16_224_fp32_v2_3_nnadapter SOURCE test_vit_base_patch16_224_fp32_v2_3_nnadapter.cc MODEL PaddleClas/v2.3/VisionTransformer/ViT_base_patch16_224 DATA ILSVRC2012_500)
endif()
lite_cc_test_with_model_and_data(test_darknet53_fp32_v2_3_nnadapter SOURCE test_darknet53_fp32_v2_3_nnadapter.cc MODEL PaddleClas/v2.3/DarkNet/DarkNet53 DATA ILSVRC2012_500)
lite_cc_test_with_model_and_data(test_deit_base_patch16_224_fp32_v2_3_nnadapter SOURCE test_deit_base_patch16_224_fp32_v2_3_nnadapter.cc MODEL PaddleClas/v2.3/DeiT/DeiT_base_patch16_224 DATA ILSVRC2012_500)
lite_cc_test_with_model_and_data(test_dpn68_fp32_v2_3_nnadapter SOURCE test_dpn68_fp32_v2_3_nnadapter.cc MODEL PaddleClas/v2.3/DPN/DPN68 DATA ILSVRC2012_500)
lite_cc_test_with_model_and_data(test_ghostnet_fp32_v2_3_nnadapter SOURCE test_ghostnet_fp32_v2_3_nnadapter.cc MODEL PaddleClas/v2.3/GhostNet/GhostNet_x1_0 DATA ILSVRC2012_500)
lite_cc_test_with_model_and_data(test_hrnet_w18_c_fp32_v2_3_nnadapter SOURCE test_hrnet_w18_c_fp32_v2_3_nnadapter.cc MODEL PaddleClas/v2.3/HRNet/HRNet_W18_C DATA ILSVRC2012_500)
lite_cc_test_with_model_and_data(test_pplcnet_x0_25_fp32_v2_3_nnadapter SOURCE test_pplcnet_x0_25_fp32_v2_3_nnadapter.cc MODEL PaddleClas/v2.3/PPLCNet/PPLCNet_x0_25 DATA ILSVRC2012_500)
lite_cc_test_with_model_and_data(test_res2net50_26w_4s_fp32_v2_3_nnadapter SOURCE test_res2net50_26w_4s_fp32_v2_3_nnadapter.cc MODEL PaddleClas/v2.3/Res2Net/Res2Net50_26w_4s DATA ILSVRC2012_500)
lite_cc_test_with_model_and_data(test_se_resnet50_vd_fp32_v2_3_nnadapter SOURCE test_se_resnet50_vd_fp32_v2_3_nnadapter.cc MODEL PaddleClas/v2.3/SENet/SE_ResNet50_vd DATA ILSVRC2012_500)
lite_cc_test_with_model_and_data(test_vit_base_patch16_224_fp32_v2_3_nnadapter SOURCE test_vit_base_patch16_224_fp32_v2_3_nnadapter.cc MODEL PaddleClas/v2.3/VisionTransformer/ViT_base_patch16_224 DATA ILSVRC2012_500)
# PaddleDetection
lite_cc_test_with_model_and_data(test_ssd_mobilenet_v1_relu_voc_int8_per_layer_v1_8_nnadapter SOURCE test_ssd_mobilenet_v1_relu_voc_int8_per_layer_v1_8_nnadapter.cc MODEL ssd_mobilenet_v1_relu_voc_int8_300_per_layer DATA VOC2012_100)
lite_cc_test_with_model_and_data(test_ssd_mobilenet_v1_relu_voc_fp32_v1_8_nnadapter SOURCE test_ssd_mobilenet_v1_relu_voc_fp32_v1_8_nnadapter.cc MODEL ssd_mobilenet_v1_relu_voc_fp32_300 DATA VOC2012_100)
Expand Down

0 comments on commit f46f0a2

Please sign in to comment.