Skip to content

Commit 28a2e6e

Browse files
authored
tokenize example: Respect normal add BOS token behavior (#4126)
Allow building with Makefile
1 parent 0b5c3b0 commit 28a2e6e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
BUILD_TARGETS = \
33
main quantize quantize-stats perplexity embedding vdot q8dot train-text-from-scratch convert-llama2c-to-ggml \
44
simple batched batched-bench save-load-state server gguf llama-bench libllava.a llava-cli baby-llama beam-search \
5-
speculative infill benchmark-matmult parallel finetune export-lora tests/test-c.o
5+
speculative infill tokenize benchmark-matmult parallel finetune export-lora tests/test-c.o
66

77
# Binaries only useful for tests
88
TEST_TARGETS = \
@@ -594,6 +594,9 @@ infill: examples/infill/infill.cpp ggml.o llama.o $(C
594594
simple: examples/simple/simple.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
595595
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
596596

597+
tokenize: examples/tokenize/tokenize.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
598+
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
599+
597600
batched: examples/batched/batched.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
598601
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
599602

examples/tokenize/tokenize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ int main(int argc, char ** argv) {
2626
llama_context_params ctx_params = llama_context_default_params();
2727
llama_context * ctx = llama_new_context_with_model(model, ctx_params);
2828

29-
const bool add_bos = true;
29+
const bool add_bos = llama_should_add_bos_token(model);
3030

3131
std::vector<llama_token> tokens;
3232

0 commit comments

Comments
 (0)