Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model unpack fails without UUID file #846

Closed
Tadejo9 opened this issue Feb 7, 2022 · 10 comments
Closed

Model unpack fails without UUID file #846

Tadejo9 opened this issue Feb 7, 2022 · 10 comments

Comments

@Tadejo9
Copy link

Tadejo9 commented Feb 7, 2022

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/src
AndroidStudioProjects//app/model

Is this location false?

@nshmyrev
Copy link
Collaborator

nshmyrev commented Feb 7, 2022

@Tadejo9
Copy link
Author

Tadejo9 commented Feb 7, 2022

Hello, thank you for the response.

I figured out that i forgot to add :models to gradle.

@nshmyrev nshmyrev changed the title Model unpack fails Model unpack fails without UUID file Jun 9, 2022
@laurent22
Copy link

@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)

@nshmyrev
Copy link
Collaborator

nshmyrev commented May 3, 2023

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

@laurent22
Copy link

laurent22 commented Jun 11, 2023

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.

@laurent22
Copy link

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?

@nshmyrev
Copy link
Collaborator

@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

@nshmyrev
Copy link
Collaborator

@laurent22 let me know if you want me to implement this part, I can take a look

@laurent22
Copy link

Thanks @nshmyrev, I have replied on the pull request: laurent22/joplin#8309

@nshmyrev
Copy link
Collaborator

Good, actually same as alphacep/vosk-android-demo#190

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants