26 using namespace kaldi;
31 "Concatenate Neural Networks (and possibly change binary/text format)\n" 32 "Usage: nnet-concat [options] <nnet-in1> <...> <nnet-inN> <nnet-out>\n" 34 " nnet-concat --binary=false nnet.1 nnet.2 nnet.1.2\n";
38 bool binary_write =
true;
39 po.Register(
"binary", &binary_write,
"Write output in binary mode");
43 if (po.NumArgs() < 3) {
48 std::string model_in_filename = po.GetArg(1);
49 std::string model_in_filename_next;
50 std::string model_out_filename = po.GetArg(po.NumArgs());
53 KALDI_LOG <<
"Reading " << model_in_filename;
57 Input ki(model_in_filename, &binary_read);
58 nnet.
Read(ki.Stream(), binary_read);
62 for (int32
i = 2;
i < po.NumArgs();
i++) {
64 model_in_filename_next = po.GetArg(
i);
65 KALDI_LOG <<
"Concatenating " << model_in_filename_next;
69 Input ki(model_in_filename_next, &binary_read);
70 nnet_next.
Read(ki.Stream(), binary_read);
78 Output ko(model_out_filename, binary_write);
79 nnet.
Write(ko.Stream(), binary_write);
82 KALDI_LOG <<
"Written model to " << model_out_filename;
84 }
catch(
const std::exception &e) {
85 std::cerr << e.what();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void Write(const std::string &wxfilename, bool binary) const
Write Nnet to 'wxfilename',.
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
void AppendNnet(const Nnet &nnet_to_append)
Append other Nnet to the 'this' Nnet (copy all its components),.
void Read(const std::string &rxfilename)
Read Nnet from 'rxfilename',.