From 78d9b2a15bc653c61244460f629e27990aab9f02 Mon Sep 17 00:00:00 2001 From: Eren Akbiyik Date: Mon, 21 Nov 2022 17:25:54 +0000 Subject: [PATCH] feat: remove old refs, check for prompt size --- whisper.cpp | 2 +- whisper.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/whisper.cpp b/whisper.cpp index f8c1ada..3633cdb 100644 --- a/whisper.cpp +++ b/whisper.cpp @@ -2591,7 +2591,7 @@ int whisper_full( } // Prepend the prompt tokens to the prompt_past - if (params.prompt_tokens) { + if (params.prompt_tokens && params.prompt_n_tokens > 0) { // Parse tokens from the pointer (it points to an std::vector) for (int i = 0; i < params.prompt_n_tokens; i++) { prompt_past.push_back(params.prompt_tokens[i]); diff --git a/whisper.h b/whisper.h index ad989e9..1b2a042 100644 --- a/whisper.h +++ b/whisper.h @@ -3,7 +3,6 @@ #include #include -#include #ifdef WHISPER_SHARED # ifdef _WIN32 @@ -209,7 +208,7 @@ extern "C" { bool speed_up; // speed-up the audio by 2x using Phase Vocoder int audio_ctx; // overwrite the audio context size (0 = use default) - // std::vector: tokents to provide the whisper model as initial prompt + // std::vector: tokens to provide the whisper model as initial prompt const whisper_token * prompt_tokens; int prompt_n_tokens;