We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a0c0516 commit cd7fa95Copy full SHA for cd7fa95
llama.cpp
@@ -1194,6 +1194,20 @@ static llama_vocab::id llama_sample_top_p_top_k(
1194
const auto & logits = lctx.logits;
1195
const auto * plogits = logits.data() + logits.size() - n_logits;
1196
1197
+ if (temp <= 0) {
1198
+ // select the token with the highest logit directly
1199
+ float max_logit = plogits[0];
1200
+ llama_vocab::id max_id = 0;
1201
+
1202
+ for (int i = 1; i < n_logits; ++i) {
1203
+ if (plogits[i] > max_logit) {
1204
+ max_logit = plogits[i];
1205
+ max_id = i;
1206
+ }
1207
1208
+ return max_id;
1209
1210
1211
std::vector<std::pair<float, llama_vocab::id>> logits_id;
1212
logits_id.reserve(n_logits);
1213
0 commit comments