23 #ifndef KALDI_NNET3_DISCRIMINATIVE_TRAINING_H_ 24 #define KALDI_NNET3_DISCRIMINATIVE_TRAINING_H_ 38 namespace discriminative {
86 one_silence_class(false),
90 accumulate_gradients(false),
91 accumulate_output(false),
95 opts->
Register(
"criterion", &criterion,
"Criterion, 'mmi'|'mpfe'|'smbr', " 96 "determines the objective function to use. Should match " 97 "option used when we created the examples.");
98 opts->
Register(
"acoustic-scale", &acoustic_scale,
"Weighting factor to " 99 "apply to acoustic likelihoods.");
100 opts->
Register(
"drop-frames", &drop_frames,
"For MMI, if true we drop frames " 101 "with no overlap of num and den pdf-ids");
102 opts->
Register(
"boost", &boost,
"Boosting factor for boosted MMI (e.g. 0.1)");
103 opts->
Register(
"one-silence-class", &one_silence_class,
"If true, newer " 104 "behavior which will tend to reduce insertions " 105 "when using MPFE or SMBR objective");
106 opts->
Register(
"silence-phones", &silence_phones_str,
107 "For MPFE or SMBR objectives, colon-separated list of " 108 "integer ids of silence phones, e.g. 1:2:3");
109 opts->
Register(
"l2-regularize", &l2_regularize,
"l2 regularization " 110 "constant for 'chain' output " 111 "of the neural net.");
112 opts->
Register(
"xent-regularize", &xent_regularize,
"Cross-entropy " 113 "regularization constant for sequence training. If " 114 "nonzero, the network is expected to have an output " 115 "named 'output-xent', which should have a softmax as " 116 "its final nonlinearity.");
117 opts->
Register(
"accumulate-gradients", &accumulate_gradients,
118 "Accumulate gradients wrt nnet output " 119 "for debugging discriminative training");
120 opts->
Register(
"accumulate-output", &accumulate_output,
121 "Accumulate nnet output " 122 "for debugging discriminative training");
123 opts->
Register(
"num-pdfs", &num_pdfs,
125 "applicable when accumulate-output or accumulate-gradients " 126 "is true for discriminative training");
165 bool print_avg_gradients =
false,
166 bool print_avg_output =
false)
const;
170 Print(criterion,
true,
true);
174 void PrintAvgGradientForPdf(
int32 pdf_id)
const;
181 if (criterion ==
"mmi")
return (tot_num_objf - tot_objf);
189 return accumulate_gradients && gradients.
Dim() > 0;
196 return accumulate_output && output.
Dim() > 0;
249 #endif // KALDI_NNET3_DISCRIMINATIVE_TRAINING_H_
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void PrintAll(const std::string &criterion) const
void Register(OptionsItf *opts)
virtual void Register(const std::string &name, bool *ptr, const std::string &doc)=0
CuVector< double > output
double TotalObjf(const std::string &criterion) const
bool AccumulateGradients() const
CuVector< double > gradients
BaseFloat xent_regularize
void ComputeDiscriminativeObjfAndDeriv(const DiscriminativeOptions &opts, const TransitionModel &tmodel, const CuVectorBase< BaseFloat > &log_priors, const DiscriminativeSupervision &supervision, const CuMatrixBase< BaseFloat > &nnet_output, DiscriminativeObjectiveInfo *stats, CuMatrixBase< BaseFloat > *nnet_output_deriv, CuMatrixBase< BaseFloat > *xent_output_deriv)
This function does forward-backward on the numerator and denominator lattices and computes derivates ...
bool accumulate_gradients
bool AccumulateOutput() const
Matrix for CUDA computing.
std::string silence_phones_str
void Print(const Fst< Arc > &fst, std::string message)
bool accumulate_gradients
MatrixIndexT Dim() const
Dimensions.
Vector for CUDA computing.