MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / common_batch_add

Function common_batch_add

subprojects/llama.cpp/common/common.cpp:1453–1470  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1451}
1452
1453void common_batch_add(
1454 struct llama_batch & batch,
1455 llama_token id,
1456 llama_pos pos,
1457 const std::vector<llama_seq_id> & seq_ids,
1458 bool logits) {
1459 GGML_ASSERT(batch.seq_id[batch.n_tokens] && "llama_batch size exceeded");
1460
1461 batch.token [batch.n_tokens] = id;
1462 batch.pos [batch.n_tokens] = pos;
1463 batch.n_seq_id[batch.n_tokens] = seq_ids.size();
1464 for (size_t i = 0; i < seq_ids.size(); ++i) {
1465 batch.seq_id[batch.n_tokens][i] = seq_ids[i];
1466 }
1467 batch.logits [batch.n_tokens] = logits;
1468
1469 batch.n_tokens++;
1470}
1471
1472//
1473// Token utils

Callers 15

mainFunction · 0.85
generate_responseFunction · 0.85
mainFunction · 0.85
perplexity_v2Function · 0.85
hellaswag_scoreFunction · 0.85
winogrande_scoreFunction · 0.85
multiple_choice_scoreFunction · 0.85
kl_divergenceFunction · 0.85
update_slotsMethod · 0.85

Calls 1

sizeMethod · 0.65

Tested by 6

decodeMethod · 0.68
decode_tokenMethod · 0.68
decode_tokensMethod · 0.68
test_backend_max_outputsFunction · 0.68
mainFunction · 0.68
draftMethod · 0.68