Skip to content

[tfjs-tflite] Can't initialize model, Encountered unresolved custom op #6584

Open
@mattrossman

Description

@mattrossman

Please make sure that this is a bug. As per our
GitHub Policy,
we only address code/doc bugs, performance issues, feature requests and
build/installation issues on GitHub. tag:bug_template

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow.js): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): MacOS 12.4 ARM
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: N/A
  • TensorFlow.js installed from (npm or script link): both
  • TensorFlow.js version (use command below): 3.18.0
  • Browser version: Version 103.0.5060.53 (Official Build) (arm64)
  • Tensorflow.js Converter Version: N/A

Describe the current behavior

Loading MediaPipe's face_landmark_with_attention.tflite fails with:

Error: Failed to create TFLiteWebModelRunner: INVALID_ARGUMENT: Can't initialize model

Several warnings appear mentioning an unresolved custom op Landmarks2TransformMatrix and a link to this guide for registering custom operators via C++.

image

It's unclear how this operator should be registered for this JS library as there is no C++ in this package's source files. The tflite_web_api_cc file generating the warning is mentioned in wasm/BUILD.bazel, and it appears to be downloaded pre-built rather than built from source.

Describe the expected behavior

  • The model should successfully load
  • OR some mechanism for automatically loading custom ops should be provided
  • OR instructions for building tflite_web_api_cc with custom ops should be provided

Standalone code to reproduce the issue

Here is a JSFiddle that uses the README sample to load these two face landmarks TFLite models (regular, with attention)

https://jsfiddle.net/mattrossman/o0pbqgyr/3/

The regular model loads successfully, while the model with attention fails to load.

Other info / logs

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions