ios-demo-app icon indicating copy to clipboard operation
ios-demo-app copied to clipboard

Can't find model (SpeechRecognition)

Open kerbaypapilon opened this issue 3 years ago • 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.

kerbaypapilon avatar Jul 05 '21 10:07 kerbaypapilon

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

jeffxtang avatar Oct 01 '21 16:10 jeffxtang

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

ShaikhAfsan avatar Nov 22 '21 11:11 ShaikhAfsan

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!!!

bdytx5 avatar Nov 30 '21 17:11 bdytx5