Update src/llama-vocab.cpp

This commit is contained in:
Diego Devesa 2025-01-27 14:24:08 +01:00 committed by GitHub
parent 7c2b924232
commit 723fc66511
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1245,13 +1245,13 @@ struct llama_vocab::impl {
std::vector<llama_token> cache_special_tokens;
std::vector<std::string> cache_token_to_piece; // llama_token_to_piece(special = true);
struct PairHash {
struct pair_hash {
size_t operator()(const std::pair<std::string, std::string> & p) const {
return std::hash<std::string>{}(p.first) ^ //create some hash for pair
(std::hash<std::string>{}(p.second) << 1);
}
};
std::unordered_map<std::pair<std::string, std::string>, int, PairHash> bpe_ranks;
std::unordered_map<std::pair<std::string, std::string>, int, pair_hash> bpe_ranks;
// set of all tokens that cause "end of generation"
std::set<llama_token> special_eog_ids;