Open 2BAB opened 2 months ago
Hi @2BAB,
Could you please provide the complete standalone code or the specific steps you are following from our documentation to help us better understand the issue? If needed, we will reproduce it on our end.
Thank you!!
@kuaashish updated the standalone code snippet and bolded the full example link.
Have I written custom code (as opposed to using a stock example script provided in MediaPipe)
Yes
OS Platform and Distribution
iOS 15
MediaPipe Tasks SDK version
0.10.14
Task name (e.g. Image classification, Gesture recognition etc.)
LLM Inference
Programming Language and version (e.g. C++, Python, Java)
Kotlin, Objective-C, Swift
Describe the actual behavior
It crashed (NPE) right after "Metal LLM tokens initialized" got printed.
Describe the expected behaviour
Should be initialized normally. Can add a new init method with error catching inside and returning nullable error string.
Standalone code/steps you may have used to try to get what you need
MPPLLMInference
that generated by Kotlin Interop from step 1:This may come from the limitation of KMP interop (https://kotlinlang.org/docs/native-objc-interop.html#errors-and-exceptions), since the constructor signature is
@objc public init(options: Options) throws {...}
.https://github.com/google-ai-edge/mediapipe/blob/cdc08d04ee83f36085894e3a24cb61c949f56b14/mediapipe/tasks/ios/genai/inference/sources/LlmInference.swift#L56
A full example for this issue can be found from below:
https://github.com/2BAB/MediaPiper/blob/ios-sdk-init-crash/app/src/iosMain/kotlin/me.xx2bab.mediapiper/llm/LLMOperator.ios.kt#L50
Other info / Complete Logs
No response