pytorch/ios-demo-app

Can't find model (SpeechRecognition)

Opened this issue · 3 comments

Hello,
I am trying to run SpeechRecognition demo but, I get the error Fatal error: Can't find the model.
I followed the document created model both with torchaudio and my model but I get the same error.

Any solutions?

I use LibTorch 1.9.0

Thanks.

Sorry for the late reply. Did you drag and drop the created model to the Xcode project?

hello i have the same issue when i used my custom module any solution?

Is "Bundle.main.path(forResource: fileName, ofType: type)" failing or let module = InferenceModule(fileAtPath: filePath) failing?

I changed my code to this

private lazy var module: InferenceModule = {
    var fileName = "wav2vec2"
    var type = "ptl"
    if let filePath = Bundle.main.path(forResource: fileName, ofType: type){
        let module = InferenceModule(fileAtPath: filePath)
        return module!
    
    } else {
        fatalError("Can't find the model file!")
    }
}()   

and it still failed. Turned out I had exported the model on my own system using newer versions of pytorch and torchaudio.
Try downloading the model from the repo or exporting using the recommended versions of torch/torchaudio.

After doing this, it worked!!!