mirror of
https://github.com/mozilla/DeepSpeech.git
synced 2025-10-26 11:19:39 +00:00
Merge pull request #1639 from mozilla/issue1638
Fixed #1638 (Update Hyperparameters for 0.3.0)
This commit is contained in:
commit
9fa29935cf
@ -162,7 +162,7 @@ def create_flags():
|
||||
tf.app.flags.DEFINE_string ('lm_trie_path', 'data/lm/trie', 'path to the language model trie file created with native_client/generate_trie')
|
||||
tf.app.flags.DEFINE_integer ('beam_width', 1024, 'beam width used in the CTC decoder when building candidate transcriptions')
|
||||
tf.app.flags.DEFINE_float ('lm_weight', 1.50, 'the alpha hyperparameter of the CTC decoder. Language Model weight.')
|
||||
tf.app.flags.DEFINE_float ('valid_word_count_weight', 2.25, 'valid word insertion weight. This is used to lessen the word insertion penalty when the inserted word is part of the vocabulary.')
|
||||
tf.app.flags.DEFINE_float ('valid_word_count_weight', 2.10, 'valid word insertion weight. This is used to lessen the word insertion penalty when the inserted word is part of the vocabulary.')
|
||||
|
||||
# Inference mode
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ python -u DeepSpeech.py \
|
||||
--train_files ${ldc93s1_csv} --train_batch_size 1 \
|
||||
--dev_files ${ldc93s1_csv} --dev_batch_size 1 \
|
||||
--test_files ${ldc93s1_csv} --test_batch_size 1 \
|
||||
--n_hidden 494 --epoch 85 --random_seed 4567 --default_stddev 0.046875 \
|
||||
--n_hidden 494 --epoch 105 --random_seed 4567 --default_stddev 0.046875 \
|
||||
--max_to_keep 1 --checkpoint_dir '/tmp/ckpt' --checkpoint_secs 0 \
|
||||
--learning_rate 0.001 --dropout_rate 0.05 --export_dir '/tmp/train' \
|
||||
--decoder_library_path '/tmp/ds/libctc_decoder_with_kenlm.so' \
|
||||
|
||||
@ -19,8 +19,8 @@ def load_model(models, alphabet, lm, trie):
|
||||
N_FEATURES = 26
|
||||
N_CONTEXT = 9
|
||||
BEAM_WIDTH = 500
|
||||
LM_WEIGHT = 1.75
|
||||
VALID_WORD_COUNT_WEIGHT = 1.00
|
||||
LM_WEIGHT = 1.50
|
||||
VALID_WORD_COUNT_WEIGHT = 2.10
|
||||
|
||||
model_load_start = timer()
|
||||
ds = Model(models, N_FEATURES, N_CONTEXT, alphabet, BEAM_WIDTH)
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
#define N_CONTEXT 9
|
||||
#define BEAM_WIDTH 500
|
||||
#define LM_WEIGHT 1.50f
|
||||
#define VALID_WORD_COUNT_WEIGHT 2.25f
|
||||
#define VALID_WORD_COUNT_WEIGHT 2.10f
|
||||
|
||||
typedef struct {
|
||||
const char* string;
|
||||
|
||||
@ -19,7 +19,7 @@ const LM_WEIGHT = 1.50;
|
||||
|
||||
// Valid word insertion weight. This is used to lessen the word insertion penalty
|
||||
// when the inserted word is part of the vocabulary
|
||||
const VALID_WORD_COUNT_WEIGHT = 2.25;
|
||||
const VALID_WORD_COUNT_WEIGHT = 2.10;
|
||||
|
||||
|
||||
// These constants are tied to the shape of the graph used (changing them changes
|
||||
|
||||
@ -27,7 +27,7 @@ LM_WEIGHT = 1.50
|
||||
|
||||
# Valid word insertion weight. This is used to lessen the word insertion penalty
|
||||
# when the inserted word is part of the vocabulary
|
||||
VALID_WORD_COUNT_WEIGHT = 2.25
|
||||
VALID_WORD_COUNT_WEIGHT = 2.10
|
||||
|
||||
|
||||
# These constants are tied to the shape of the graph used (changing them changes
|
||||
|
||||
@ -135,26 +135,30 @@ assert_shows_something()
|
||||
|
||||
assert_correct_ldc93s1()
|
||||
{
|
||||
# FIXME: RE-ENABLE AFTER FIXING LM HYPERPARAMETERS
|
||||
# assert_correct_inference "$1" "she had your dark suit in greasy wash water all year"
|
||||
assert_working_inference "$1" "she had"
|
||||
assert_correct_inference "$1" "she had your dark suit in greasy wash water all year"
|
||||
}
|
||||
|
||||
assert_correct_ldc93s1_lm()
|
||||
{
|
||||
assert_correct_inference "$1" "she had your dark suit in greasy wash water all year"
|
||||
}
|
||||
|
||||
assert_correct_multi_ldc93s1()
|
||||
{
|
||||
# FIXME: RE-ENABLE AFTER FIXING LM HYPERPARAMETERS
|
||||
#assert_shows_something "$1" "/LDC93S1.wav%she had your dark suit in greasy wash water all year%"
|
||||
#assert_shows_something "$1" "/LDC93S1_pcms16le_2_44100.wav%she had your dark suit in greasy wash water all year%"
|
||||
return 0
|
||||
assert_shows_something "$1" "/LDC93S1.wav%she had your dark suit in greasy wash water all year%"
|
||||
assert_shows_something "$1" "/LDC93S1_pcms16le_2_44100.wav%she had your dark suit in greasy wash water all year%"
|
||||
## 8k will output garbage anyway ...
|
||||
# assert_shows_something "$1" "/LDC93S1_pcms16le_1_8000.wav%she hayorasryrtl lyreasy asr watal w water all year%"
|
||||
}
|
||||
|
||||
assert_correct_ldc93s1_prodmodel()
|
||||
{
|
||||
# FIXME: RE-ENABLE AFTER FIXING LM HYPERPARAMETERS
|
||||
#assert_correct_inference "$1" "she had tired or so and greasy wash war or year"
|
||||
assert_working_inference "$1" "she had"
|
||||
assert_correct_inference "$1" "she hadered or so and greasy wash war or year"
|
||||
}
|
||||
|
||||
assert_correct_ldc93s1_prodmodel_stereo_44k()
|
||||
{
|
||||
assert_correct_inference "$1" "she had tered or so and greasy wash war or year"
|
||||
}
|
||||
|
||||
assert_correct_warning_upsampling()
|
||||
@ -185,13 +189,13 @@ run_all_inference_tests()
|
||||
assert_correct_ldc93s1 "${phrase_pbmodel_nolm}"
|
||||
|
||||
phrase_pbmodel_withlm=$(deepspeech --model ${TASKCLUSTER_TMP_DIR}/${model_name_mmap} --alphabet ${TASKCLUSTER_TMP_DIR}/alphabet.txt --lm ${TASKCLUSTER_TMP_DIR}/lm.binary --trie ${TASKCLUSTER_TMP_DIR}/trie --audio ${TASKCLUSTER_TMP_DIR}/LDC93S1.wav)
|
||||
assert_correct_ldc93s1 "${phrase_pbmodel_withlm}"
|
||||
assert_correct_ldc93s1_lm "${phrase_pbmodel_withlm}"
|
||||
|
||||
phrase_pbmodel_nolm_stereo_44k=$(deepspeech --model ${TASKCLUSTER_TMP_DIR}/${model_name_mmap} --alphabet ${TASKCLUSTER_TMP_DIR}/alphabet.txt --audio ${TASKCLUSTER_TMP_DIR}/LDC93S1_pcms16le_2_44100.wav)
|
||||
assert_correct_ldc93s1 "${phrase_pbmodel_nolm_stereo_44k}"
|
||||
|
||||
phrase_pbmodel_withlm_stereo_44k=$(deepspeech --model ${TASKCLUSTER_TMP_DIR}/${model_name_mmap} --alphabet ${TASKCLUSTER_TMP_DIR}/alphabet.txt --lm ${TASKCLUSTER_TMP_DIR}/lm.binary --trie ${TASKCLUSTER_TMP_DIR}/trie --audio ${TASKCLUSTER_TMP_DIR}/LDC93S1_pcms16le_2_44100.wav)
|
||||
assert_correct_ldc93s1 "${phrase_pbmodel_withlm_stereo_44k}"
|
||||
assert_correct_ldc93s1_lm "${phrase_pbmodel_withlm_stereo_44k}"
|
||||
|
||||
phrase_pbmodel_nolm_mono_8k=$(deepspeech --model ${TASKCLUSTER_TMP_DIR}/${model_name_mmap} --alphabet ${TASKCLUSTER_TMP_DIR}/alphabet.txt --audio ${TASKCLUSTER_TMP_DIR}/LDC93S1_pcms16le_1_8000.wav 2>&1 1>/dev/null)
|
||||
assert_correct_warning_upsampling "${phrase_pbmodel_nolm_mono_8k}"
|
||||
@ -209,7 +213,7 @@ run_prod_inference_tests()
|
||||
assert_correct_ldc93s1_prodmodel "${phrase_pbmodel_withlm}"
|
||||
|
||||
phrase_pbmodel_withlm_stereo_44k=$(deepspeech --model ${TASKCLUSTER_TMP_DIR}/${model_name_mmap} --alphabet ${TASKCLUSTER_TMP_DIR}/alphabet.txt --lm ${TASKCLUSTER_TMP_DIR}/lm.binary --trie ${TASKCLUSTER_TMP_DIR}/trie --audio ${TASKCLUSTER_TMP_DIR}/LDC93S1_pcms16le_2_44100.wav)
|
||||
assert_correct_ldc93s1_prodmodel "${phrase_pbmodel_withlm_stereo_44k}"
|
||||
assert_correct_ldc93s1_prodmodel_stereo_44k "${phrase_pbmodel_withlm_stereo_44k}"
|
||||
|
||||
phrase_pbmodel_withlm_mono_8k=$(deepspeech --model ${TASKCLUSTER_TMP_DIR}/${model_name_mmap} --alphabet ${TASKCLUSTER_TMP_DIR}/alphabet.txt --lm ${TASKCLUSTER_TMP_DIR}/lm.binary --trie ${TASKCLUSTER_TMP_DIR}/trie --audio ${TASKCLUSTER_TMP_DIR}/LDC93S1_pcms16le_1_8000.wav 2>&1 1>/dev/null)
|
||||
assert_correct_warning_upsampling "${phrase_pbmodel_withlm_mono_8k}"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user