alphacep / vosk-api

Offline speech recognition API for Android, iOS, Raspberry Pi and servers with Python, Java, C# and Node
Apache License 2.0
7.57k stars 1.06k forks source link

Crash using vosk-recasepunc-xxx models #1321

Closed securigy closed 7 months ago

securigy commented 1 year ago

I have been testing different models after I downloaded and unzipped them:

I work in C# x64 and have Init function:

`public void Init(string modelFolder) { using (Log.VerboseCall()) { try { mModel = new Model(modelFolder);

        mRecognizer = new VoskRecognizer(mModel, 16000.0f);
    }
    catch (Exception ex)
    {
        Log.Verbose(ex);
    }
}

}`

where mModel and mRecognizer are members of the class...

The following models throw exception: vosk-recasepunc-en-0.22 vosk-recasepunc-ru-0.22

It happens at this line: mRecognizer = new VoskRecognizer(mModel, 16000.0f);

System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'

So, I either misunderstood what these models are and whether they can be run on Windows desktop, and if yes, and how they are used. If that's the case could you please explain and show some example. If I misused them, then it should be noted in documentation as well about of the usage of these models.

hardsmoke commented 1 year ago

did you solve the problem? at first I thought it was because of the amd processor, because my friend ran this program with an intel processor and everything worked for him, but then I asked another person with amd and it also worked for him, I don’t understand anything

upd: found a solution for me, my user folder name has a cyrillic symbols

securigy commented 1 year ago

No, I did not find the solution. The problem with the library is bigger than that: I could skip these 2 models that throw exception, but it has no casing and no punctuation and it is way more difficult to sell to the customers...

Kuprich commented 9 months ago

I think that the punctuation model cannot be used as a recognition model. Should be used as post-processing. But I haven’t seen any examples in C#, only in Python

example of using punctuation model: #1210

nshmyrev commented 7 months ago

Right, you have to use different code for punctuation. See https://github.com/alphacep/vosk-api/issues/152