I get error when trying to read a file from storage on android. Permission is issued. I don’t know you well Anrdoid programming, so could miss something obvious. Any ideas? I’d be very thankful for any pointing.
First, I copy my file in non-pak folder in the Content:
Then, check if the file exists. It does.
if (FPaths::FileExists(FileNameFull))
{
UE_LOG(LogTemp, Log, TEXT("Whisper initialization from file: %s"), *FileNameFull);
WhisperContext = whisper_init_from_file_with_params(TCHAR_TO_ANSI(*FileNameFull), whisper_context_default_params());
It exists. My log here is:
[2024.02.08-13.23.29:089][ 0]LogTemp: Whisper initialization from file: ../../../YnnkAndroid/Content/Whisper/ggml-tiny.bin
Plus, I see Whisper/ggml-tiny.bin in the obb package. Then, in the whisper_init_from_file_with_params(…) function:
WHISPER_LOG_INFO("%s: loading model from '%s'\n", __func__, path_model);
auto fin = std::ifstream(path_model, std::ios::binary);
if (!fin) {
WHISPER_LOG_ERROR("%s: failed to open '%s'\n", __func__, path_model);
return nullptr;
}
And std::ifstream can’t initialize from the file. The log is:
[2024.02.08-13.23.29:089][ 0]LogTemp: whisper_log: whisper_init_from_file_with_params_no_state: loading model from '../../../YnnkAndroid/Content/Whisper/ggml-tiny.bin'
[2024.02.08-13.23.29:089][ 0]LogTemp: Error: whisper_log: whisper_init_from_file_with_params_no_state: failed to open '../../../YnnkAndroid/Content/Whisper/ggml-tiny.bin'
At first I tried to use Vosk, and it couldn’t initialize model from file as well, but I decided it happens because I incorrectly integrated third-party library. Whisper doesn’t use external libraries, but the problem is still here.