Merge pull request #2982 from mozilla/node-tflite-stream-tests

Run streaming tests in Node TFLite tasks too
This commit is contained in:
Reuben Morais 2020-05-12 16:01:26 +02:00 committed by GitHub
commit e23390eb89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 8 deletions

View File

@ -42,10 +42,14 @@ assert_correct_inference()
else
echo "!! Non matching output !!"
echo "got: <${phrase}>"
echo "xxd:"; echo "${phrase}" | xxd
if [ -x "$(command -v xxd)" ]; then
echo "xxd:"; echo "${phrase}" | xxd
fi
echo "-------------------"
echo "expected: <${expected}>"
echo "xxd:"; echo "${expected}" | xxd
if [ -x "$(command -v xxd)" ]; then
echo "xxd:"; echo "${expected}" | xxd
fi
return 1
fi;
}
@ -89,10 +93,14 @@ assert_working_inference()
*)
echo "!! Non matching output !!"
echo "got: <${phrase}>"
echo "xxd:"; echo "${phrase}" | xxd
if [ -x "$(command -v xxd)" ]; then
echo "xxd:"; echo "${phrase}" | xxd
fi
echo "-------------------"
echo "expected: <${expected}>"
echo "xxd:"; echo "${expected}" | xxd
if [ -x "$(command -v xxd)" ]; then
echo "xxd:"; echo "${expected}" | xxd
fi
return 1
;;
esac
@ -125,10 +133,14 @@ assert_shows_something()
*)
echo "!! Non matching output !!"
echo "got: <${stderr}>"
echo "xxd:"; echo "${stderr}" | xxd
if [ -x "$(command -v xxd)" ]; then
echo "xxd:"; echo "${stderr}" | xxd
fi
echo "-------------------"
echo "expected: <${expected}>"
echo "xxd:"; echo "${expected}" | xxd
if [ -x "$(command -v xxd)" ]; then
echo "xxd:"; echo "${expected}" | xxd
fi
return 1
;;
esac
@ -150,10 +162,14 @@ assert_not_present()
*${not_expected}*)
echo "!! Not expected was present !!"
echo "got: <${stderr}>"
echo "xxd:"; echo "${stderr}" | xxd
if [ -x "$(command -v xxd)" ]; then
echo "xxd:"; echo "${stderr}" | xxd
fi
echo "-------------------"
echo "not_expected: <${not_expected}>"
echo "xxd:"; echo "${not_expected}" | xxd
if [ -x "$(command -v xxd)" ]; then
echo "xxd:"; echo "${not_expected}" | xxd
fi
return 1
;;
@ -543,3 +559,20 @@ run_js_streaming_prod_inference_tests()
set -e
assert_correct_ldc93s1_prodmodel "${phrase_pbmodel_withlm}" "$status" "${_bitrate}"
}
run_js_streaming_prodtflite_inference_tests()
{
local _bitrate=$1
set +e
phrase_pbmodel_withlm=$(deepspeech --model ${TASKCLUSTER_TMP_DIR}/${model_name_mmap} --scorer ${TASKCLUSTER_TMP_DIR}/kenlm.scorer --audio ${TASKCLUSTER_TMP_DIR}/${ldc93s1_sample_filename} --stream 2>${TASKCLUSTER_TMP_DIR}/stderr | tail -n 1)
status=$?
set -e
assert_correct_ldc93s1_prodtflitemodel "${phrase_pbmodel_withlm}" "$status" "${_bitrate}"
local _bitrate=$1
set +e
phrase_pbmodel_withlm=$(deepspeech --model ${TASKCLUSTER_TMP_DIR}/${model_name_mmap} --scorer ${TASKCLUSTER_TMP_DIR}/kenlm.scorer --audio ${TASKCLUSTER_TMP_DIR}/${ldc93s1_sample_filename} --stream --extended 2>${TASKCLUSTER_TMP_DIR}/stderr | tail -n 1)
status=$?
set -e
assert_correct_ldc93s1_prodtflitemodel "${phrase_pbmodel_withlm}" "$status" "${_bitrate}"
}

View File

@ -36,3 +36,5 @@ npm install --prefix ${NODE_ROOT} --cache ${NODE_CACHE} ${deepspeech_npm_url}
check_runtime_nodejs
run_prodtflite_inference_tests "${bitrate}"
run_js_streaming_prodtflite_inference_tests "${bitrate}"

View File

@ -34,3 +34,5 @@ npm install --prefix ${NODE_ROOT} --cache ${NODE_CACHE} ${deepspeech_npm_url}
check_runtime_nodejs
run_all_inference_tests
run_js_streaming_inference_tests