Fix a python3 compatibility issue in shell scripts
Change: 122737159
This commit is contained in:
parent
cce41d3fa3
commit
e55e45aef7
@ -120,8 +120,8 @@ test_mnist_softmax() {
|
|||||||
|
|
||||||
# Check final accuracy
|
# Check final accuracy
|
||||||
FINAL_ACCURACY=$(tail -1 "${LOG_FILE}")
|
FINAL_ACCURACY=$(tail -1 "${LOG_FILE}")
|
||||||
if [[ $(python -c "print ${FINAL_ACCURACY}>0.85") != "True" ]] ||
|
if [[ $(python -c "print(${FINAL_ACCURACY}>0.85)") != "True" ]] ||
|
||||||
[[ $(python -c "print ${FINAL_ACCURACY}<=1.00") != "True" ]]; then
|
[[ $(python -c "print(${FINAL_ACCURACY}<=1.00)") != "True" ]]; then
|
||||||
echo "mnist_softmax accuracy check FAILED: "\
|
echo "mnist_softmax accuracy check FAILED: "\
|
||||||
"FINAL_ACCURACY = ${FINAL_ACCURACY}"
|
"FINAL_ACCURACY = ${FINAL_ACCURACY}"
|
||||||
return 1
|
return 1
|
||||||
@ -150,8 +150,8 @@ test_mnist_with_summaries() {
|
|||||||
|
|
||||||
# Verify final accuracy
|
# Verify final accuracy
|
||||||
FINAL_ACCURACY=$(tail -1 "${LOG_FILE}" | awk '{print $NF}')
|
FINAL_ACCURACY=$(tail -1 "${LOG_FILE}" | awk '{print $NF}')
|
||||||
if [[ $(python -c "print ${FINAL_ACCURACY}>0.85") != "True" ]] ||
|
if [[ $(python -c "print(${FINAL_ACCURACY}>0.85)") != "True" ]] ||
|
||||||
[[ $(python -c "print ${FINAL_ACCURACY}<=1.00") != "True" ]]; then
|
[[ $(python -c "print(${FINAL_ACCURACY}<=1.00)") != "True" ]]; then
|
||||||
echo "mnist_with_summaries accuracy check FAILED: ${FINAL_ACCURACY}<0.90"
|
echo "mnist_with_summaries accuracy check FAILED: ${FINAL_ACCURACY}<0.90"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -188,9 +188,9 @@ test_cifar10_train() {
|
|||||||
FINAL_LOSS=$(grep -o "loss = [0-9\.]*" "${LOG_FILE}" | tail -1 | \
|
FINAL_LOSS=$(grep -o "loss = [0-9\.]*" "${LOG_FILE}" | tail -1 | \
|
||||||
awk '{print $NF}')
|
awk '{print $NF}')
|
||||||
|
|
||||||
if [[ $(python -c "print ${FINAL_LOSS}<${INIT_LOSS}") != "True" ]] ||
|
if [[ $(python -c "print(${FINAL_LOSS}<${INIT_LOSS})") != "True" ]] ||
|
||||||
[[ $(python -c "print ${INIT_LOSS}>=0") != "True" ]] ||
|
[[ $(python -c "print(${INIT_LOSS}>=0)") != "True" ]] ||
|
||||||
[[ $(python -c "print ${FINAL_LOSS}>=0") != "True" ]]; then
|
[[ $(python -c "print(${FINAL_LOSS}>=0)") != "True" ]]; then
|
||||||
echo "cifar10_train loss check FAILED: "\
|
echo "cifar10_train loss check FAILED: "\
|
||||||
"FINAL_LOSS = ${FINAL_LOSS}; INIT_LOSS = ${INIT_LOSS}"
|
"FINAL_LOSS = ${FINAL_LOSS}; INIT_LOSS = ${INIT_LOSS}"
|
||||||
return 1
|
return 1
|
||||||
@ -269,9 +269,9 @@ test_ptb_word_lm() {
|
|||||||
echo "INIT_PERPL=${INIT_PERPL}"
|
echo "INIT_PERPL=${INIT_PERPL}"
|
||||||
echo "FINAL_PERPL=${FINAL_PERPL}"
|
echo "FINAL_PERPL=${FINAL_PERPL}"
|
||||||
|
|
||||||
if [[ $(python -c "print ${FINAL_PERPL}<${INIT_PERPL}") != "True" ]] ||
|
if [[ $(python -c "print(${FINAL_PERPL}<${INIT_PERPL})") != "True" ]] ||
|
||||||
[[ $(python -c "print ${INIT_PERPL}>=0") != "True" ]] ||
|
[[ $(python -c "print(${INIT_PERPL}>=0)") != "True" ]] ||
|
||||||
[[ $(python -c "print ${FINAL_PERPL}>=0") != "True" ]]; then
|
[[ $(python -c "print(${FINAL_PERPL}>=0)") != "True" ]]; then
|
||||||
echo "ptb_word_lm perplexity check FAILED: "\
|
echo "ptb_word_lm perplexity check FAILED: "\
|
||||||
"FINAL_PERPL = ${FINAL_PERPL}; INIT_PERPL = ${INIT_PERPL}"
|
"FINAL_PERPL = ${FINAL_PERPL}; INIT_PERPL = ${INIT_PERPL}"
|
||||||
return 1
|
return 1
|
||||||
|
@ -188,9 +188,9 @@ VAL_XENT=$(get_final_val_xent "${WKR_LOG_PREFIX}0.log")
|
|||||||
# Sanity check on the validation entropies
|
# Sanity check on the validation entropies
|
||||||
# TODO(cais): In addition to this basic sanity check, we could run the training
|
# TODO(cais): In addition to this basic sanity check, we could run the training
|
||||||
# with 1 and 2 workers, each for a few times and use scipy.stats to do a t-test
|
# with 1 and 2 workers, each for a few times and use scipy.stats to do a t-test
|
||||||
# to verify tha tthe 2-worker training gives significantly lower final cross
|
# to verify that the 2-worker training gives significantly lower final cross
|
||||||
# entropy
|
# entropy
|
||||||
echo "Final validation cross entropy from worker0: ${VAL_XENT}"
|
echo "Final validation cross entropy from worker0: ${VAL_XENT}"
|
||||||
if [[ $(python -c "print ${VAL_XENT}>0") != "True" ]]; then
|
if [[ $(python -c "print(${VAL_XENT}>0)") != "True" ]]; then
|
||||||
die "Sanity checks on the final validation cross entropy values FAILED"
|
die "Sanity checks on the final validation cross entropy values FAILED"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user