fix
This commit is contained in:
parent
b91fe0f390
commit
dc1e51fd34
|
|
@ -6802,23 +6802,12 @@ static bool whisper_vad(
|
|||
}
|
||||
|
||||
int whisper_full_with_state(
|
||||
struct whisper_context * ctx,
|
||||
struct whisper_state * state,
|
||||
struct whisper_full_params params,
|
||||
const float * samples,
|
||||
int n_samples) {
|
||||
// clear old results
|
||||
auto & result_all = state->result_all;
|
||||
|
||||
result_all.clear();
|
||||
|
||||
if (n_samples > 0) {
|
||||
// compute log mel spectrogram
|
||||
if (whisper_pcm_to_mel_with_state(ctx, state, samples, n_samples, params.n_threads) != 0) {
|
||||
WHISPER_LOG_ERROR("%s: failed to compute log mel spectrogram\n", __func__);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
struct whisper_context *ctx,
|
||||
struct whisper_state *state,
|
||||
struct whisper_full_params params,
|
||||
const float *samples,
|
||||
int n_samples)
|
||||
{
|
||||
|
||||
std::vector<float> vad_samples;
|
||||
if (params.vad)
|
||||
|
|
@ -6838,6 +6827,21 @@ int whisper_full_with_state(
|
|||
n_samples = vad_samples.size();
|
||||
}
|
||||
|
||||
// clear old results
|
||||
auto &result_all = state->result_all;
|
||||
|
||||
result_all.clear();
|
||||
|
||||
if (n_samples > 0)
|
||||
{
|
||||
// compute log mel spectrogram
|
||||
if (whisper_pcm_to_mel_with_state(ctx, state, samples, n_samples, params.n_threads) != 0)
|
||||
{
|
||||
WHISPER_LOG_ERROR("%s: failed to compute log mel spectrogram\n", __func__);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
// auto-detect language if not specified
|
||||
if (params.language == nullptr || strlen(params.language) == 0 || strcmp(params.language, "auto") == 0 || params.detect_language) {
|
||||
std::vector<float> probs(whisper_lang_max_id() + 1, 0.0f);
|
||||
|
|
|
|||
Loading…
Reference in New Issue