Skip to content

Commit 32b5eee

Browse files
committed
cont : comments [no ci]
1 parent a6b0e85 commit 32b5eee

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

include/llama.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,14 +243,14 @@ extern "C" {
243243

244244
typedef bool (*llama_progress_callback)(float progress, void * user_data);
245245

246-
// Input data for llama_decode
246+
// Input data for llama_encode/llama_decode
247247
// A llama_batch object can contain input about one or many sequences
248248
// The provided arrays (i.e. token, embd, pos, etc.) must have size of n_tokens
249249
//
250250
// - token : the token ids of the input (used when embd is NULL)
251251
// - embd : token embeddings (i.e. float vector of size n_embd) (used when token is NULL)
252252
// - pos : the positions of the respective token in the sequence
253-
// (if set to NULL, the token position will be tracked automatically by llama_decode)
253+
// (if set to NULL, the token position will be tracked automatically by llama_encode/llama_decode)
254254
// - seq_id : the sequence to which the respective token belongs
255255
// (if set to NULL, the sequence ID will be assumed to be 0)
256256
// - logits : if zero, the logits (and/or the embeddings) for the respective token will not be output

src/llama-batch.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class llama_batch_allocr {
8484
llama_batch_allocr();
8585

8686
// sanitize and auto-gen missing data in the input batch
87-
// memory is optional. if provided will be used to check for sequence continuity
87+
// memory is optional. if provided will be used to check for sequence continuity and to determine the positions
8888
bool init(
8989
const llama_batch & batch_inp,
9090
const llama_vocab & vocab,
@@ -111,8 +111,8 @@ class llama_batch_allocr {
111111
std::vector<llama_seq_id *> seq_id;
112112
std::vector<int8_t> output;
113113

114-
std::vector<std::set<llama_pos>> seq_pos; // the positions of each sequence
115-
std::vector<std::vector<bool>> seq_cpl; // if sequences i is coupled to sequence j
114+
std::vector<std::set<llama_pos>> seq_pos; // seq_pos[s]: the set of positions in sequence s
115+
std::vector<std::vector<bool>> seq_cpl; // seq_cpl[s0][s1]: if sequence s0 is coupled to sequence s1
116116

117117
int debug;
118118
};

src/llama-context.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,6 @@ int llama_context::encode(const llama_batch & batch_inp) {
727727
return -1;
728728
}
729729

730-
// temporary allocate memory for the input batch if needed
731730
// note: during encode, we always pass the full sequence starting from pos = 0
732731
if (!batch_allocr->init(batch_inp, model.vocab, nullptr)) {
733732
LLAMA_LOG_ERROR("%s: failed to initialize batch\n", __func__);
@@ -895,7 +894,6 @@ int llama_context::decode(const llama_batch & batch_inp) {
895894
return -1;
896895
}
897896

898-
// temporary allocate memory for the input batch if needed
899897
if (!batch_allocr->init(batch_inp, model.vocab, memory.get())) {
900898
LLAMA_LOG_ERROR("%s: failed to initialize batch\n", __func__);
901899
return -1;

0 commit comments

Comments
 (0)