Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 26 of file nnet3-init.cc.
References ParseOptions::GetArg(), KALDI_ASSERT, KALDI_LOG, ParseOptions::NumArgs(), ParseOptions::PrintUsage(), ParseOptions::Read(), Nnet::ReadConfig(), kaldi::ReadKaldiObject(), ParseOptions::Register(), Input::Stream(), and kaldi::WriteKaldiObject().
28 using namespace kaldi;
33 "Initialize nnet3 neural network from a config file; outputs 'raw' nnet\n" 34 "without associated information such as transition model and priors.\n" 35 "Search for examples in scripts in /egs/wsj/s5/steps/nnet3/\n" 36 "Can also be used to add layers to existing model (provide existing model\n" 39 "Usage: nnet3-init [options] [<existing-model-in>] <config-in> <raw-nnet-out>\n" 41 " nnet3-init nnet.config 0.raw\n" 42 "or: nnet3-init 1.raw nnet.config 2.raw\n" 43 "See also: nnet3-copy, nnet3-info\n";
45 bool binary_write =
true;
49 po.Register(
"binary", &binary_write,
"Write output in binary mode");
50 po.Register(
"srand", &srand_seed,
"Seed for random number generator");
55 if (po.NumArgs() < 2 || po.NumArgs() > 3) {
60 std::string raw_nnet_rxfilename = (po.NumArgs() == 3 ?
61 po.GetArg(1) : std::string(
"")),
62 config_rxfilename = po.GetArg(po.NumArgs() == 3 ? 2 : 1),
63 raw_nnet_wxfilename = po.GetArg(po.NumArgs() == 3 ? 3 : 2);
66 if (po.NumArgs() == 3) {
69 << raw_nnet_rxfilename;
74 Input ki(config_rxfilename, &binary);
75 KALDI_ASSERT(!binary &&
"Expect config file to contain text.");
80 KALDI_LOG <<
"Initialized raw neural net and wrote it to " 81 << raw_nnet_wxfilename;
83 }
catch(
const std::exception &e) {
84 std::cerr << e.what() <<
'\n';
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void ReadConfig(std::istream &config_file)
void ReadKaldiObject(const std::string &filename, Matrix< float > *m)
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
#define KALDI_ASSERT(cond)
void WriteKaldiObject(const C &c, const std::string &filename, bool binary)