Skip to content

Commit 93684fd

Browse files
committed
Add model counts in Validate ci
1 parent 7b74eab commit 93684fd

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

tools/ci/check_validate.sh

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,25 @@ function check_torch_validation() {
6262
MODIFIED_MODEL_PATHS[${#MODIFIED_MODEL_PATHS[@]}]=$model_path
6363
done
6464
MODIFIED_MODEL_PATHS=($(echo ${MODIFIED_MODEL_PATHS[@]} | tr ' ' '\n' | sort | uniq))
65-
LOG "[INFO] Validation of these models will run: ${MODIFIED_MODEL_PATHS[@]}"
65+
local total_models=${#MODIFIED_MODEL_PATHS[@]}
66+
if [ ${total_models} -eq 0 ]; then
67+
LOG "[INFO] No changed torch sample models detected. Skip torch validation."
68+
return 0
69+
fi
70+
LOG "[INFO] Validation will run on ${total_models} torch model path(s): ${MODIFIED_MODEL_PATHS[@]}"
6671
fail_name=()
6772
for model_path in ${MODIFIED_MODEL_PATHS[@]}
6873
do
6974
python -m graph_net.torch.validate --model-path ${GRAPH_NET_EXTRACT_WORKSPACE}/${model_path} --graph-net-samples-path ${GRAPH_NET_EXTRACT_WORKSPACE}/samples >&2
7075
[ $? -ne 0 ] && fail_name[${#fail_name[@]}]="${model_path}"
7176
done
72-
if [ ${#fail_name[@]} -ne 0 ]
73-
then
74-
LOG "[FATAL] Failed tests: ${fail_name[@]}"
77+
local failed_cnt=${#fail_name[@]}
78+
if [ ${failed_cnt} -ne 0 ]; then
79+
LOG "[FATAL] Failed tests (${failed_cnt}/${total_models}): ${fail_name[@]}"
7580
echo ${fail_name[@]}
7681
exit -1
82+
else
83+
LOG "[INFO] All torch sample validations passed (0 failures / ${total_models} total)."
7784
fi
7885
}
7986

@@ -87,18 +94,25 @@ function check_paddle_validation() {
8794
MODIFIED_MODEL_PATHS[${#MODIFIED_MODEL_PATHS[@]}]=$model_path
8895
done
8996
MODIFIED_MODEL_PATHS=($(echo ${MODIFIED_MODEL_PATHS[@]} | tr ' ' '\n' | sort | uniq))
90-
LOG "[INFO] Validation of these models will run: ${MODIFIED_MODEL_PATHS[@]}"
97+
local total_models=${#MODIFIED_MODEL_PATHS[@]}
98+
if [ ${total_models} -eq 0 ]; then
99+
LOG "[INFO] No changed paddle sample models detected. Skip paddle validation."
100+
return 0
101+
fi
102+
LOG "[INFO] Validation will run on ${total_models} paddle model path(s): ${MODIFIED_MODEL_PATHS[@]}"
91103
fail_name=()
92104
for model_path in ${MODIFIED_MODEL_PATHS[@]}
93105
do
94106
python -m graph_net.paddle.validate --model-path ${GRAPH_NET_EXTRACT_WORKSPACE}/${model_path} --graph-net-samples-path ${GRAPH_NET_EXTRACT_WORKSPACE}/samples >&2
95107
[ $? -ne 0 ] && fail_name[${#fail_name[@]}]="${model_path}"
96108
done
97-
if [ ${#fail_name[@]} -ne 0 ]
98-
then
99-
LOG "[FATAL] Failed tests: ${fail_name[@]}"
109+
local failed_cnt=${#fail_name[@]}
110+
if [ ${failed_cnt} -ne 0 ]; then
111+
LOG "[FATAL] Failed tests (${failed_cnt}/${total_models}): ${fail_name[@]}"
100112
echo ${fail_name[@]}
101113
exit -1
114+
else
115+
LOG "[INFO] All paddle sample validations passed (0 failures / ${total_models} total)."
102116
fi
103117
}
104118

@@ -109,8 +123,10 @@ function summary_problems() {
109123
then
110124
LOG "[FATAL] ============================================"
111125
LOG "[FATAL] Summary problems:"
112-
LOG "[FATAL] === API test error - Please fix the failed API tests accroding to fatal log:"
113-
LOG "[FATAL] $check_validation_info"
126+
local failed_list=($check_validation_info)
127+
local failed_count=${#failed_list[@]}
128+
LOG "[FATAL] === API test error (${failed_count} failure(s)) - Please fix the failed API tests according to fatal log:"
129+
LOG "[FATAL] Failed model path(s): $check_validation_info"
114130
exit $check_validation_code
115131
fi
116132
}

0 commit comments

Comments
 (0)