File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -253,14 +253,15 @@ int main(int argc, char ** argv) {
253
253
chunks[i].tokens .clear ();
254
254
}
255
255
256
+ struct llama_batch query_batch = llama_batch_init (n_batch, 0 , 1 );
257
+
256
258
// start loop, receive query and return top k similar chunks based on cosine similarity
257
259
std::string query;
258
260
while (true ) {
259
261
printf (" Enter query: " );
260
262
std::getline (std::cin, query);
261
263
std::vector<int32_t > query_tokens = llama_tokenize (ctx, query, true );
262
264
263
- struct llama_batch query_batch = llama_batch_init (n_batch, 0 , 1 );
264
265
batch_add_seq (query_batch, query_tokens, 0 );
265
266
266
267
std::vector<float > query_emb (n_embd, 0 );
@@ -293,6 +294,7 @@ int main(int argc, char ** argv) {
293
294
}
294
295
295
296
// clean up
297
+ llama_batch_free (query_batch);
296
298
llama_print_timings (ctx);
297
299
llama_free (ctx);
298
300
llama_free_model (model);
You can’t perform that action at this time.
0 commit comments