|
| 1 | +#!/bin/bash |
| 2 | +# Script to run deep speech model to achieve the MLPerf target (WER = 0.23) |
| 3 | +# Step 1: download the LibriSpeech dataset. |
| 4 | +echo "Data downloading..." |
| 5 | +python data/download.py |
| 6 | + |
| 7 | +## After data downloading, the dataset directories are: |
| 8 | +train_clean_100="/tmp/librispeech_data/train-clean-100/LibriSpeech/train-clean-100.csv" |
| 9 | +train_clean_360="/tmp/librispeech_data/train-clean-360/LibriSpeech/train-clean-360.csv" |
| 10 | +train_other_500="/tmp/librispeech_data/train-other-500/LibriSpeech/train-other-500.csv" |
| 11 | +dev_clean="/tmp/librispeech_data/dev-clean/LibriSpeech/dev-clean.csv" |
| 12 | +dev_other="/tmp/librispeech_data/dev-other/LibriSpeech/dev-other.csv" |
| 13 | +test_clean="/tmp/librispeech_data/test-clean/LibriSpeech/test-clean.csv" |
| 14 | +test_other="/tmp/librispeech_data/test-other/LibriSpeech/test-other.csv" |
| 15 | + |
| 16 | +# Step 2: generate train dataset and evaluation dataset |
| 17 | +echo "Data preprocessing..." |
| 18 | +train_file="/tmp/librispeech_data/train_dataset.csv" |
| 19 | +eval_file="/tmp/librispeech_data/eval_dataset.csv" |
| 20 | + |
| 21 | +head -1 $train_clean_100 > $train_file |
| 22 | +for filename in $train_clean_100 $train_clean_360 $train_other_500 |
| 23 | +do |
| 24 | + sed 1d $filename >> $train_file |
| 25 | +done |
| 26 | + |
| 27 | +head -1 $dev_clean > $eval_file |
| 28 | +for filename in $dev_clean $dev_other |
| 29 | +do |
| 30 | + sed 1d $filename >> $eval_file |
| 31 | +done |
| 32 | + |
| 33 | +# Step 3: filter out the audio files that exceed max time duration. |
| 34 | +final_train_file="/tmp/librispeech_data/final_train_dataset.csv" |
| 35 | +final_eval_file="/tmp/librispeech_data/final_eval_dataset.csv" |
| 36 | + |
| 37 | +MAX_AUDIO_LEN=27.0 |
| 38 | +awk -v maxlen="$MAX_AUDIO_LEN" 'BEGIN{FS="\t";} NR==1{print $0} NR>1{cmd="soxi -D "$1""; cmd|getline x; if(x<=maxlen) {print $0}; close(cmd);}' $train_file > $final_train_file |
| 39 | +awk -v maxlen="$MAX_AUDIO_LEN" 'BEGIN{FS="\t";} NR==1{print $0} NR>1{cmd="soxi -D "$1""; cmd|getline x; if(x<=maxlen) {print $0}; close(cmd);}' $eval_file > $final_eval_file |
| 40 | + |
| 41 | +# Step 4: run the training and evaluation loop in background, and save the running info to a log file |
| 42 | +echo "Model training and evaluation..." |
| 43 | +start=`date +%s` |
| 44 | + |
| 45 | +log_file=log_`date +%Y-%m-%d` |
| 46 | +nohup python deep_speech.py --train_data_dir=$final_train_file --eval_data_dir=$final_eval_file --num_gpus=-1 --wer_threshold=0.23 --seed=1 >$log_file 2>&1& |
| 47 | + |
| 48 | +end=`date +%s` |
| 49 | +runtime=$((end-start)) |
| 50 | +echo "Model training time is" $runtime "seconds." |
0 commit comments