diff --git a/cloud/pcloud_submit.sh b/cloud/pcloud_submit.sh index 378a7c6e624624af2d3fd004ff41154204a21334..99e458db96b819019628a26f05b3597ea951aeea 100644 --- a/cloud/pcloud_submit.sh +++ b/cloud/pcloud_submit.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash TRAIN_MANIFEST="cloud/cloud_manifests/cloud.manifest.train" DEV_MANIFEST="cloud/cloud_manifests/cloud.manifest.dev" diff --git a/cloud/pcloud_train.sh b/cloud/pcloud_train.sh index d04132f900ef95539acb6cb7e77205d5108d7600..26e537c27da8f9f0827ed917a6cdc45aa4a633e4 100644 --- a/cloud/pcloud_train.sh +++ b/cloud/pcloud_train.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash TRAIN_MANIFEST=$1 DEV_MANIFEST=$2 diff --git a/cloud/pcloud_upload_data.sh b/cloud/pcloud_upload_data.sh index 4ef235ef7da57e5e1f611ddad8b7000528ab46cc..71bb4af19b3b30f6efc31cb9b60f4f3b330b46b9 100644 --- a/cloud/pcloud_upload_data.sh +++ b/cloud/pcloud_upload_data.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash mkdir cloud_manifests diff --git a/deploy/demo_server.py b/deploy/demo_server.py index a7157001cf8ecf766329910350a51bea0f1c5275..7c5584191e73c3326943266ddaa59e369a284c88 100644 --- a/deploy/demo_server.py +++ b/deploy/demo_server.py @@ -100,7 +100,7 @@ class AsrRequestHandler(SocketServer.BaseRequestHandler): finish_time = time.time() print("Response Time: %f, Transcript: %s" % (finish_time - start_time, transcript)) - self.request.sendall(transcript) + self.request.sendall(transcript.encode('utf-8')) def _write_to_file(self, data): # prepare save dir and filename diff --git a/examples/librispeech/run_data.sh b/examples/librispeech/run_data.sh index f65aa233b7868b587e1411a87c9e0a8141a94c91..bdd5abb5891c8af566ed889287248c2f207e59ba 100644 --- a/examples/librispeech/run_data.sh +++ b/examples/librispeech/run_data.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash pushd ../.. > /dev/null diff --git a/examples/librispeech/run_infer.sh b/examples/librispeech/run_infer.sh index 6b790502a536e144d3add3f1f187d3f5e7282888..eb812440be0b106cfaee07e7a5e78310999f9845 100644 --- a/examples/librispeech/run_infer.sh +++ b/examples/librispeech/run_infer.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash pushd ../.. > /dev/null diff --git a/examples/librispeech/run_infer_golden.sh b/examples/librispeech/run_infer_golden.sh index 679bd1bf8a3bffe2c96c27558c105a519a3dbf7d..eeccfdebbc5ab9b964a7b4eb506a7bda0f221ac3 100644 --- a/examples/librispeech/run_infer_golden.sh +++ b/examples/librispeech/run_infer_golden.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash pushd ../.. > /dev/null diff --git a/examples/librispeech/run_test.sh b/examples/librispeech/run_test.sh index 9709234abcf8cb321f38da85183319ccb23d7ae6..7ef06ba9fd17318f153b6048bb59f05eaf16a076 100644 --- a/examples/librispeech/run_test.sh +++ b/examples/librispeech/run_test.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash pushd ../.. > /dev/null diff --git a/examples/librispeech/run_test_golden.sh b/examples/librispeech/run_test_golden.sh index a505cdc79b92156b429b5adc64ab33f7279e6acc..86fe15306acce21268bf7e26b9d34aee9a31901d 100644 --- a/examples/librispeech/run_test_golden.sh +++ b/examples/librispeech/run_test_golden.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash pushd ../.. > /dev/null diff --git a/examples/librispeech/run_train.sh b/examples/librispeech/run_train.sh index 07575dde1240c9491061941bbd9388bb2ab03432..9aa5e0d163b97e10d7b442c97ad786717a1637d1 100644 --- a/examples/librispeech/run_train.sh +++ b/examples/librispeech/run_train.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash pushd ../.. > /dev/null diff --git a/examples/librispeech/run_tune.sh b/examples/librispeech/run_tune.sh index 05c024becab92cf76648b08f1a886733fdb31635..abc28d36630e4e5465250331c2d336999744d571 100644 --- a/examples/librispeech/run_tune.sh +++ b/examples/librispeech/run_tune.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash pushd ../.. > /dev/null diff --git a/examples/mandarin/run_demo_client.sh b/examples/mandarin/run_demo_client.sh index dfde20f8800ffd9bb71ade7c100709adfb814861..bf8e545147233283738af467f4320759b8ac2d75 100644 --- a/examples/mandarin/run_demo_client.sh +++ b/examples/mandarin/run_demo_client.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash pushd ../.. > /dev/null diff --git a/examples/mandarin/run_demo_server.sh b/examples/mandarin/run_demo_server.sh index 703184a6be354e186bb9ff5fa7ceb03c082b7ca0..b0d4bc7f1179fdcb90e3ceef57ec346ba2b9d558 100644 --- a/examples/mandarin/run_demo_server.sh +++ b/examples/mandarin/run_demo_server.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash # TODO: replace the model with a mandarin model pushd ../.. > /dev/null diff --git a/examples/tiny/run_data.sh b/examples/tiny/run_data.sh index 46266daaf66224393a0477c73bd3805330b77692..a98dab21439d3479c18710f8cb7b01ba67b2ca8f 100644 --- a/examples/tiny/run_data.sh +++ b/examples/tiny/run_data.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash pushd ../.. > /dev/null diff --git a/examples/tiny/run_infer.sh b/examples/tiny/run_infer.sh index 1d33bfbba2668d2f9cf5cb2518a5dcb26a34b3c0..dafc99d9c5828e8084cfc4a74a92395a0be09167 100644 --- a/examples/tiny/run_infer.sh +++ b/examples/tiny/run_infer.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash pushd ../.. > /dev/null diff --git a/examples/tiny/run_infer_golden.sh b/examples/tiny/run_infer_golden.sh index 32e9d8623fb53db8b1dc0f8129167c8d53d265d8..66360a6917d35140f9ad55190003c468ab511add 100644 --- a/examples/tiny/run_infer_golden.sh +++ b/examples/tiny/run_infer_golden.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash pushd ../.. > /dev/null diff --git a/examples/tiny/run_test.sh b/examples/tiny/run_test.sh index f9c3cc11ce1257bbef10211796757ce877b81db7..70cf4bfe2e4fc3f23b7ca96e2b161e4ff35443d9 100644 --- a/examples/tiny/run_test.sh +++ b/examples/tiny/run_test.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash pushd ../.. > /dev/null diff --git a/examples/tiny/run_test_golden.sh b/examples/tiny/run_test_golden.sh index 080c3c0622d62169d63f0e1f1bf3d9ceb7d24da0..e188c81b3ffecccd6331be2a4016b21de3ccc572 100644 --- a/examples/tiny/run_test_golden.sh +++ b/examples/tiny/run_test_golden.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash pushd ../.. > /dev/null diff --git a/examples/tiny/run_train.sh b/examples/tiny/run_train.sh index 74d82712e6e2e812da0b22552654d1ef7eadffbb..3c2b8a1e01ed9b67ec1fe420d3a7a74af8c73f4a 100644 --- a/examples/tiny/run_train.sh +++ b/examples/tiny/run_train.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash pushd ../.. > /dev/null diff --git a/examples/tiny/run_tune.sh b/examples/tiny/run_tune.sh index 360c11d596db6c01ad76ab2c81a8aa10776f7cc4..926e9f8d5aecda7924c8a098d4a33f9c1c77a3dd 100644 --- a/examples/tiny/run_tune.sh +++ b/examples/tiny/run_tune.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash pushd ../.. > /dev/null diff --git a/model_utils/model.py b/model_utils/model.py index cf146f8ce988c528b8b61127562327e11aadff6b..09ee3c7615df6e87cd7f3fee9ae0ccd8bf9a9e3c 100644 --- a/model_utils/model.py +++ b/model_utils/model.py @@ -7,6 +7,7 @@ import sys import os import time import gzip +from distutils.dir_util import mkpath import paddle.v2 as paddle from model_utils.lm_scorer import LmScorer from model_utils.decoder import ctc_greedy_decoder, ctc_beam_search_decoder @@ -79,7 +80,7 @@ class DeepSpeech2Model(object): """ # prepare model output directory if not os.path.exists(output_model_dir): - os.mkdir(output_model_dir) + mkpath(output_model_dir) # prepare optimizer and trainer optimizer = paddle.optimizer.Adam( diff --git a/models/aishell/download_model.sh b/models/aishell/download_model.sh index 4368ee55af8c062c2ac5d7e1bcc56d086a186887..77fc84b5322d2301ae8bc8caabed7c27dd5f932d 100644 --- a/models/aishell/download_model.sh +++ b/models/aishell/download_model.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash source ../../utils/utility.sh diff --git a/models/librispeech/download_model.sh b/models/librispeech/download_model.sh index b5fcd7d8c133ea27d1f10d90b8d09e15821a220e..336502de87d77459063d1eaec8060a22a040b469 100644 --- a/models/librispeech/download_model.sh +++ b/models/librispeech/download_model.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash source ../../utils/utility.sh diff --git a/models/lm/download_lm_ch.sh b/models/lm/download_lm_ch.sh index 7f1c47a27641cb07e4ab638b2949e667abcc473d..46bfe9329949fb0b9d579e09c8b77bc68c73776a 100644 --- a/models/lm/download_lm_ch.sh +++ b/models/lm/download_lm_ch.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash source ../../utils/utility.sh diff --git a/models/lm/download_lm_en.sh b/models/lm/download_lm_en.sh index e967e25dc4c383276a1c8c93b3124081e80ad57b..fbfe647e9ece114f09fffee26aa427c489c9ee35 100644 --- a/models/lm/download_lm_en.sh +++ b/models/lm/download_lm_en.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#! /usr/bin/env bash source ../../utils/utility.sh diff --git a/setup.sh b/setup.sh index 6c8a709941ae94124149482f1886bf445c170af8..15c6e1e25ef19cca02a80d80af05ceeb55658d09 100644 --- a/setup.sh +++ b/setup.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#! /usr/bin/env bash # install python dependencies if [ -f "requirements.txt" ]; then