Skip to content

Commit e8e2616

Browse files
authored
cli : provide model with text filename (ggml-org#19783)
1 parent 5452d73 commit e8e2616

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

tools/cli/cli.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,15 @@ int main(int argc, char ** argv) {
380380
console::error("file does not exist or cannot be opened: '%s'\n", fname.c_str());
381381
continue;
382382
}
383+
if (inf.fim_sep_token != LLAMA_TOKEN_NULL) {
384+
cur_msg += common_token_to_piece(ctx_cli.ctx_server.get_llama_context(), inf.fim_sep_token, true);
385+
cur_msg += fname;
386+
cur_msg.push_back('\n');
387+
} else {
388+
cur_msg += "--- File: ";
389+
cur_msg += fname;
390+
cur_msg += " ---\n";
391+
}
383392
cur_msg += marker;
384393
console::log("Loaded text from '%s'\n", fname.c_str());
385394
continue;

tools/server/server-context.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2911,6 +2911,9 @@ server_context_meta server_context::get_meta() const {
29112911
/* fim_pre_token */ llama_vocab_fim_pre(impl->vocab),
29122912
/* fim_sub_token */ llama_vocab_fim_suf(impl->vocab),
29132913
/* fim_mid_token */ llama_vocab_fim_mid(impl->vocab),
2914+
/* fim_pad_token */ llama_vocab_fim_pad(impl->vocab),
2915+
/* fim_rep_token */ llama_vocab_fim_rep(impl->vocab),
2916+
/* fim_sep_token */ llama_vocab_fim_sep(impl->vocab),
29142917

29152918
/* model_vocab_type */ llama_vocab_type(impl->vocab),
29162919
/* model_vocab_n_tokens */ llama_vocab_n_tokens(impl->vocab),

tools/server/server-context.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ struct server_context_meta {
3030
llama_token fim_pre_token;
3131
llama_token fim_sub_token;
3232
llama_token fim_mid_token;
33+
llama_token fim_pad_token;
34+
llama_token fim_rep_token;
35+
llama_token fim_sep_token;
3336

3437
// model meta
3538
enum llama_vocab_type model_vocab_type;

0 commit comments

Comments
 (0)