29 using namespace kaldi;
34 "Copy a (cpu-based) neural net and its associated transition model,\n" 35 "possibly changing the binary mode\n" 36 "Also supports multiplying all the learning rates by a factor\n" 37 "(the --learning-rate-factor option) and setting them all to a given\n" 38 "value (the --learning-rate options)\n" 40 "Usage: nnet-am-widen [options] <nnet-in> <nnet-out>\n" 42 " nnet-am-widen --hidden-layer-dim=1024 1.mdl 2.mdl\n";
45 bool binary_write =
true;
52 if (po.NumArgs() != 2) {
57 std::string nnet_rxfilename = po.GetArg(1),
58 nnet_wxfilename = po.GetArg(2);
64 Input ki(nnet_rxfilename, &binary);
65 trans_model.
Read(ki.Stream(), binary);
66 am_nnet.
Read(ki.Stream(), binary);
72 Output ko(nnet_wxfilename, binary_write);
73 trans_model.
Write(ko.Stream(), binary_write);
74 am_nnet.
Write(ko.Stream(), binary_write);
76 KALDI_LOG <<
"Mixed up neural net from " << nnet_rxfilename
77 <<
" and wrote it to " << nnet_wxfilename;
79 }
catch(
const std::exception &e) {
80 std::cerr << e.what() <<
'\n';
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void Read(std::istream &is, bool binary)
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
void Register(OptionsItf *opts)
Configuration class that controls neural net "widening", which means increasing the dimension of the ...
void Write(std::ostream &os, bool binary) const
const Nnet & GetNnet() const
void WidenNnet(const NnetWidenConfig &widen_config, Nnet *nnet)
This function widens a neural network by increasing the hidden-layer dimensions to the target...