Skip to content

Commit 30caac3

Browse files
authored
llama : the WPM vocabs use the CLS token as BOS (#10930)
* llama : the WPM vocabs use the CLS token as BOS ggml-ci * llama : add comment
1 parent 60cfa72 commit 30caac3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/llama-vocab.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1657,7 +1657,7 @@ bool llama_token_is_control_impl(const struct llama_vocab & vocab, llama_token t
16571657
}
16581658

16591659
llama_token llama_token_bos_impl(const struct llama_vocab & vocab) {
1660-
return vocab.special_bos_id;
1660+
return vocab.type != LLAMA_VOCAB_TYPE_WPM ? vocab.special_bos_id : vocab.special_cls_id;
16611661
}
16621662

16631663
llama_token llama_token_eos_impl(const struct llama_vocab & vocab) {

src/llama-vocab.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct llama_vocab {
4545
id special_unk_id = 0;
4646
id special_sep_id = LLAMA_TOKEN_NULL;
4747
id special_pad_id = LLAMA_TOKEN_NULL;
48-
id special_cls_id = LLAMA_TOKEN_NULL;
48+
id special_cls_id = LLAMA_TOKEN_NULL; // TODO: revisit if this is really needed https://github.com/ggerganov/llama.cpp/pull/10930
4949
id special_mask_id = LLAMA_TOKEN_NULL;
5050

5151
id linefeed_id = 13;

0 commit comments

Comments
 (0)