Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The TFLite model trained with LiteRT cannot run on the GPU. #5899

Open
luvvien opened this issue Mar 12, 2025 · 1 comment
Open

The TFLite model trained with LiteRT cannot run on the GPU. #5899

luvvien opened this issue Mar 12, 2025 · 1 comment
Assignees
Labels
gpu MediaPipe GPU related issues platform:ios MediaPipe IOS issues stat:awaiting response Waiting for user response task:object detection Issues related to Object detection: Track and label objects in images and video. type:modelmaker Issues related to creation of custom on-device ML solutions

Comments

@luvvien
Copy link

luvvien commented Mar 12, 2025

Have I written custom code (as opposed to using a stock example script provided in MediaPipe)

None

OS Platform and Distribution

iPhone12

Python Version

3.8

MediaPipe Model Maker version

None

Task name (e.g. Image classification, Gesture recognition etc.)

Object detect

Describe the actual behavior

Switch to GPU,throw error

Describe the expected behaviour

Run on GPU

Standalone code/steps you may have used to try to get what you need

The official MediaPipe demo deployed on iPhone 12 can switch to GPU for execution, but the TFLite model trained with LiteRT can only run on the CPU, and switching to GPU results in an error.

Other info / Complete Logs

E0000 00:00:1741774904.900263 5036181 calculator_graph.cc:887] INTERNAL: CalculatorGraph::Run() failed: 
Calculator::Open() for node "mediapipe_tasks_vision_objectdetectorgraph__mediapipe_tasks_core_inferencesubgraph__inferencecalculator__mediapipe_tasks_vision_objectdetectorgraph__mediapipe_tasks_core_inferencesubgraph__InferenceCalculator" failed: ; RET_CHECK failure (mediapipe/calculators/tensor/inference_calculator_metal.cc:310) (TFLGpuDelegateBindMetalBufferToTensor( delegate_.get(), output_indices[i], MtlBufferView::GetWriteView(*gpu_buffers_out_[i], gpu_helper_.mtlDevice) .buffer()))==(true)
Error Domain=com.google.mediapipe.tasks Code=13 "INTERNAL: CalculatorGraph::Run() failed: 
Calculator::Open() for node "mediapipe_tasks_vision_objectdetectorgraph__mediapipe_tasks_core_inferencesubgraph__inferencecalculator__mediapipe_tasks_vision_objectdetectorgraph__mediapipe_tasks_core_inferencesubgraph__InferenceCalculator" failed: ; RET_CHECK failure (mediapipe/calculators/tensor/inference_calculator_metal.cc:310) (TFLGpuDelegateBindMetalBufferToTensor( delegate_.get(), output_indices[i], MtlBufferView::GetWriteView(*gpu_buffers_out_[i], gpu_helper_.mtlDevice) .buffer()))==(true)" UserInfo={NSLocalizedDescription=INTERNAL: CalculatorGraph::Run() failed: 
Calculator::Open() for node "mediapipe_tasks_vision_objectdetectorgraph__mediapipe_tasks_core_inferencesubgraph__inferencecalculator__mediapipe_tasks_vision_objectdetectorgraph__mediapipe_tasks_core_inferencesubgraph__InferenceCalculator" failed: ; RET_CHECK failure (mediapipe/calculators/tensor/inference_calculator_metal.cc:310) (TFLGpuDelegateBindMetalBufferToTensor( delegate_.get(), output_indices[i], MtlBufferView::GetWriteView(*gpu_buffers_out_[i], gpu_helper_.mtlDevice) .buffer()))==(true)}
@luvvien luvvien added the type:modelmaker Issues related to creation of custom on-device ML solutions label Mar 12, 2025
@kuaashish kuaashish added gpu MediaPipe GPU related issues task:object detection Issues related to Object detection: Track and label objects in images and video. platform:ios MediaPipe IOS issues labels Mar 13, 2025
@kuaashish
Copy link
Collaborator

Hi @luvvien,

This issue appears to be more related to LiteRT rather than MediaPipe, as the TFLite model trained with LiteRT cannot run on the GPU. It would be more effective to raise the issue in the TensorFlow repository here and follow up with them for further updates.

Thank you!!

@kuaashish kuaashish added the stat:awaiting response Waiting for user response label Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gpu MediaPipe GPU related issues platform:ios MediaPipe IOS issues stat:awaiting response Waiting for user response task:object detection Issues related to Object detection: Track and label objects in images and video. type:modelmaker Issues related to creation of custom on-device ML solutions
Projects
None yet
Development

No branches or pull requests

2 participants