mirror of
https://github.com/mozilla/DeepSpeech.git
synced 2025-10-26 11:19:39 +00:00
getting the outputs shaped correctly
This commit is contained in:
parent
c392f5f3e0
commit
f148dbd23a
41
.compute
41
.compute
@ -2,6 +2,11 @@
|
||||
|
||||
set -xe
|
||||
|
||||
# check HTTP_PROXY
|
||||
if ! (( $( env | grep -iq "^http_proxy=" ) )); then
|
||||
source /etc/profile
|
||||
fi
|
||||
|
||||
apt-get install -y python3-venv
|
||||
python3 -m venv /tmp/venv
|
||||
source /tmp/venv/bin/activate
|
||||
@ -11,28 +16,26 @@ pip install tensorflow-gpu==1.13.0-rc2
|
||||
|
||||
# Install ds_ctcdecoder package from TaskCluster
|
||||
pip install $(python3 util/taskcluster.py --decoder)
|
||||
pip install pandas
|
||||
|
||||
mkdir -p ../keep/summaries
|
||||
|
||||
data="${SHARED_DIR}/data"
|
||||
fis="${data}/LDC/fisher"
|
||||
swb="${data}/LDC/LDC97S62/swb"
|
||||
lbs="${data}/OpenSLR/LibriSpeech/librivox"
|
||||
CV="${SHARED_DIR}/data/mozilla/CommonVoice/v2.0"
|
||||
|
||||
python -u DeepSpeech.py \
|
||||
--notest\
|
||||
--train_welsh\
|
||||
--dev_welsh \
|
||||
--train_kyrgyz\
|
||||
--dev_kyrgyz \
|
||||
--train_batch_size 24 \
|
||||
--dev_batch_size 48 \
|
||||
--test_batch_size 48 \
|
||||
--n_hidden 2048 \
|
||||
--learning_rate 0.0001 \
|
||||
--dropout_rate 0.2 \
|
||||
--epoch 13 \
|
||||
--display_step 0 \
|
||||
--validation_step 1 \
|
||||
--checkpoint_dir "../keep" \
|
||||
--summary_dir "../keep/summaries"
|
||||
--train_welsh "${CV}/cy/clips/train.csv"\
|
||||
--dev_welsh "${CV}/cy/clips/dev.csv"\
|
||||
--train_kyrgyz "${CV}/ky/clips/train.csv"\
|
||||
--dev_kyrgyz "${CV}/ky/clips/dev.csv"\
|
||||
--train_batch_size 24 \
|
||||
--dev_batch_size 48 \
|
||||
--test_batch_size 48 \
|
||||
--n_hidden 2048 \
|
||||
--learning_rate 0.0001 \
|
||||
--dropout_rate 0.2 \
|
||||
--epoch 13 \
|
||||
--display_step 0 \
|
||||
--validation_step 1 \
|
||||
--checkpoint_dir "../keep" \
|
||||
--summary_dir "../keep/summaries"
|
||||
|
||||
@ -16,7 +16,7 @@ import progressbar
|
||||
import shutil
|
||||
import tensorflow as tf
|
||||
import traceback
|
||||
|
||||
import pandas
|
||||
from ds_ctcdecoder import ctc_beam_search_decoder, Scorer
|
||||
from six.moves import zip, range
|
||||
from tensorflow.python.tools import freeze_graph
|
||||
@ -187,11 +187,24 @@ def calculate_mean_edit_distance_and_loss(model_feeder, tower, dropout, reuse):
|
||||
# Calculate the logits of the batch using BiRNN
|
||||
logits, _ = BiRNN(batch_x, batch_seq_len, dropout, reuse)
|
||||
|
||||
# SPECIAL FOR LANG-ID
|
||||
|
||||
batch_shape = tf.shape(batch_x)
|
||||
batch_size = batch_shape[0]
|
||||
n_steps = batch_shape[1]
|
||||
output = logits
|
||||
# permute time and batch
|
||||
output = tf.reshape(output, [n_steps, batch_size, -1])
|
||||
output = tf.transpose(output, [1, 0, 2])
|
||||
output = tf.reshape(output, [batch_size, n_steps, -1])
|
||||
# mean over time steps
|
||||
output = tf.reduce_sum(output, axis=1) / tf.cast(batch_seq_len, tf.float32)
|
||||
total_loss = tf.nn.sigmoid_cross_entropy_with_logits(
|
||||
labels=tf.cast(batch_y, tf.float32), logits=output
|
||||
)
|
||||
|
||||
# Compute the CTC loss using TensorFlow's `ctc_loss`
|
||||
#total_loss = tf.nn.ctc_loss(labels=batch_y, inputs=logits, sequence_length=batch_seq_len)
|
||||
total_loss = tf.nn.sigmoid_cross_entropy_with_logits(
|
||||
labels=tf.cast(batch_y, tf.float32), logits
|
||||
)
|
||||
|
||||
output_probs = tf.sigmoid(output)
|
||||
prediction = tf.cast(output_probs > 0.5, tf.int32)
|
||||
|
||||
@ -10,6 +10,10 @@ def create_flags():
|
||||
# Importer
|
||||
# ========
|
||||
|
||||
tf.app.flags.DEFINE_string ('train_welsh', '', 'comma separated list of files specifying the dataset used for training. multiple files will get merged')
|
||||
tf.app.flags.DEFINE_string ('dev_welsh', '', 'comma separated list of files specifying the dataset used for validation. multiple files will get merged')
|
||||
tf.app.flags.DEFINE_string ('train_kyrgyz', '', 'comma separated list of files specifying the dataset used for training. multiple files will get merged')
|
||||
tf.app.flags.DEFINE_string ('dev_kyrgyz', '', 'comma separated list of files specifying the dataset used for validation. multiple files will get merged')
|
||||
tf.app.flags.DEFINE_string ('train_files', '', 'comma separated list of files specifying the dataset used for training. multiple files will get merged')
|
||||
tf.app.flags.DEFINE_string ('dev_files', '', 'comma separated list of files specifying the dataset used for validation. multiple files will get merged')
|
||||
tf.app.flags.DEFINE_string ('test_files', '', 'comma separated list of files specifying the dataset used for testing. multiple files will get merged')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user