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

Using hub.create_module_spec with TensorFlow 2.0 #331

Closed
dfalbel opened this issue Jul 16, 2019 · 3 comments
Closed

Using hub.create_module_spec with TensorFlow 2.0 #331

dfalbel opened this issue Jul 16, 2019 · 3 comments
Assignees
Labels
hub For all issues related to tf hub library and tf hub tutorials or examples posted by hub team stat:awaiting tensorflower type:support

Comments

@dfalbel
Copy link

dfalbel commented Jul 16, 2019

What's the recommended way to create Module specs with TensorFlow 2.0.

The guide uses tf.placeholders in order to define the input signature, but this is not idiomatic TF2.0.

I wonder if it would be possible to get all the information from a tf.function with define input signatures, eg. something like this:

@tf.function(input_signature=[tf.TensorSpec(shape=None, dtype=tf.float32)])
def f(x): return tf.add(x, 1.)

Thanks very much!

@rmothukuru rmothukuru self-assigned this Jul 17, 2019
@rmothukuru rmothukuru added hub For all issues related to tf hub library and tf hub tutorials or examples posted by hub team type:support labels Jul 17, 2019
@rmothukuru rmothukuru assigned akhorlin and unassigned rmothukuru Jul 17, 2019
@akhorlin
Copy link
Collaborator

We are still in the progress of updating our documentation to reflect TF 2.0 changes. The guide in question hasn't been updated yet. https://github.com/tensorflow/hub/blob/master/examples/text_embeddings_v2/export_v2.py is a better example of how to define and export modules in TF2.

@dfalbel
Copy link
Author

dfalbel commented Jul 19, 2019

Great! Thanks very much! So the recommendation is to just use the tf.saved_model.save and set the signature via tf.function if required.

One thing that is not really clear to me yet is how do I create a module that exports multiple signatures.

@andresusanopinto
Copy link
Contributor

There has been more documentation changes about creating tf-2 saved models, in particular the following:
https://github.com/tensorflow/hub/blob/master/docs/tf2_saved_model.md#creating-savedmodels-for-tf-hub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hub For all issues related to tf hub library and tf hub tutorials or examples posted by hub team stat:awaiting tensorflower type:support
Projects
None yet
Development

No branches or pull requests

4 participants