Skip to content

Commit

Permalink
Document Hub's use of SavedModel for TF2 next to hub.Module for TF1.
Browse files Browse the repository at this point in the history
Several details are still missing, but this sets the top-level structure.

PiperOrigin-RevId: 273736852
  • Loading branch information
TensorFlow Hub Authors authored and andresusanopinto committed Oct 9, 2019
1 parent 50f52dc commit 91370cb
Show file tree
Hide file tree
Showing 11 changed files with 606 additions and 320 deletions.
54 changes: 33 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,50 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================-->

<!--
This file is rendered on github.com/tensorflow/hub.
g3doc/_index.yaml is rendered on tensorflow.org/hub.
Both link to g3doc/overview.md and g3doc/*.md for detailed docs.
-->

# TensorFlow Hub

TensorFlow Hub is a library to foster the publication, discovery, and
consumption of reusable parts of machine learning models. In particular,
it provides **modules**, which are pre-trained pieces of TensorFlow models
that can be reused on new tasks.
[TensorFlow Hub](https://tfhub.dev) is a repository of reusable assets
for machine learning with [TensorFlow](https://www.tensorflow.org/).
In particular, it provides pre-trained SavedModels that can be reused
to solve new tasks with less training time and less training data.

This GitHub repository hosts the `tensorflow_hub` Python library to download
and reuse SavedModels in your TensorFlow program with a minimum amount of code,
as well as other associated code and documentation.

## Getting Started

* [Introduction](https://www.tensorflow.org/hub/)
* [Installation](docs/installation.md)
* [Build from source](docs/build_from_source.md)
* [Common issues](docs/common_issues.md)
* Tutorials:
* [Image Retraining](https://www.tensorflow.org/tutorials/image_retraining)
* [Text Cookbook](https://www.tensorflow.org/hub/tutorials/text_cookbook)
* [Additional Examples](examples/README.md)
* Key Concepts:
* [Using a Module](docs/basics.md)
* [Creating a New Module](docs/creating.md)
* [Fine-Tuning a Module](docs/fine_tuning.md)
* Modules:
* Find available modules on [tfhub.dev](https://tfhub.dev/)
* [Common Signatures for Modules](docs/common_signatures/index.md)
* [Introduction](https://www.tensorflow.org/hub/)
* The asset types of [tfhub.dev](https://tfhub.dev/)
* [SavedModels for TensorFlow 2](docs/tf2_saved_model.md)
* Deprecated: [hub.Modules for TensorFlow 1](docs/tf1_hub_module.md) and
their [Common Signatures](docs/common_signatures/index.md) collection.
* Using the library
* [Installation](docs/installation.md)
* [Migration to TF2](docs/migration_tf2.md)
* [Common issues](docs/common_issues.md)
* [Build from source](docs/build_from_source.md)
* [Hosting a module](docs/hosting.md)
* Tutorials
* [TF2 Image Retraining](https://colab.research.google.com/github/tensorflow/hub/blob/master/examples/colab/tf2_image_retraining.ipynb)
* [TF2 Text Classification](https://colab.research.google.com/github/tensorflow/hub/blob/master/examples/colab/tf2_text_classification.ipynb)
* [Additional TF1 and TF2 examples](examples/README.md)


## Contributing

If you'd like to contribute to TensorFlow Hub, be sure to review the
[contribution guidelines](CONTRIBUTING.md). This project adheres to TensorFlow's
[code of
[contribution guidelines](CONTRIBUTING.md). To contribute code to the
library itself (not examples), you will probably need to
[build from source](docs/build_from_source.md).

This project adheres to TensorFlow's [code of
conduct](https://github.com/tensorflow/tensorflow/blob/master/CODE_OF_CONDUCT.md). By
participating, you are expected to uphold this code.

Expand Down
3 changes: 3 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ limitations under the License.
==============================================================================-->

# Current version 0.7.0-dev
* Documentation update for TensorFlow 2.
* Use `hub.load()` and `hub.KerasLayer` with TF2 (also works in 1.15).
* For TF1, `hub.Module` and is associated APIs remain available.

# Release 0.6.0
* Added two examples for exporting of Hub/TF2 modules.
Expand Down
73 changes: 28 additions & 45 deletions docs/_book.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,75 +15,58 @@ upper_tabs:
contents:
- title: Overview
path: /hub/overview
- heading: Asset types
- title: SavedModels for TensorFlow 2
path: /hub/tf2_saved_model
- title: Deprecated: hub.Modules for TensorFlow 1
path: /hub/tf1_hub_module
- heading: Using the library
- title: Installation
path: /hub/installation
- title: Build from source
- title: Migration to TF2
path: /hub/migration_tf2
- title: Common issues
path: /hub/common_issues
- heading: Key Concepts
- title: Using a Module
path: /hub/basics
- title: Creating a new Module
path: /hub/creating
- title: Fine-Tuning
path: /hub/fine_tuning
- title: Build from source
path: /hub/build_from_source
- title: Hosting a Module
path: /hub/hosting
- title: Migration to TF2
path: /hub/migration_tf2
- heading: Tutorials
- title: Image retraining
path: /hub/tutorials/image_retraining
- title: Text classification
path: /hub/tutorials/text_classification_with_tf_hub
- title: Text cookbook
- title: Text classification - TF2
path: https://github.com/tensorflow/hub/blob/master/examples/colab/tf2_text_classification.ipynb
status: external
- title: Image classification - TF2
path: https://github.com/tensorflow/hub/blob/master/examples/colab/tf2_image_retraining.ipynb
status: external
- title: Object detection - TF2
path: https://github.com/tensorflow/hub/blob/master/examples/colab/object_detection.ipynb
status: external
- title: Text cookbook - TF1
path: /hub/tutorials/text_cookbook
- title: Action recognition
- title: Action recognition - TF1
path: https://github.com/tensorflow/hub/blob/master/examples/colab/action_recognition_with_tf_hub.ipynb
status: external
- title: BigGAN image generation
- title: BigGAN image generation - TF1
path: https://github.com/tensorflow/hub/blob/master/examples/colab/biggan_generation_with_tf_hub.ipynb
status: external
- title: Multilingual universal sentence encoder
- title: Multilingual universal sentence encoder - TF1
path: https://github.com/tensorflow/hub/blob/master/examples/colab/cross_lingual_similarity_with_tf_hub_multilingual_universal_encoder.ipynb
status: external
- title: Image transfer learning
path: https://github.com/tensorflow/hub/blob/master/examples/colab/image_feature_vector.ipynb
status: external
- title: Object detection
path: https://github.com/tensorflow/hub/blob/master/examples/colab/object_detection.ipynb
status: external
- title: Semantic similarity
- title: Semantic similarity - TF1
path: https://github.com/tensorflow/hub/blob/master/examples/colab/semantic_similarity_with_tf_hub_universal_encoder.ipynb
status: external
- title: Semantic similarity lite
- title: Semantic similarity lite - TF1
path: https://github.com/tensorflow/hub/blob/master/examples/colab/semantic_similarity_with_tf_hub_universal_encoder_lite.ipynb
status: external
- title: Text classification
path: https://github.com/tensorflow/hub/blob/master/examples/colab/text_classification_with_tf_hub.ipynb
status: external
- title: Text classification - kaggle
- title: Text classification on Kaggle - TF1
path: https://github.com/tensorflow/hub/blob/master/examples/colab/text_classification_with_tf_hub_on_kaggle.ipynb
status: external
- title: Image transfer learning - TF2
path: https://github.com/tensorflow/hub/blob/master/examples/colab/tf2_image_retraining.ipynb
status: external
- title: Text classification - TF2
path: https://github.com/tensorflow/hub/blob/master/examples/colab/tf2_text_classification.ipynb
status: external
- title: Image feature matching
- title: Image feature matching - TF1
path: https://github.com/tensorflow/hub/blob/master/examples/colab/tf_hub_delf_module.ipynb
status: external
- title: Image generation
- title: Image generation - TF1
path: https://github.com/tensorflow/hub/blob/master/examples/colab/tf_hub_generative_image_module.ipynb
status: external
- heading: Common Signatures
- title: Overview
path: /hub/common_signatures/
- title: Common Signatures for Images
path: /hub/common_signatures/images
- title: Common Signatures for Text
path: /hub/common_signatures/text
- name: API
skip_translation: true
contents:
Expand Down
9 changes: 5 additions & 4 deletions docs/_index.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is rendered on tensorflow.org/hub.
# ../README.md is rendered on github.com/tensorflow/hub.
# Both link to ./overview.md and ./*.md for detailed docs.
book_path: /hub/_book.yaml
project_path: /hub/_project.yaml
description: <!--no description-->
Expand Down Expand Up @@ -26,14 +29,12 @@ landing_page:
</div>
code_block: |
<pre class = "prettyprint">
!pip install "tensorflow_hub"
!pip install "tf-nightly"
!pip install "tensorflow_hub>=0.5.0"
!pip install "tensorflow>=2.0.0"
import tensorflow as tf
import tensorflow_hub as hub
tf.enable_eager_execution()
module_url = "https://tfhub.dev/google/tf2-preview/nnlm-en-dim128/1"
embed = hub.KerasLayer(module_url)
embeddings = embed(["A long sentence.", "single-word",
Expand Down
78 changes: 0 additions & 78 deletions docs/basics.md

This file was deleted.

47 changes: 0 additions & 47 deletions docs/creating.md

This file was deleted.

40 changes: 0 additions & 40 deletions docs/fine_tuning.md

This file was deleted.

4 changes: 4 additions & 0 deletions docs/hosting.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ $ tar -tf module.tar.gz
Tarballs for use with the deprecated `hub.Module()` API from TF1 will also
contain a `./tfhub_module.pb` file. The `hub.load()` API for TF2 SavedModels
ignores such a file.

The `tensorflow_hub` library expects that module URLs are versioned
and that the module content of a given version is immutable, so that it can
be cached indefinitely.
Loading

0 comments on commit 91370cb

Please sign in to comment.