29 using namespace kaldi;
34 "Sets learning rate coefficient inside of 'nnet1' model\n" 35 "Usage: nnet-set-learnrate --components=<csl> --coef=<float> <nnet-in> <nnet-out>\n" 36 "e.g.: nnet-set-learnrate --components=1:3:5 --coef=0.5 --bias-coef=0.1 nnet-in nnet-out\n";
40 po.Register(
"binary", &binary,
"Write output in binary mode");
42 std::string components_str =
"";
43 po.Register(
"components", &components_str,
44 "Select components by 'csl' of 1..N values. Layout is the same as in " 45 "'nnet-info' output, (example 1:3:5)");
51 po.Register(
"coef", &coef,
52 "Learn-rate coefficient for both weight matrices and biases.");
53 po.Register(
"weight-coef", &weight_coef,
54 "Learn-rate coefficient for weight matrices " 55 "(used as: coef * weight_coef).");
56 po.Register(
"bias-coef", &bias_coef,
57 "Learn-rate coefficient for bias (used as: coef * bias_coef).");
61 if (po.NumArgs() != 2) {
66 std::string nnet_in_filename = po.GetArg(1),
67 nnet_out_filename = po.GetArg(2);
70 nnet.
Read(nnet_in_filename);
74 std::vector<int32> components;
75 if (components_str !=
"") {
81 components.push_back(
i);
86 for (int32
i = 0;
i < components.size();
i++) {
96 nnet.
Write(nnet_out_filename, binary);
99 }
catch(
const std::exception &e) {
100 std::cerr << e.what();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
int32 NumComponents() const
Returns the number of 'Components' which form the NN.
bool SplitStringToIntegers(const std::string &full, const char *delim, bool omit_empty_strings, std::vector< I > *out)
Split a string (e.g.
void Write(const std::string &wxfilename, bool binary) const
Write Nnet to 'wxfilename',.
Class UpdatableComponent is a Component which has trainable parameters, it contains SGD training hype...
virtual void SetLearnRateCoef(BaseFloat val)
Set the learn-rate coefficient,.
virtual bool IsUpdatable() const
Check if componeny has 'Updatable' interface (trainable components),.
virtual void SetBiasLearnRateCoef(BaseFloat val)
Set the learn-rate coefficient for bias,.
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
void Read(const std::string &rxfilename)
Read Nnet from 'rxfilename',.
const Component & GetComponent(int32 c) const
Component accessor,.