Skip to content

Commit 7e08885

Browse files
committed
skip dry sampler if last token is part of sequence breakers
1 parent a31ce1a commit 7e08885

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llama.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13051,6 +13051,11 @@ void llama_sample_dry(llama_token_data_array * candidates, const llama_token * l
1305113051
// get the last token
1305213052
auto last_token = last_tokens[last_tokens_size - 1];
1305313053

13054+
// if last token is part of the sequence breakers, skip whole sampler
13055+
if(std::find(seq_breakers, seq_breakers + seq_breakers_size, last_token) != seq_breakers + seq_breakers_size) {
13056+
return;
13057+
}
13058+
1305413059
// create an unordered map of "next tokens" <-> max match length
1305513060
std::unordered_map<llama_token, size_t> match_lengths;
1305613061

0 commit comments

Comments
 (0)