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

Initial setup for tensorflow subsite #486

Merged
merged 6 commits into from Sep 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitignore
Expand Up @@ -42,6 +42,3 @@ wheels/
/.bazelrc
/bazel-*
/artifacts

# Addons
/docs/
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Expand Up @@ -17,9 +17,9 @@ let us give you advice on the proposed changes. If the changes are
minor, then feel free to make them without discussion.

Want to contribute but not sure of what? Here are a few suggestions:
1. Add a new example or tutorial. Located in [`examples/`](examples),
1. Add a new tutorial. Located in [`docs/tutorials/`](docs/tutorials),
these are a great way to familiarize yourself and others with TF-Addons. See
[the guidelines](examples/README.md) for more information on how to add
[the guidelines](docs/tutorials/README.md) for more information on how to add
examples.
2. Solve an [existing issue](https://github.com/tensorflow/addons/issues).
These range from low-level software bugs to higher-level design problems.
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
@@ -1 +1,2 @@
recursive-include tensorflow_addons/ *.so
include docs/*
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -84,8 +84,8 @@ bazel-bin/build_pip_pkg artifacts
pip install artifacts/tensorflow_addons-*.whl
```

## Examples
See [`examples/`](examples/)
## Tutorials
See [`docs/tutorials/`](docs/tutorials/)
for end-to-end examples of various addons.

## Core Concepts
Expand Down
46 changes: 46 additions & 0 deletions docs/_book.yaml
@@ -0,0 +1,46 @@
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
upper_tabs:
# Tabs left of dropdown menu
- include: /_upper_tabs_left.yaml
- include: /api_docs/_upper_tabs_api.yaml
# Dropdown menu
- name: Resources
path: /resources
is_default: true
menu:
- include: /resources/_menu_toc.yaml
lower_tabs:
# Subsite tabs
other:
- name: tutorials
contents:
- title: Triplet loss
path: /addons/tutorials/losses_triplet
- title: Image Ops
path: /addons/tutorials/image_ops
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lamberta So this part I'm still unclear on. Where does the directory "addons" come from? Is it just the repository name?

Does it need to be addons/docs/tutorials/*?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"/addons/tutorials/losses_triplet" is correct.

The workflow is "take a directory and put it on the site". Addons is just the name for this directory on the site.

So we'll set up the tools to take "https://github.com/tensorflow/addons/tree/master/docs" and put it on the site as "tensorflow.org/addons".

So two things to remember about links for that:

  1. Use relative links when linking between files within the directory (so users keep their github/colab/tensorflow.org context). Use full URLs if you need to link to something outside of the directory. Never use absolute path links.

  2. In notebooks and markdown tfa.thing will be auto-linked to the appropriate api-page, if it exists.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great thanks. So just to be clear will the utilized directory always come from master branch? At the moment we only generate docs for our release branches, but that'd probably require you pulling down a new directory for each release.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MarkDaoust @lamberta Friendly bump on this question and then we can look to merge this. Are we required to have the latest releases API docs on our master branch?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we required to have the latest releases API docs on our master branch?

No, we've simplified the setup. There is now no requirement to have api_docs in you repo at all. When we generate the site, we'll run your build_docs.py script against your latest pip package, to generate the api_docs pages.

So just to be clear will the utilized directory always come from master branch?

Yes. While api reference material is generated from your pip package, we pull the rest of the docs from master so that doc-fixes don't need to wait for a release.

The one caution there is that notebooks demonstrating features for a future release need to be sure to pip install an appropriate nightly or preview package, but if you're test running things in colab, for example, that should be easy to remember.

- title: Normalization layers
path: /addons/tutorials/layers_normalizations
- title: Weight normalization layer
path: /addons/tutorials/layers_weightnormalization
- title: Lazyadam optimizer
path: /addons/tutorials/optimizers_lazyadam
- name: API
skip_translation: true
contents:
- include: /addons/api_docs/python/_toc.yaml
seanpmorgan marked this conversation as resolved.
Show resolved Hide resolved

- include: /_upper_tabs_right.yaml
77 changes: 77 additions & 0 deletions docs/_index.yaml
@@ -0,0 +1,77 @@
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
book_path: /addons/_book.yaml
project_path: /addons/_project.yaml
description: <!--no description-->
landing_page:
custom_css_path: /site-assets/css/style.css
rows:
- heading: TensorFlow Addons provides useful extra functionality for TensorFlow 2.0 maintained by SIG-addons
items:
- classname: devsite-landing-row-50
description: >
TensorFlow Addons is a repository of contributions that conform to
well-established API patterns, but implement new functionality
not available in core TensorFlow. TensorFlow natively supports
a large number of operators, layers, metrics, losses, and
optimizers. However, in a fast moving field like ML, there are many
interesting new developments that cannot be integrated into core
TensorFlow (because their broad applicability is not yet clear, or
it is mostly used by a smaller subset of the community).
code_block: |
<pre class = "prettyprint">
import tensorflow as tf
import tensorflow_addons as tfa

# Load MNIST dataset as NumPy arrays
dataset = {}
num_validation = 10000
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()

# Preprocess the data
x_train = x_train.reshape(-1, 784).astype('float32') / 255
x_test = x_test.reshape(-1, 784).astype('float32') / 255

# Compile the model
model.compile(
optimizer=tfa.optimizers.LazyAdam(0.001), # Utilize TFA optimizer
loss=tf.keras.losses.SparseCategoricalCrossentropy(),
metrics=['accuracy'])

# Train the network
history = model.fit(
x_train,
y_train,
batch_size=24,
epochs=10)
</pre>
{% dynamic if request.tld != 'cn' %}
<a class="colab-button" target="_blank" href="https://colab.research.google.com/github/tensorflow/addons/blob/master/docs/tutorials/optimizers_lazyadam.ipynb">Run in a <span>Notebook</span></a>
{% dynamic endif %}
seanpmorgan marked this conversation as resolved.
Show resolved Hide resolved
- classname: devsite-landing-row-cards
items:
- heading: "Introducing TensorFlow Addons"
image_path: /resources/images/tf-logo-card-16x9.png
path: https://medium.com/tensorflow/introducing-tensorflow-addons-6131a50a3dcf
buttons:
- label: "Read on TensorFlow blog"
path: https://medium.com/tensorflow/introducing-tensorflow-addons-6131a50a3dcf
- heading: "TensorFlow Addons on GitHub"
image_path: /resources/images/github-card-16x9.png
path: https://github.com/tensorflow/addons
buttons:
- label: "View on GitHub"
path: https://github.com/tensorflow/addons
26 changes: 26 additions & 0 deletions docs/_project.yaml
@@ -0,0 +1,26 @@
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
name: TensorFlow Addons
breadcrumb_name: Addons
home_url: /addons/
parent_project_metadata_path: /_project.yaml
description: >
"TensorFlow Addons is a library of useful extra functionality for
TensorFlow 2.0 maintained by SIG-addons"
use_site_branding: true
hide_from_products_list: true
content_license: cc-apache
include: /_project_included.yaml
8 changes: 4 additions & 4 deletions examples/README.md → docs/tutorials/README.md
@@ -1,18 +1,18 @@
# TensorFlow Addons Examples
# TensorFlow Addons Tutorials

TensorFlow Addons welcomes and highly encourages example contributions.
TensorFlow Addons welcomes and highly encourages tutorial contributions.


## How To Contribute

Addons examples are created using [Google Colab](https://colab.research.google.com/)
Addons tutorials are created using [Google Colab](https://colab.research.google.com/)
and the jupyter notebooks are saved to this directory in the repository. To do
this, follow the below steps:

1. Create a new branch on your fork of TensorFlow Addons
2. Goto [Google Colab](https://colab.research.google.com/) and start a new
notebook using addons example template:
[examples/template.ipynb](template.ipynb)
[docs/tutorials/template.ipynb](template.ipynb)
3. Edit the the links for the "View source on GitHub" and "Run in Google Colab"
URL boxes so that they match the name of your new example notebook
4. Follow the guidelines of the template
Expand Down
4 changes: 2 additions & 2 deletions examples/image_ops.ipynb → docs/tutorials/image_ops.ipynb
Expand Up @@ -59,10 +59,10 @@
"\n",
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
" <td>\n",
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/addons/blob/master/examples/image_ops.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/addons/blob/master/docs/tutorials/image_ops.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
" </td>\n",
" <td>\n",
" <a target=\"_blank\" href=\"https://github.com/tensorflow/addons/blob/master/examples/image_ops.ipynb\"><img src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" />View source on GitHub</a>\n",
" <a target=\"_blank\" href=\"https://github.com/tensorflow/addons/blob/master/docs/tutorials/image_ops.ipynb\"><img src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" />View source on GitHub</a>\n",
" </td>\n",
"</table>"
]
Expand Down
Expand Up @@ -61,10 +61,10 @@
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
"\n",
" <td>\n",
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/addons/blob/master/examples/layers_normalizations.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/addons/blob/master/docs/tutorials/layers_normalizations.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
" </td>\n",
" <td>\n",
" <a target=\"_blank\" href=\"https://github.com/tensorflow/addons/blob/master/examples/layers_normalizations.ipynb\"><img src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" />View source on GitHub</a>\n",
" <a target=\"_blank\" href=\"https://github.com/tensorflow/addons/blob/master/docs/tutorials/layers_normalizations.ipynb\"><img src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" />View source on GitHub</a>\n",
" </td>\n",
"</table>\n"
]
Expand Down
Expand Up @@ -61,10 +61,10 @@
"\n",
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
" <td>\n",
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/addons/blob/master/examples/layers_weightnormalization.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/addons/blob/master/docs/tutorials/layers_weightnormalization.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
" </td>\n",
" <td>\n",
" <a target=\"_blank\" href=\"https://github.com/tensorflow/addons/blob/master/examples/layers_weightnormalizations.ipynb\"><img src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" />View source on GitHub</a>\n",
" <a target=\"_blank\" href=\"https://github.com/tensorflow/addons/blob/master/docs/tutorials/layers_weightnormalizations.ipynb\"><img src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" />View source on GitHub</a>\n",
" </td>\n",
"</table>"
]
Expand Down
Expand Up @@ -61,10 +61,10 @@
"\n",
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
" <td>\n",
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/addons/blob/master/examples/losses_triplet.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/addons/blob/master/docs/tutorials/losses_triplet.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
" </td>\n",
" <td>\n",
" <a target=\"_blank\" href=\"https://github.com/tensorflow/addons/blob/master/examples/losses_triplet.ipynb\"><img src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" />View source on GitHub</a>\n",
" <a target=\"_blank\" href=\"https://github.com/tensorflow/addons/blob/master/docs/tutorials/losses_triplet.ipynb\"><img src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" />View source on GitHub</a>\n",
" </td>\n",
"</table>"
]
Expand Down
Expand Up @@ -61,10 +61,10 @@
"\n",
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
" <td>\n",
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/addons/blob/master/examples/optimizers_lazyadam.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/addons/blob/master/docs/tutorials/optimizers_lazyadam.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
" </td>\n",
" <td>\n",
" <a target=\"_blank\" href=\"https://github.com/tensorflow/addons/blob/master/examples/optimizers_lazyadam.ipynb\"><img src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" />View source on GitHub</a>\n",
" <a target=\"_blank\" href=\"https://github.com/tensorflow/addons/blob/master/docs/tutorials/optimizers_lazyadam.ipynb\"><img src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" />View source on GitHub</a>\n",
" </td>\n",
"</table>"
]
Expand Down
4 changes: 2 additions & 2 deletions examples/template.ipynb → docs/tutorials/template.ipynb
Expand Up @@ -71,10 +71,10 @@
"source": [
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
" <td>\n",
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/addons/blob/master/examples/template.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/addons/blob/master/docs/tutorials/template.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n",
" </td>\n",
" <td>\n",
" <a target=\"_blank\" href=\"https://github.com/tensorflow/addons/blob/master/examples/template.ipynb\"><img src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" />View source on GitHub</a>\n",
" <a target=\"_blank\" href=\"https://github.com/tensorflow/addons/blob/master/docs/tutorials/template.ipynb\"><img src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" />View source on GitHub</a>\n",
" </td>\n",
"</table>"
]
Expand Down