Open reubenab opened 2 weeks ago
Additionally, when looking at the files at the filepath, I see a MelSpectrogram.mlmodelc
file indeed exists, but it must be corrupted in some way.
This looks like a partial download, I think a fix could attempt to redownload this particular file if it fails to load. Thanks for flagging.
@ZachNagengast thank you for the response! just to make sure I understand, this is a fix you're looking at bringing into the core library? would anything need to change in the above codeblock?
Essentially, the fix here is checking for any throw when loading the model, and if that fails, attempt to re-download it. This can also fixed if using the useBackgroundSession: true
optional init param.
I have the following function defined in my Swift iOS app, copied largely from the example app in the repo:
A few users of the app reached out saying the transcription model was getting stuck loading. I was able to reproduce the below error on the iPhone SE (3rd generation) Simulator (running iOS 17.4). It looks like the
modelSupport
function doesn't have an explicit check for the iPhone SE, but it should fall back toopenai_whisper-base
(which is fine).In my logging, I found the following statement (which comes from the
catch
statement fromtry await whisperKit.prewarmModels()
): "[TranscriptionViewModel] Error prewarming models, retrying: Unable to load model: file:///Users/reubenabraham/Library/Developer/CoreSimulator/Devices/02AD2DD3-5F29-443A-881D-13F2FDE47BC7/data/Containers/Data/Application/787AB037-00B7-49C8-9503-0EAB34972520/Documents/huggingface/models/argmaxinc/whisperkit-coreml/openai_whisper-base/MelSpectrogram.mlmodelc/. Compile the model with Xcode orMLModel.compileModel(at:)
. "Just before that, there was a longer warning message:
I'm not sure what to make of this error message or how to proceed further and fix this problem. What am I missing? Everything works fine for most of my users but about 20% have run into this problem (or something similar during the loading process).