forked from apache/mxnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request apache#6 from sergeykolychev/visualization
Support for Visualization
- Loading branch information
Showing
49 changed files
with
2,195 additions
and
961 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,3 +142,6 @@ tools/pip_package/mxnet | |
|
||
# temporary path for building dependencies when building wheel | ||
deps/ | ||
|
||
*.jar | ||
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,7 @@ addons: | |
- pdl | ||
- cpanminus | ||
- swig | ||
- libgraphviz-perl | ||
|
||
before_install: | ||
- export NVCC_PREFIX=${HOME} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
[data] | ||
kaldi_root = | ||
train = /home/sooda/speech/kaldi/egs/timit/s5/data/train/train.feats | ||
dev = /home/sooda/speech/kaldi/egs/timit/s5/data/dev/dev.feats | ||
test = | ||
out_file = | | ||
format = kaldi | ||
xdim = 13 | ||
ydim = 1939 | ||
#ydim = 1909 | ||
label_mean = label_mean.feats | ||
[arch] | ||
num_hidden = 1024 | ||
# set it to zero if you want a regular LSTM | ||
num_hidden_proj = 512 | ||
num_lstm_layer = 3 | ||
|
||
[train] | ||
batch_size = 40 | ||
buckets = 100, 200, 300, 400, 500, 600, 700, 800 | ||
num_epoch = 12 | ||
|
||
# used only if method is truncated-bptt | ||
truncate_len = 20 | ||
|
||
# gpu0, gpu1 | ||
context = gpu0 | ||
|
||
# bucketing, truncated-bptt | ||
method = truncated-bptt | ||
#method = bucketing | ||
|
||
# checkpoint prefix | ||
prefix = timit | ||
|
||
learning_rate = 1 | ||
decay_factor = 2 | ||
decay_lower_bound = 1e-6 | ||
|
||
optimizer = speechSGD | ||
momentum = 0.9 | ||
|
||
# set to 0 to disable gradient clipping | ||
clip_gradient = 0 | ||
|
||
# uniform, normal, xavier | ||
initializer = Uniform | ||
init_scale = 0.05 | ||
weight_decay = 0.008 | ||
|
||
# show progress every how many batches | ||
show_every = 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
#!/bin/bash | ||
|
||
# This script trains and evaluate LSTM models. There is no | ||
# discriminative training yet. | ||
# In this recipe, MXNet directly read Kaldi features and labels, | ||
# which makes the whole pipline much simpler. | ||
|
||
set -e #Exit on non-zero return code from any command | ||
set -o pipefail #Exit if any of the commands in the pipeline will | ||
#return non-zero return code | ||
set -u #Fail on an undefined variable | ||
|
||
. ./cmd.sh | ||
. ./path.sh | ||
|
||
cmd=run.pl | ||
# root folder, | ||
expdir=exp_timit | ||
|
||
################################################## | ||
# Kaldi generated folder | ||
################################################## | ||
|
||
# alignment folder | ||
ali_src=/home/sooda/speech/kaldi/egs/timit/s5/exp/tri3_ali | ||
|
||
# decoding graph | ||
graph_src=/home/sooda/speech/kaldi/egs/timit/s5/exp/tri3/graph | ||
|
||
# features | ||
train_src=/home/sooda/speech/kaldi/egs/timit/s5/data/train | ||
dev_src=/home/sooda/speech/kaldi/egs/timit/s5/data/dev | ||
|
||
# config file | ||
config=default_timit.cfg | ||
# optional settings, | ||
njdec=8 | ||
scoring="--min-lmwt 5 --max-lmwt 19" | ||
|
||
# The device number to run the training | ||
# change to AUTO to select the card automatically | ||
deviceNumber=gpu0 | ||
|
||
# decoding method | ||
method=simple | ||
modelName= | ||
# model | ||
prefix=timit | ||
num_epoch=12 | ||
acwt=0.1 | ||
#smbr training variables | ||
num_utts_per_iter=40 | ||
smooth_factor=0.1 | ||
use_one_sil=true | ||
|
||
stage=4 | ||
. utils/parse_options.sh || exit 1; | ||
|
||
|
||
############################################### | ||
# Training | ||
############################################### | ||
|
||
mkdir -p $expdir | ||
dir=$expdir/data-for-mxnet | ||
|
||
# prepare listing data | ||
if [ $stage -le 0 ] ; then | ||
mkdir -p $dir | ||
mkdir -p $dir/log | ||
mkdir -p $dir/rawpost | ||
|
||
# for compressed ali | ||
num=`cat $ali_src/num_jobs` | ||
$cmd JOB=1:$num $dir/log/gen_post.JOB.log \ | ||
ali-to-pdf $ali_src/final.mdl "ark:gunzip -c $ali_src/ali.JOB.gz |" \ | ||
ark:- \| ali-to-post ark:- ark,scp:$dir/rawpost/post.JOB.ark,$dir/rawpost/post.JOB.scp || exit 1; | ||
#num=`cat $ali_src/num_jobs` | ||
#$cmd JOB=1:$num $dir/log/gen_post.JOB.log \ | ||
# ali-to-pdf $ali_src/final.mdl ark:$ali_src/ali.JOB.ark \ | ||
# ark:- \| ali-to-post ark:- ark,scp:$dir/rawpost/post.JOB.ark,$dir/rawpost/post.JOB.scp || exit 1; | ||
|
||
|
||
for n in $(seq $num); do | ||
cat $dir/rawpost/post.${n}.scp || exit 1; | ||
done > $dir/post.scp | ||
fi | ||
|
||
if [ $stage -le 1 ] ; then | ||
# split the data : 90% train and 10% held-out | ||
[ ! -e ${train_src}_tr90 ] && utils/subset_data_dir_tr_cv.sh $train_src ${train_src}_tr90 ${train_src}_cv10 | ||
|
||
# generate dataset list | ||
echo NO_FEATURE_TRANSFORM scp:${train_src}_tr90/feats.scp > $dir/train.feats | ||
echo scp:$dir/post.scp >> $dir/train.feats | ||
|
||
echo NO_FEATURE_TRANSFORM scp:${train_src}_cv10/feats.scp > $dir/dev.feats | ||
echo scp:$dir/post.scp >> $dir/dev.feats | ||
|
||
echo NO_FEATURE_TRANSFORM scp:${dev_src}/feats.scp > $dir/test.feats | ||
fi | ||
|
||
# generate label counts | ||
if [ $stage -le 2 ] ; then | ||
$cmd JOB=1:1 $dir/log/gen_label_mean.JOB.log \ | ||
python make_stats.py --configfile $config --data_train $dir/train.feats \| copy-feats ark:- ark:$dir/label_mean.ark | ||
echo NO_FEATURE_TRANSFORM ark:$dir/label_mean.ark > $dir/label_mean.feats | ||
fi | ||
|
||
|
||
# training, note that weight decay is for the whole batch (0.00001 * 20 (minibatch) * 40 (batch_size)) | ||
if [ $stage -le 3 ] ; then | ||
python train_lstm_proj.py --configfile $config --data_train $dir/train.feats --data_dev $dir/dev.feats --train_prefix $PWD/$expdir/$prefix --train_optimizer speechSGD --train_learning_rate 1 --train_context $deviceNumber --train_weight_decay 0.008 --train_show_every 1000 | ||
fi | ||
|
||
# decoding | ||
if [ $stage -le 4 ] ; then | ||
cp $ali_src/final.mdl $expdir | ||
mxnet_string="OMP_NUM_THREADS=1 python decode_mxnet.py --config $config --data_test $dir/test.feats --data_label_mean $dir/label_mean.feats --train_method $method --train_prefix $PWD/$expdir/$prefix --train_num_epoch $num_epoch --train_context cpu0 --train_batch_size 1" | ||
./decode_mxnet.sh --nj $njdec --cmd $cmd --acwt $acwt --scoring-opts "$scoring" \ | ||
$graph_src $dev_src $expdir/decode_${prefix}_$(basename $dev_src) "$mxnet_string" || exit 1; | ||
|
||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.