Minor changes required for nnet3 sequence training#560
Minor changes required for nnet3 sequence training#560danpovey merged 1 commit intokaldi-asr:chainfrom
Conversation
|
Thanks- will try to review soon. @vijayaditya, if you have time please take a look. |
|
OK, I will work on this after the ivector PR from Yiming. --VIjay On Sat, Mar 5, 2016 at 9:45 PM, Daniel Povey notifications@github.com
|
|
Note: This is not the full set of changes. There is a lot of codes and scripts, which is beyond what the github diff allows to view. So I am committing them in small chunks that would be easier to look at. This is first set of commits. |
|
I can push the next set of commits once this is merged. |
| // negated costs. Requires that lat be topologically sorted. This code | ||
| // will work for either CompactLattice or Latice. | ||
| template<typename LatticeType> | ||
| double ComputeLatticeAlphasAndBetas(const LatticeType &lat, |
There was a problem hiding this comment.
vimal, it's not good for compilation speed to define this in the header.
Just declare it in the header, and in the .cc file, define it and instantiate it for float and double.
|
OK, done. Please merge or rebase. |
cb187d9 to
541e4ae
Compare
|
I have changed the functions to use SetUnderlyingLearningRate |
src/nnet3/nnet-utils.cc
Outdated
| if (uc == NULL) | ||
| KALDI_ERR << "Updatable component does not inherit from class " | ||
| "UpdatableComponent; change this code."; | ||
| uc->SetUnderlyingLearningRate(uc->LearningRate() * learning_rate_scale); |
There was a problem hiding this comment.
you actually want to use SetActualLearningRate() here.
|
I made the change. |
src/lat/lattice-functions.h
Outdated
| vector<double> *beta); | ||
|
|
||
|
|
||
| static inline double LogAddOrMax(bool viterbi, double a, double b) { |
There was a problem hiding this comment.
do you still need this function to be in the header?
There was a problem hiding this comment.
Its a small function that can be inlined. If it is moved to .cc file, it
cannot be inlined.
On Sun, Mar 6, 2016 at 8:19 PM Daniel Povey notifications@github.com
wrote:
In src/lat/lattice-functions.h
#560 (comment):@@ -74,6 +74,26 @@ bool ComputeCompactLatticeAlphas(const CompactLattice &lat,
bool ComputeCompactLatticeBetas(const CompactLattice &lat,
vector *beta);
+static inline double LogAddOrMax(bool viterbi, double a, double b) {
do you still need this function to be in the header?
—
Reply to this email directly or view it on GitHub
https://github.com/kaldi-asr/kaldi/pull/560/files#r55153738.Vimal Manohar
PhD Student
Electrical & Computer Engineering
Johns Hopkins University
There was a problem hiding this comment.
so you are going to call it from some other code you have written?
There was a problem hiding this comment.
also if you are going to leave it in the header you should take away the 'static'.
888ddc2 to
5bd5fb4
Compare
|
It seems there was only function that used it, which is not back in the .cc file. So I moved it to the .cc file. |
src/lat/lattice-functions.cc
Outdated
| return true; | ||
| } | ||
|
|
||
| static inline double LogAddOrMax(bool viterbi, double a, double b) { |
There was a problem hiding this comment.
ok, you've now just moved this code around. could you revert this file?
|
and please squash your commits. |
5bd5fb4 to
10fbf54
Compare
|
Done |
| bool binary, | ||
| Vector<BaseFloat> *vec); | ||
|
|
||
| void RoundUpNumFrames(int32 frame_subsampling_factor, |
There was a problem hiding this comment.
you should document this declaration.
10fbf54 to
cf7a66b
Compare
|
Fixed |
src/util/stl-utils.h
Outdated
| } | ||
| }; | ||
|
|
||
| /// Comparator object that does comparison on a different |
There was a problem hiding this comment.
This comparator is not very well explained.
However, I think I see what you are trying to do here-- it would be better, instead of using this comparator, to instead sort a vector of pairs, where the 1st of each pair is the thing you want to sort on, and the 2nd is the index that you want to sort.
There was a problem hiding this comment.
This is where it is used:
https://github.com/vimalmanohar/kaldi/blob/sequence_clean/src/nnet3/discriminative-supervision.cc#L542
Would I have to write a similar comparator to sort the vector of pairs?
There was a problem hiding this comment.
No you wouldn't have to write any comparator, the default one works.
I'm saying a make vector of pairs
(state-time, state-index)
and sort it. you don't even need stable_sort, since if state_time is the
same, the state_index gets used instead.
On Sun, Mar 6, 2016 at 11:27 PM, Vimal Manohar notifications@github.com
wrote:
In src/util/stl-utils.h
#560 (comment):@@ -292,6 +292,29 @@ struct CompareFirstMemberOfPair {
}
};+/// Comparator object that does comparison on a different
This is where it is used:
https://github.com/vimalmanohar/kaldi/blob/sequence_clean/src/nnet3/discriminative-supervision.cc#L542
Would I have to write a similar comparator to sort the vector of pairs?—
Reply to this email directly or view it on GitHub
https://github.com/kaldi-asr/kaldi/pull/560/files#r55161297.
There was a problem hiding this comment.
Ok, I removed the comparator from stl-utils.h. I will modify the sort code
to use pairs.
On Sun, Mar 6, 2016 at 11:36 PM Daniel Povey notifications@github.com
wrote:
In src/util/stl-utils.h
#560 (comment):@@ -292,6 +292,29 @@ struct CompareFirstMemberOfPair {
}
};+/// Comparator object that does comparison on a different
No you wouldn't have to write any comparator, the default one works. I'm
saying a make vector of pairs (state-time, state-index) and sort it. you
don't even need stable_sort, since if state_time is the same, the
state_index gets used instead.
… <#msg-f:1528116455082592170_>
On Sun, Mar 6, 2016 at 11:27 PM, Vimal Manohar notifications@github.com
wrote: In src/util/stl-utils.h <#560 (comment)
https://github.com/kaldi-asr/kaldi/pull/560#discussion_r55161297>: > @@
-292,6 +292,29 @@ struct CompareFirstMemberOfPair { > } > }; > > +///
Comparator object that does comparison on a different This is where it is
used:
https://github.com/vimalmanohar/kaldi/blob/sequence_clean/src/nnet3/discriminative-supervision.cc#L542
Would I have to write a similar comparator to sort the vector of pairs? —
Reply to this email directly or view it on GitHub <
https://github.com/kaldi-asr/kaldi/pull/560/files#r55161297>.—
Reply to this email directly or view it on GitHub
https://github.com/kaldi-asr/kaldi/pull/560/files#r55161622.Vimal Manohar
PhD Student
Electrical & Computer Engineering
Johns Hopkins University
cf7a66b to
e0e2065
Compare
|
OK, thanks! Merging. |
Minor changes required for nnet3 sequence training
No description provided.