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

I don't know the cause of the "GPU delegate" error that occurs when performing inference. #65

Closed
tsukamoto1783 opened this issue May 25, 2023 · 1 comment

Comments

@tsukamoto1783
Copy link

tsukamoto1783 commented May 25, 2023

I am very happy to see that this library has been updated recently.
Thank you so much.

https://github.com/tensorflow/flutter-tflite/tree/main/example/image_classification_mobilenet

Based on the above image inference sample application, you want to run an inference application using your own training data.
So, when I replace the training model and run the inference, I get the following error

Following operations are not supported by GPU delegate:
MUL: MUL requires one tensor that not less than second in all dimensions.
25 operations will run on the GPU, and the remaining 40 operations will run on the CPU.
TfLiteMetalDelegate Prepare: Failed to allocate id<MTLBuffer>
Node number 65 (TfLiteMetalDelegate) failed to prepare.
Restored original execution plan after delegate application failure.

What is the cause?
Is it the model, or do I need to set additional "ops" settings when converting to ".tflite"?

Do I need any settings for both android and IOS?

The Python code for the ".tflite" conversion was taken directly from the TensorFlow documentation. For reference.

https://www.tensorflow.org/lite/guide/ops_select#convert_a_model

We are very aware that this is in the development stage, but we sincerely look forward to your response.


【reference】

  • execution environment
// flutter doctor
[✓] Flutter (Channel stable, 3.10.0, on macOS 13.3.1 22E772610a darwin-arm64, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] VS Code (version 1.78.2)
[✓] Connected device (5 available)
@tsukamoto1783
Copy link
Author

I was able to do so after disabling the following "GpuDelegate" option.

    // Use Metal Delegate
    if (Platform.isIOS) {
      // options.addDelegate(GpuDelegate());
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant