File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -97,11 +97,18 @@ struct cli_context {
9797 task.params .chat_parser_params .parser .load (chat_params.parser );
9898 }
9999
100+ // Copy the preserved tokens into the sampling params
101+ const llama_vocab * vocab = llama_model_get_vocab (
102+ llama_get_model (ctx_server.get_llama_context ()));
103+ for (const auto & token : chat_params.preserved_tokens ) {
104+ auto ids = common_tokenize (vocab, token, false , true );
105+ if (ids.size () == 1 ) {
106+ task.params .sampling .preserved_tokens .insert (ids[0 ]);
107+ }
108+ }
109+
100110 // reasoning budget sampler
101111 if (!chat_params.thinking_end_tag .empty ()) {
102- const llama_vocab * vocab = llama_model_get_vocab (
103- llama_get_model (ctx_server.get_llama_context ()));
104-
105112 task.params .sampling .reasoning_budget_tokens = defaults.sampling .reasoning_budget_tokens ;
106113 task.params .sampling .generation_prompt = chat_params.generation_prompt ;
107114
You can’t perform that action at this time.
0 commit comments