whisper : free backends + fix compile warning

This commit is contained in:
Georgi Gerganov 2023-11-10 12:45:26 +02:00
parent dcf9511dbb
commit 12030358ee
No known key found for this signature in database
GPG Key ID: 449E073F9DC10735
2 changed files with 7 additions and 1 deletions

View File

@ -181,7 +181,7 @@ private:
// It is assumed that PCM data is normalized to a range from -1 to 1
bool write_audio(const float * data, size_t length) {
for (size_t i = 0; i < length; ++i) {
const auto intSample = static_cast<const int16_t>(data[i] * 32767);
const int16_t intSample = data[i] * 32767;
file.write(reinterpret_cast<const char *>(&intSample), sizeof(int16_t));
dataSize += sizeof(int16_t);
}

View File

@ -3276,6 +3276,12 @@ void whisper_free(struct whisper_context * ctx) {
whisper_free_state(ctx->state);
ggml_backend_free(ctx->backend_cpu);
if (ctx->backend_gpu) {
ggml_backend_free(ctx->backend_gpu);
}
delete ctx;
}
}