msqr1 / Vosklet

A speech recognizer that can run on the browser, inspired by vosk-browser
MIT License
33 stars 1 forks source link

Error: "Unable to open tar in WASM memory" using en-model.tgz #6

Closed jakespracher closed 5 months ago

jakespracher commented 6 months ago

Getting this using en-model.tgz served from my webserver with the latest

https://github.com/msqr1/Vosklet/blob/ef010940bc0fe54587e1c88503219e7848fd3fa5/src/genericModel.cc#L14

msqr1 commented 6 months ago

Make sure your browser decompress it properly before going into untarring. In other word, make sure you have the right Content-Encoding header set so browser decompress nicely! I removed manual decompression

jakespracher commented 6 months ago

What would be the easiest way to verify this? The error message did change after removing manual decompression to be clear, before I'd get "failed to fetch" and now I get "unable to open tar"

Might it be worth logging the error code or including it in the error message so I can understand what went wrong without having to build this with a source map?

jakespracher commented 6 months ago

Actually I think it's reading a cached model, trying to figure out how to clear it

msqr1 commented 6 months ago

@jakespracher To clear the saved model and for easy testing, you would want to use OPFS explorer extension. Regarding testing the model with the correct content encoding response header, I find it literally impossible if I don't have a test webserver because I can't add the response header for the browser to decompress. In my latest commit, you will find that I have to keep the old manual decompression for the examples to work.

jakespracher commented 5 months ago

Yep, it was reading the same compressed cached model.

In addition to the SharedBufferArray required headers, I updated my server to specify Content-Encoding: gzip specifically for en-model.tgz, cleared the cached model using OPFS explorer, and it was able to load successfully. Now let's see if I can recognize stuff.