Giter Club home page Giter Club logo

Comments (4)

marbre avatar marbre commented on August 29, 2024

As a general note, please be aware that the conversion is quite fragile at the moment. We forked from __init__.py of IREE and adjusted it for initial experiments, but cannot guarantee that it will work for arbitrary models.

Regarding the first issue, I assume the pass needs to be adjusted somehow, although I cannot comment how. Regarding the second issue, I so far only tested an MobileNetv2, passed as savemodel. Maybe @simon-camp can spend some time to investigate next week.

from mlir-emitc.

 avatar commented on August 29, 2024

I tried MobileNetv2 conversion from tf model zoo and it met with a similar error as the second case:

2020-09-25 16:02:29.064358: E tensorflow/compiler/mlir/tensorflow/translate/tf_mlir_translate.cc:163] SavedModel import failed: 
Invalid argument: Exported function with exported name(s) '__call__', 'keras_api.__call__' with multiple concrete functions. Add 
@tf.function(input_signature=[...]) on this function, or use a narrower list of exported names that excludes this function.

module {
}

However I was able to overcome this issue for both the models by passing --tf-savedmodel-exported-names=predict flag to mlir-translate.

Furthermore, for tf-opt the addition of following passes caused the first issue: tf-saved-model-optimize-global-tensors, tf-saved-model-freeze-global-tensors. These passes were not present in the IREE pipeline as well and removing them helped. I had to allow partial xla to tf legalization (xla-legalize-tf=allow-partial-conversion) as tf.ReadVariableOp was not converted - I think this is expected. I hope this is of some help, thank you for all your responses.

from mlir-emitc.

simon-camp avatar simon-camp commented on August 29, 2024

I had success wrapping a keras model in a tf.Module, see the conversion script. Then narrow down the exported functions in the translation via --tf-savedmodel-exported-names=predict as you noted.

The conversion script will most likely not work as is on tf.keras.Model subclasses as these are saved in SavedModel format AFAIK.

from mlir-emitc.

marbre avatar marbre commented on August 29, 2024

Since this seems to be solved, at least as far as we can support, I am closing the issue.

from mlir-emitc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.