@@ -34,7 +34,7 @@ static bool eval_id(struct llama_context * ctx_llama, int id, int * n_past) {
34
34
35
35
static bool eval_string (struct llama_context * ctx_llama, const char * str, int n_batch, int * n_past, bool add_bos){
36
36
std::string str2 = str;
37
- std::vector<llama_token> embd_inp = ::llama_tokenize (ctx_llama, str2, add_bos);
37
+ std::vector<llama_token> embd_inp = ::llama_tokenize (ctx_llama, str2, add_bos, true );
38
38
eval_tokens (ctx_llama, embd_inp, n_batch, n_past);
39
39
return true ;
40
40
}
@@ -152,20 +152,8 @@ static void process_prompt(struct llava_context * ctx_llava, struct llava_image_
152
152
size_t image_pos = prompt.find (" <image>" );
153
153
if (image_pos != std::string::npos) {
154
154
// new templating mode: Provide the full prompt including system message and use <image> as a placeholder for the image
155
-
156
155
system_prompt = prompt.substr (0 , image_pos);
157
156
user_prompt = prompt.substr (image_pos + std::string (" <image>" ).length ());
158
- // We replace \n with actual newlines in user_prompt, just in case -e was not used in templating string
159
- size_t pos = 0 ;
160
- while ((pos = user_prompt.find (" \\ n" , pos)) != std::string::npos) {
161
- user_prompt.replace (pos, 2 , " \n " );
162
- pos += 1 ; // Advance past the replaced newline
163
- }
164
- while ((pos = system_prompt.find (" \\ n" , pos)) != std::string::npos) {
165
- system_prompt.replace (pos, 2 , " \n " );
166
- pos += 1 ; // Advance past the replaced newline
167
- }
168
-
169
157
printf (" system_prompt: %s\n " , system_prompt.c_str ());
170
158
printf (" user_prompt: %s\n " , user_prompt.c_str ());
171
159
} else {
0 commit comments