27 int main(
int argc,
char *argv[]) {
29 using namespace kaldi;
32 typedef kaldi::int64 int64;
35 "Train the neural network parameters with a discriminative objective\n" 36 "function (MMI, SMBR or MPFE). This uses training examples prepared with\n" 37 "nnet-get-egs-discriminative\n" 38 "This version uses multiple threads (but no GPU)" 40 "Usage: nnet-train-discriminative-parallel [options] <model-in> <training-examples-in> <model-out>\n" 42 "nnet-train-discriminative-parallel --num-threads=8 1.nnet ark:1.degs 2.nnet\n";
44 bool binary_write =
true;
45 std::string use_gpu =
"yes";
46 int32 num_threads = 1;
50 po.
Register(
"binary", &binary_write,
"Write output in binary mode");
51 po.
Register(
"num-threads", &num_threads,
"Number of threads to use");
61 std::string nnet_rxfilename = po.
GetArg(1),
62 examples_rspecifier = po.
GetArg(2),
63 nnet_wxfilename = po.
GetArg(3);
69 Input ki(nnet_rxfilename, &binary_read);
80 update_opts, num_threads, &example_reader,
83 Output ko(nnet_wxfilename, binary_write);
88 return (stats.
tot_t == 0 ? 1 : 0);
89 }
catch(
const std::exception &e) {
90 std::cerr << e.what() <<
'\n';
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
int main(int argc, char *argv[])
void PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor].
void Read(std::istream &is, bool binary)
void Register(const std::string &name, bool *ptr, const std::string &doc)
void Register(OptionsItf *opts)
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
void Read(std::istream &is, bool binary)
void Write(std::ostream &os, bool binary) const
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
int Read(int argc, const char *const *argv)
Parses the command line options and fills the ParseOptions-registered variables.
std::string GetArg(int param) const
Returns one of the positional parameters; 1-based indexing for argc/argv compatibility.
int NumArgs() const
Number of positional parameters (c.f. argc-1).
void Write(std::ostream &os, bool binary) const
void NnetDiscriminativeUpdateParallel(const AmNnet &am_nnet, const TransitionModel &tmodel, const NnetDiscriminativeUpdateOptions &opts, int32 num_threads, SequentialDiscriminativeNnetExampleReader *example_reader, Nnet *nnet_to_update, NnetDiscriminativeStats *stats)
const Nnet & GetNnet() const