flutter-tflite icon indicating copy to clipboard operation
flutter-tflite copied to clipboard

useMetalDelegateForIOS = true results in Interpreter not being able to load

Open Bassiuz opened this issue 9 months ago • 1 comments

Hello all,

I am trying to run a TFLite Yolo V8 model with Metal Delegate on iOS. I am testing on a physical device (iPhone 13).

When running the TFLite Analyze function, it returns

Your model looks compatible with GPU delegate on TFLite runtime version 2.16.1.
This does not guarantee that your model will work well with GPU delegate because there could still be runtime incompatibililties.

Which makes me question if there are runtime incompatibliities here.

Here is my code sample and error it results in;

  final options = InterpreterOptions()..threads = 2;
  options.useMetalDelegateForIOS = true; // Use Metal Delegate for iOS

  final mainInterpreter = Interpreter.fromBuffer(
    initData.interpreterBuffer,
    options: options,
  );

Results in

[ERROR:flutter/runtime/dart_isolate.cc(1380)] Unhandled exception:
Invalid argument(s): Unable to create interpreter.
#0      checkArgument (package:quiver/check.dart:45:5)
check.dart:45
#1      new Interpreter._create (package:tflite_flutter/src/interpreter.dart:58:5)
interpreter.dart:58
#2      new Interpreter.fromBuffer (package:tflite_flutter/src/interpreter.dart:109:37)

Bassiuz avatar Jul 18 '25 07:07 Bassiuz

I have the same question, but I’m using a Yolo v11s tflite model.

zenuie avatar Aug 29 '25 01:08 zenuie