-
Notifications
You must be signed in to change notification settings - Fork 128
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
Binary shortlist #856
Binary shortlist #856
Conversation
…nto binary_shortlist
Make hash arch-independent
Enable mpi wrapper to use size larger than MAX_INT.
…lation/Marian/marian-dev into hihoan/lsh7
…lation/Marian/marian-dev into hihoan/lsh7
This PR unifies the shortlist and LSH interface achieving significant speed-up for the LSH.
…uicksand This PR turns the LSH index and search into a set of operators that live in the expression graph. This makes creation etc. thread-safe (one index per graph) and allows to later implement GPU versions. This allows to mmap the LSH as a Marian parameter since now we only need to turn the index into something that can be saved to disk using the existing tensors. This happens in marian_conv or the equivalent interface function in the Quicksand interface.
@hieuhoang can you look at the merge conflict in shortlist.cpp? I will look into marian_conv |
regression past, the usual tests failed:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all good. Haven't tested the actual binary shortlist. You guys might wanna add a regression test to protect your investment
Hm, looks like Github didn't realize that we updated master too and now shows the merge as changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, looks good. Sorry for the weird github merge chaos here. Let us know if we broke anything on your side.
src/command/marian_conv.cpp
Outdated
cli->add<std::vector<std::string>>("--vocabs,-V", "Vocabulary file, required for ONNX export"); | ||
cli->add<std::vector<std::string>>("--shortlist,-s", "Shortlist conversion: filePath firstNum bestNum threshold"); | ||
cli->add<std::string>("--dump,-d", "Binary shortlist dump path","lex.bin"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rename this to dump-shortlist, dump is too generic.
src/command/marian_conv.cpp
Outdated
Ptr<const data::ShortlistGenerator> binaryShortlistGenerator | ||
= New<data::BinaryShortlistGenerator>(options, srcVocab, trgVocab, 0, 1, vocabPaths[0] == vocabPaths[1]); | ||
binaryShortlistGenerator->dump(dumpPath); | ||
LOG(info, "Finished"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly as above, mention that it's the dumping of the shortlist that finished, otherwise a bit too generic.
@@ -1,5 +1,8 @@ | |||
#include "data/shortlist.h" | |||
#include "microsoft/shortlist/utils/ParameterTree.h" | |||
#include "marian.h" | |||
#include "layers/lsh.h" | |||
#include <queue> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: we usually add an empty line between our and system headers.
@qianqianzhu after the option is renamed this is good to merge. |
Description
This PR adds a new binary shortlist generator which allows the decoder to load a lexical shortlist from a binary blob.
The new binary shortlist can greatly improve the lexical shortlist loading time (x4309 speed-up).
This feature has been integrated into the bergamot branch.
List of changes:
BinaryShortlistGenerator
Class to load lexical shortlist from a binary blob.To use a binary shortlist, you should provide the file path and whether the file needs checking (optional; true by default).
For example:
marian-conv
with--shortlist,-s
optionShortlist conversion usage example:
hash.h
for checksum calculationAdded dependencies: none
How to test
Manually tested new BinaryShortlistGenerator with LexicalShortlistGenerator. The results are the same. Also passed unit tests.
Regression tests are passed with gcc 8.4.0 and cuda 10.1.
Checklist