We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1d516d3 commit 9684f4cCopy full SHA for 9684f4c
common/ngram-cache.h
@@ -39,10 +39,13 @@ struct llama_ngram {
39
40
struct llama_ngram_hash_function {
41
size_t operator()(const llama_ngram & ngram) const {
42
- size_t hash = 0;
43
- for (int i = 0; i < LLAMA_NGRAM_MAX; ++i) {
44
- hash ^= std::hash<llama_token>{}(ngram.tokens[i]);
+ size_t hash = ngram.tokens[0];
+
+ for (int i = 1; i < LLAMA_NGRAM_MAX; ++i) {
45
+ hash <<= 15;
46
+ hash ^= ngram.tokens[i];
47
}
48
49
return hash;
50
51
};
0 commit comments