Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rnnlm adaptation by the cache model on swbd #2659

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

keli78
Copy link
Contributor

@keli78 keli78 commented Sep 1, 2018

Rnnlm adaptation by the cache model on swbd (no weighting trick)

Copy link
Contributor

@LvHang LvHang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keli78
Please merge my pull request in your repository firstly. I corrected some simple mistakes conveniently, such as line is longer than 80, missing spaces, and so on.
Please keep in mind, you always can use misc/maintenance/cpplint.py to do some simple coding style check.
Otherwise, I added a few comments.

};
} // namespace kaldi

void ReadUttToConvo(string filename, map<string, string> &m) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use pointer instead of reference. When you use a reference as the input argument, please use const reference.
Otherwise, in kaldi, when you use string, please use std::string.

if ((i + idx) >= utt_ids.size()) {
idx -= range;
}
KALDI_ASSERT(idx < int(utt_ids.size()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use C++ casting style. Use static_cast() instead.

};
} // namespace kaldi

void ReadUttToConvo(string filename, map<string, string> &m) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use pointer instead of non-const reference.
Otherwise, in kaldi, when you use string, please use std::string.

#include "lat/kaldi-lattice.h"
#include "lat/lattice-functions.h"
#include "lat/compose-lattice-pruned.h"
#include <fstream>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In most cases, the order of header should be: current file header, c system header, c++ system header, other

#include "lat/kaldi-lattice.h"
#include "lat/lattice-functions.h"
#include "lat/compose-lattice-pruned.h"
#include <fstream>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

head order

} // namespace kaldi

// read the file and genereate a map from [utt-id] to [convo-id], stored in *m
void ReadUttToConvo(string filename, map<string, string> &m) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same as above

using std::unordered_map;

// read the file and genereate a map from [utt-id] to [convo-id], stored in *m
void ReadUttToConvo(string filename, map<string, string> &m) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same as above.
I think this function is used everywhere. Could you put it into a public head file?

@@ -0,0 +1,245 @@
// rnnlmbin/rnnlm-compute-prob.cc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong. Do you think this is a meaningful name "adjust2"?

// std::cout << rnnlm_compute_state.LogProbOfWord(word_id) << " ";
CuMatrix<BaseFloat> word_logprobs(1, word_embedding_mat.NumRows());
rnnlm_compute_state.GetLogProbOfWords(&word_logprobs);
// std::cout << word_logprobs(0, word_id) << " "; // this should be exactly the same as the 3 lines above
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this part of code will not use, you'd better delete them

using std::unordered_map;

// read the file and genereate a map from [utt-id] to [convo-id], stored in *m
void ReadUttToConvo(string filename, map<string, string> &m) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same

"Usage: lattice-lmrescore-kaldi-rnnlm-pruned-cache-adapt-onlyhistory [options] \\\n"
" <old-lm-rxfilename> <embedding-file> \\\n"
" <raw-rnnlm-rxfilename> \\\n"
" <lattice-rspecifier> <lattice-wspecifier>\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice the usage message of this program does not match the actual usage. Could you please clean it up a bit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danpovey I have modified the usage part and refactored the code.

Ke

@stale
Copy link

stale bot commented Jun 19, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Stale bot on the loose label Jun 19, 2020
@stale
Copy link

stale bot commented Jul 19, 2020

This issue has been automatically closed by a bot strictly because of inactivity. This does not mean that we think that this issue is not important! If you believe it has been closed hastily, add a comment to the issue and mention @kkm000, and I'll gladly reopen it.

@stale stale bot closed this Jul 19, 2020
@kkm000 kkm000 reopened this Jul 19, 2020
@stale stale bot removed the stale Stale bot on the loose label Jul 19, 2020
@stale
Copy link

stale bot commented Sep 17, 2020

This issue has been automatically marked as stale by a bot solely because it has not had recent activity. Please add any comment (simply 'ping' is enough) to prevent the issue from being closed for 60 more days if you believe it should be kept open.

@stale stale bot added the stale Stale bot on the loose label Sep 17, 2020
@tgm185z
Copy link

tgm185z commented Mar 3, 2023

Hello, I've been checking this dissertation: https://jscholarship.library.jhu.edu/handle/1774.2/66812
And looking for recipes that apply what is indicated in this I have found this pull request. Is there a reason why it was not finally done? Or maybe it was added in another branch or there are more updated content somewhere else?

Any info would be great, thanks.

@stale stale bot removed the stale Stale bot on the loose label Mar 3, 2023
@danpovey
Copy link
Contributor

danpovey commented Mar 3, 2023

It looks to me like it might have been an oversight on my part.
We do now have a conflict, in that Makefile. If you would find this code useful and you are able to test somehow that it compiles and runs, I could merge it.

@tgm185z
Copy link

tgm185z commented Mar 6, 2023

Thanks, I'll check.

@stale
Copy link

stale bot commented May 9, 2023

This issue has been automatically marked as stale by a bot solely because it has not had recent activity. Please add any comment (simply 'ping' is enough) to prevent the issue from being closed for 60 more days if you believe it should be kept open.

@stale stale bot added the stale Stale bot on the loose label May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Stale bot on the loose
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants