Cheetah Issue: PV file not being recognized or filepath not being resolved
EKP529 opened this issue · comments
Have you checked the docs and existing issues?
- I have read all of the relevant Picovoice Cheetah docs
- I have searched the existing issues for Cheetah
SDK
Android
Cheetah package version
^2.0.0
Framework version
Expo ^49.0.15 (React Native 0.72.6)
Platform
Android
OS/Browser version
Android 5+
Describe the bug
Given the following line of code used in a default, exported function of a .tsx
file (where the code utilizes the the React useState
hook to set the Cheetah object once it's created)
setCheetah(await Cheetah.create(PICOVOICE_ACCESS_KEY, modelPath, { enableAutomaticPunctuation: true }));
The following error is logged after bundling the app for Android:
CheetahIOError: ../assets/cheetah_params.pv
Generally, it seems that the .pv file isn't being recognized. I tried creating my own model and using it but I still get the same error. This is my first time creating a Github Issue so forgive me if I haven't been detailed enough. Let me know if I need to provide any more information to help resolve the problem. I've searched the docs and tried to find help online to no avail.
Steps To Reproduce
- Setup an Expo project in a monorepo.
- Create a default component in a
.tsx
file - In the component, use this line of code in a default React
useEffect
hook:setCheetah(await Cheetah.create(PICOVOICE_ACCESS_KEY, modelPath, { enableAutomaticPunctuation: true }));
(importing the necessary imports,modelPath
being the path to the.pv
file which should be in a sub-directory of the main app directory, and following the GitHub example for Cheetah to do error loging) - Bundle and run the app for Android and, upon rendering the given page, the error message should appear in the console logs.
Expected Behavior
The Cheetah object should successfully be created for eventual STT use and no error messages should be logged.
Can you reproduce this using the official demo? If yes, then we can look into a fix. Otherwise, you can look into the demo code and see what needs to be added to your code.
@kenarsa I copied and pasted the code from the App.tsx
file (while making the necessary adjustments) and am still getting the CheetahIOError: [pv filepath]
error message. I've attached screenshots that show the error, both with the default model file and my created model file. Is there anything you suggest I should do or anything I could attempt to resolve the error?
I cannot reproduce it using the demo in the repo. If you can give me instructions to do that, then I can help.
@EKP529 - it seems like the model files haven't been copied over into the Android/iOS platform projects. See this section of our documentation. You can also see we have a copy script in our demo that takes care of this.
@laves - Since I'm programming in Expo, in the app.json
file I've added "**/*"
to the assetBundlePatterns
property, so this should have accomplished what you said. Is there something besides this that I need to do? Is there a resource to find out more about why the CheetahIOError
would/might be thrown? I tested with a png file and the error message I get is the same (but with the new file: ../assets/[file-name]
). I'm just wondering if the CheetahIOError
could be a red herring?
CheetahIOError
almost always implies that the file path Cheetah is receiving is incorrect (i.e. the cheetah_params.pv
file does not exist at the location), so it is most likely a problem with the file location on the device. We've not done an Expo demo, so I can't speak to the specifics of that framework. For regular React Native, the .pv
file must be copied into the Android subproject assets
folder to deploy properly on the device. I'd suggest double-checking that the .pv
file is being deployed properly and that you are passing the file path relative to the Android assets folder.
If you can run our React Native demo and it works for you then unfortunately we can only provide so much coding/project help before we close this as there is not an issue with our Cheetah SDK.
The issue lies with Expo & Metro tooling.