A Unity project that utilizes unity/sentis-whisper-tiny, specifically adapted for mobile platforms.
- Download Models: Download
AudioDecoder_Tiny.sentis,AudioEncoder_Tiny.sentis, andLogMelSepctro.sentis. - Add Models: In the
/Assetsdirectory, place the downloaded models inside theModelsfolder. - Assign Models: In the Inspector, assign these 3 models to the
RunWhisperscript.
Ideally, you should store these models in the StreamingAssets folder and load them at runtime. However, accessing the StreamingAssets folder on Android and WebGL platforms is not as straightforward as on other platforms (e.g., you cannot access them directly via Application.streamingAssetsPath + "/AudioDecoder_Tiny.sentis").
On Android and WebGL platforms, you cannot access files in the StreamingAssets folder directly as you would on other platforms. Instead, you need to fetch the model files via UnityWebRequest from your StreamingAssets folder, save/cache them, and then load (ModelLoader.Load) the model.
At the time of writing i choose a workaround because loading the model got me an error: “Error Unable to Load type Unity.Sentis.Layers.Gather required for deserialisation”. What i did is exactly what i described in Setup. I basically put the models in the Asset/Models folder instead of the StreamingAsset folder.
For more detailed information on this challenge and possible workaround approaches, refer to this forum post. And this forum post.
- Unity 2023.2.1f1
- Sentis 1.3.0-pre
You might want to change the Backendtype inside RunWhisper.cs depending on your device.
- Pixel 6 -> working
- Quest 3 -> not tested
- WebGl -> not tested