27 int main(
int argc,
char *argv[]) {
29 using namespace kaldi;
34 "Copy a (cpu-based) neural net and its associated transition model,\n" 35 "but modify it to remove certain pathologies. We use the average\n" 36 "derivative statistics stored with the layers derived from\n" 37 "NonlinearComponent. Note: some processes, such as nnet-combine-fast,\n" 38 "may not process these statistics correctly, and you may have to recover\n" 39 "them using the --stats-from option of nnet-am-copy before you use.\n" 42 "Usage: nnet-am-fix [options] <nnet-in> <nnet-out>\n" 44 " nnet-am-fix 1.mdl 1_fixed.mdl\n" 46 " nnet-am-fix --get-counts-from=1.gradient 1.mdl 1_shrunk.mdl\n";
48 bool binary_write =
true;
52 po.
Register(
"binary", &binary_write,
"Write output in binary mode");
62 std::string nnet_rxfilename = po.
GetArg(1),
63 nnet_wxfilename = po.
GetArg(2);
69 Input ki(nnet_rxfilename, &binary);
77 Output ko(nnet_wxfilename, binary_write);
81 KALDI_LOG <<
"Copied neural net from " << nnet_rxfilename
82 <<
" to " << nnet_wxfilename;
84 }
catch(
const std::exception &e) {
85 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].
void Read(std::istream &is, bool binary)
void FixNnet(const NnetFixConfig &config, Nnet *nnet)
void Register(OptionsItf *opts)
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...
void Read(std::istream &is, bool binary)
void Write(std::ostream &os, bool binary) const
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
int main(int argc, char *argv[])
const Nnet & GetNnet() const