File tree Expand file tree Collapse file tree 3 files changed +3
-3
lines changed Expand file tree Collapse file tree 3 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -905,7 +905,7 @@ llama_token llama_sample_token(
905
905
906
906
llama_token id = 0 ;
907
907
908
- float * logits = llama_get_logits (ctx) + idx * n_vocab ;
908
+ float * logits = llama_get_logits_ith (ctx, idx) ;
909
909
910
910
// Apply params.logit_bias map
911
911
for (auto it = params.logit_bias .begin (); it != params.logit_bias .end (); it++) {
Original file line number Diff line number Diff line change @@ -183,7 +183,7 @@ std::string llama_detokenize_bpe(
183
183
// - ctx_guidance: context to use for classifier-free guidance, ignore if NULL
184
184
// - grammar: grammar to use for sampling, ignore if NULL
185
185
// - last_tokens: needed for repetition penalty, ignore if empty
186
- // - idx: sample from llama_get_logits (ctx) + idx * n_vocab
186
+ // - idx: sample from llama_get_logits_ith (ctx, idx)
187
187
//
188
188
// returns:
189
189
// - token: sampled token
Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ int main(int argc, char ** argv) {
150
150
}
151
151
152
152
auto n_vocab = llama_n_vocab (ctx);
153
- auto logits = llama_get_logits (ctx) + i_batch[i] * n_vocab ;
153
+ auto logits = llama_get_logits_ith (ctx, i_batch[i]) ;
154
154
155
155
std::vector<llama_token_data> candidates;
156
156
candidates.reserve (n_vocab);
You can’t perform that action at this time.
0 commit comments