Skip to content

Commit

Permalink
Merge pull request #219 from xinghai-sun/network_bug
Browse files Browse the repository at this point in the history
Fixed a serious error of bidirectional simple rnn for DS2.
  • Loading branch information
lcy-seso committed Sep 2, 2017
2 parents a249993 + 5033920 commit fab7514
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions deep_speech_2/cloud/pcloud_submit.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
TRAIN_MANIFEST="cloud/cloud.manifest.train"
DEV_MANIFEST="cloud/cloud.manifest.dev"
CLOUD_MODEL_DIR="/pfs/dlnel/home/USERNAME/deepspeech2/model"
CLOUD_MODEL_DIR="./checkpoints"
BATCH_SIZE=256
NUM_GPU=8
NUM_NODE=1
Expand All @@ -11,7 +11,7 @@ DS2_PATH=${PWD%/*}
cp -f pcloud_train.sh ${DS2_PATH}

paddlecloud submit \
-image bootstrapper:5000/wanghaoshuang/pcloud_ds2:latest \
-image bootstrapper:5000/paddlepaddle/pcloud_ds2:latest \
-jobname ${JOB_NAME} \
-cpu ${NUM_GPU} \
-gpu ${NUM_GPU} \
Expand Down
16 changes: 10 additions & 6 deletions deep_speech_2/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,20 @@ def bidirectional_simple_rnn_bn_layer(name, input, size, act):
:rtype: LayerOutput
"""
# 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)
# batch norm is only performed on input-state projection
input_proj_bn = paddle.layer.batch_norm(
input=input_proj, act=paddle.activation.Linear())
input_proj_backward = paddle.layer.fc(
input=input, size=size, act=paddle.activation.Linear(), bias_attr=False)
# batch norm is only performed on input-state projection
input_proj_bn_forward = paddle.layer.batch_norm(
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_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(
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])


Expand Down

0 comments on commit fab7514

Please sign in to comment.