Merge branch 'develop' into network_structure

pull/2/head
Xinghai Sun 7 years ago
commit c8530dbbe8

@ -1,6 +1,6 @@
TRAIN_MANIFEST="cloud/cloud.manifest.train" TRAIN_MANIFEST="cloud/cloud.manifest.train"
DEV_MANIFEST="cloud/cloud.manifest.dev" DEV_MANIFEST="cloud/cloud.manifest.dev"
CLOUD_MODEL_DIR="/pfs/dlnel/home/USERNAME/deepspeech2/model" CLOUD_MODEL_DIR="./checkpoints"
BATCH_SIZE=256 BATCH_SIZE=256
NUM_GPU=8 NUM_GPU=8
NUM_NODE=1 NUM_NODE=1
@ -11,7 +11,7 @@ DS2_PATH=${PWD%/*}
cp -f pcloud_train.sh ${DS2_PATH} cp -f pcloud_train.sh ${DS2_PATH}
paddlecloud submit \ paddlecloud submit \
-image bootstrapper:5000/wanghaoshuang/pcloud_ds2:latest \ -image bootstrapper:5000/paddlepaddle/pcloud_ds2:latest \
-jobname ${JOB_NAME} \ -jobname ${JOB_NAME} \
-cpu ${NUM_GPU} \ -cpu ${NUM_GPU} \
-gpu ${NUM_GPU} \ -gpu ${NUM_GPU} \

@ -85,9 +85,9 @@ class DataGenerator(object):
self._rng = random.Random(random_seed) self._rng = random.Random(random_seed)
self._epoch = 0 self._epoch = 0
# for caching tar files info # for caching tar files info
self.local_data = local() self._local_data = local()
self.local_data.tar2info = {} self._local_data.tar2info = {}
self.local_data.tar2object = {} self._local_data.tar2object = {}
def process_utterance(self, filename, transcript): def process_utterance(self, filename, transcript):
"""Load, augment, featurize and normalize for speech data. """Load, augment, featurize and normalize for speech data.
@ -240,16 +240,16 @@ class DataGenerator(object):
""" """
if file.startswith('tar:'): if file.startswith('tar:'):
tarpath, filename = file.split(':', 1)[1].split('#', 1) tarpath, filename = file.split(':', 1)[1].split('#', 1)
if 'tar2info' not in self.local_data.__dict__: if 'tar2info' not in self._local_data.__dict__:
self.local_data.tar2info = {} self._local_data.tar2info = {}
if 'tar2object' not in self.local_data.__dict__: if 'tar2object' not in self._local_data.__dict__:
self.local_data.tar2object = {} self._local_data.tar2object = {}
if tarpath not in self.local_data.tar2info: if tarpath not in self._local_data.tar2info:
object, infoes = self._parse_tar(tarpath) object, infoes = self._parse_tar(tarpath)
self.local_data.tar2info[tarpath] = infoes self._local_data.tar2info[tarpath] = infoes
self.local_data.tar2object[tarpath] = object self._local_data.tar2object[tarpath] = object
return self.local_data.tar2object[tarpath].extractfile( return self._local_data.tar2object[tarpath].extractfile(
self.local_data.tar2info[tarpath][filename]) self._local_data.tar2info[tarpath][filename])
else: else:
return open(file, 'r') return open(file, 'r')

@ -57,7 +57,7 @@ class AudioFeaturizer(object):
def featurize(self, def featurize(self,
audio_segment, audio_segment,
allow_downsampling=True, allow_downsampling=True,
allow_upsamplling=True): allow_upsampling=True):
"""Extract audio features from AudioSegment or SpeechSegment. """Extract audio features from AudioSegment or SpeechSegment.
:param audio_segment: Audio/speech segment to extract features from. :param audio_segment: Audio/speech segment to extract features from.

@ -55,16 +55,20 @@ def bidirectional_simple_rnn_bn_layer(name, input, size, act):
:rtype: LayerOutput :rtype: LayerOutput
""" """
# input-hidden weights shared across bi-direcitonal rnn. # input-hidden weights shared across bi-direcitonal rnn.
input_proj = paddle.layer.fc( input_proj_forward = paddle.layer.fc(
input=input, size=size, act=paddle.activation.Linear(), bias_attr=False)
input_proj_backward = paddle.layer.fc(
input=input, size=size, act=paddle.activation.Linear(), bias_attr=False) input=input, size=size, act=paddle.activation.Linear(), bias_attr=False)
# batch norm is only performed on input-state projection # batch norm is only performed on input-state projection
input_proj_bn = paddle.layer.batch_norm( input_proj_bn_forward = paddle.layer.batch_norm(
input=input_proj, act=paddle.activation.Linear()) input=input_proj_forward, act=paddle.activation.Linear())
input_proj_bn_backward = paddle.layer.batch_norm(
input=input_proj_backward, act=paddle.activation.Linear())
# forward and backward in time # forward and backward in time
forward_simple_rnn = paddle.layer.recurrent( forward_simple_rnn = paddle.layer.recurrent(
input=input_proj_bn, act=act, reverse=False) input=input_proj_bn_forward, act=act, reverse=False)
backward_simple_rnn = paddle.layer.recurrent( backward_simple_rnn = paddle.layer.recurrent(
input=input_proj_bn, act=act, reverse=True) input=input_proj_bn_backward, act=act, reverse=True)
return paddle.layer.concat(input=[forward_simple_rnn, backward_simple_rnn]) return paddle.layer.concat(input=[forward_simple_rnn, backward_simple_rnn])

Loading…
Cancel
Save