26 int main(
int argc,
char *argv[]) {
28 using namespace kaldi;
33 "Initialize the nnet2 neural network from a config file with a line for each\n" 34 "component. Note, this only outputs the neural net itself, not the associated\n" 35 "information such as the transition-model; you'll probably want to pipe\n" 36 "the output into something like nnet-am-init.\n" 38 "Usage: nnet-init [options] <config-in> <raw-nnet-out>\n" 40 " nnet-init nnet.config 1.raw\n";
42 bool binary_write =
true;
46 po.
Register(
"binary", &binary_write,
"Write output in binary mode");
47 po.
Register(
"srand", &srand_seed,
"Seed for random number generator");
57 std::string config_rxfilename = po.
GetArg(1),
58 raw_nnet_wxfilename = po.
GetArg(2);
63 Input ki(config_rxfilename, &binary);
64 KALDI_ASSERT(!binary &&
"Expect config file to contain text.");
69 KALDI_LOG <<
"Initialized raw neural net and wrote it to " 70 << raw_nnet_wxfilename;
72 }
catch(
const std::exception &e) {
73 std::cerr << e.what() <<
'\n';
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void PrintUsage(bool print_command_line=false)
Prints the usage documentation [provided in the constructor].
int main(int argc, char *argv[])
void Register(const std::string &name, bool *ptr, const std::string &doc)
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
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).
#define KALDI_ASSERT(cond)
void Init(std::istream &is)
Initialize from config file.
void WriteKaldiObject(const C &c, const std::string &filename, bool binary)