mirror of
https://github.com/ggml-org/whisper.cpp.git
synced 2026-09-30 03:21:18 +02:00
common : fix for two functions when top_k exceeds the vocabulary size. (ggml/1633)
This commit is contained in:
committed by
Georgi Gerganov
parent
f6b039ff0f
commit
711ef84442
@@ -406,6 +406,7 @@ gpt_vocab::id gpt_sample_top_k_top_p(
|
||||
double temp,
|
||||
std::mt19937 & rng) {
|
||||
int n_logits = vocab.id_to_token.size();
|
||||
top_k = std::min(top_k, n_logits);
|
||||
|
||||
std::vector<std::pair<double, gpt_vocab::id>> logits_id;
|
||||
logits_id.reserve(n_logits);
|
||||
@@ -491,6 +492,7 @@ gpt_vocab::id gpt_sample_top_k_top_p_repeat(
|
||||
std::mt19937 & rng) {
|
||||
|
||||
int n_logits = vocab.id_to_token.size();
|
||||
top_k = std::min(top_k, n_logits);
|
||||
|
||||
const auto * plogits = logits;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user