vosk-api
vosk-api copied to clipboard
Model unpack fails without UUID file
App fails to unpack the model with the following error:
java.lang.Error: Failed to unpack the model: model-en-us/uuid
None of the first three english models includes uuid subfolder.
This is the initModel method written using Kotlin. Uuid is not referenced anywhere in my code so i assume it is inside unpack method of StorageService class.
private fun initModel() {
StorageService.unpack(this, "model-en-us", "model",
{ model: Model? ->
this.model = model!!
setUiState(AppState.READY)
}
) { exception: IOException ->
throw Error("Failed to unpack the model: ${exception.message}")
}
}
I have placed model folder on the same level as src AndroidStudioProjects/<App-name>/app/src AndroidStudioProjects/<App-name>/app/model
Is this location false?
Hi. UUID file is created by gradle:
https://github.com/alphacep/vosk-android-demo/blob/master/models/build.gradle#L19
Hello, thank you for the response.
I figured out that i forgot to add :models to gradle.
@nshmyrev, what is this uuid used for? Is there any way to make it optional? Our problem is that we want to dynamically download the models, then load them in Vosk, but since this uuid is missing, it fails.
We also tried dynamically creating this uuid file where Vosk expects it, but it still fails.
The error is simply:
Error: /path/to/model/uuid
(and "/path/to/model/uuid" exists and has a random UUID in it)
what is this uuid used for?
To make sure model is sync between storage and aar.
Is there any way to make it optional? Our problem is that we want to dynamically download the models, then load them in Vosk, but since this uuid is missing, it fails.
If you don't need UUID, simply don't use it. Pick the code from
https://github.com/alphacep/vosk-android-service/tree/master/app/src/main/java/org/vosk/service/download
https://github.com/alphacep/vosk-android-service/blob/master/app/src/main/java/org/vosk/service/VoskRecognitionService.java#L83
Thanks for your answer @nshmyrev. Unfortunately, we lack the knowledge to be able to edit and recompile the Vosk lib, especially since it's imported via another lib (react-native-vosk). What I'm wondering is why when I provide a UUID file, it still gives me this error?
Error: /path/to/model/uuid
Even though this file exists and has a valid UUID inside. Is there a certain requirement to get this file valid and accepted by the library? For us, that would be the easiest solution to just provide a random uuid, but we can't get that to work unfortunately.
Also why does it need to sync this between the storage and AAR? Our plan is to load the model files directly from storage, not from the AAR. Is it possible with the current implementation of the lib?
@laurent22 sorry, I misunderstood your question, you can obviously download models from the web and put them in storage. See
https://github.com/alphacep/vosk-android-service/tree/master/app/src/main/java/org/vosk/service/download
@laurent22 let me know if you want me to implement this part, I can take a look
Thanks @nshmyrev, I have replied on the pull request: https://github.com/laurent22/joplin/pull/8309
Good, actually same as https://github.com/alphacep/vosk-android-demo/issues/190