Skip to content

Commit

Permalink
Expose premade package. Update version to release 0.4.2.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 386338223
  • Loading branch information
HongleiZhuang committed Jul 22, 2021
1 parent e0c009e commit 6cf8f70
Show file tree
Hide file tree
Showing 32 changed files with 3,402 additions and 72 deletions.
2 changes: 1 addition & 1 deletion tensorflow_ranking/examples/keras/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ py_library(
# tensorflow_models/official/core:config_definitions dep,
# tensorflow_models/official/core:exp_factory dep,
# tensorflow_models/official/modeling/optimization dep,
"//tensorflow_ranking/python/keras/premade:tfrbert_task",
"//tensorflow_ranking",
],
)

Expand Down
11 changes: 5 additions & 6 deletions tensorflow_ranking/examples/keras/tfrbert_task_experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,17 @@
from official.core import config_definitions as cfg
from official.core import exp_factory
from official.modeling import optimization
from tensorflow_ranking.python.keras.premade import tfrbert_task
import tensorflow_ranking as tfr


@exp_factory.register_config_factory('tfr_bert')
def tfrbert_exp() -> cfg.ExperimentConfig:
"""Defines a TFR-BERT experiment."""
config = cfg.ExperimentConfig(
task=tfrbert_task.TFRBertConfig(
train_data=tfrbert_task.TFRBertDataConfig(),
validation_data=tfrbert_task.TFRBertDataConfig(
is_training=False,
drop_remainder=False)),
task=tfr.keras.premade.TFRBertConfig(
train_data=tfr.keras.premade.TFRBertDataConfig(),
validation_data=tfr.keras.premade.TFRBertDataConfig(
is_training=False, drop_remainder=False)),
trainer=cfg.TrainerConfig(
optimizer_config=optimization.OptimizationConfig({
'optimizer': {
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_ranking/g3doc/api_docs/python/tfr.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ library.
__version__<a id="__version__"></a>
</td>
<td>
`'0.4.1.dev'`
`'0.4.2.dev'`
</td>
</tr>
</table>
608 changes: 594 additions & 14 deletions tensorflow_ranking/g3doc/api_docs/python/tfr/_api_cache.json

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions tensorflow_ranking/g3doc/api_docs/python/tfr/_redirects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,23 @@ redirects:
to: /ranking/api_docs/python/tfr/keras/canned/DNNRankingNetwork
- from: /ranking/api_docs/python/tfr/keras/canned/gam/GAMRankingNetwork
to: /ranking/api_docs/python/tfr/keras/canned/GAMRankingNetwork
- from: /ranking/api_docs/python/tfr/keras/premade/TensorLike
to: /ranking/api_docs/python/tfr/keras/model/TensorLike
- from: /ranking/api_docs/python/tfr/keras/premade/tfrbert_task/TFRBertConfig
to: /ranking/api_docs/python/tfr/keras/premade/TFRBertConfig
- from: /ranking/api_docs/python/tfr/keras/premade/tfrbert_task/TFRBertDataConfig
to: /ranking/api_docs/python/tfr/keras/premade/TFRBertDataConfig
- from: /ranking/api_docs/python/tfr/keras/premade/tfrbert_task/TFRBertDataLoader
to: /ranking/api_docs/python/tfr/keras/premade/TFRBertDataLoader
- from: /ranking/api_docs/python/tfr/keras/premade/tfrbert_task/TFRBertModelBuilder
to: /ranking/api_docs/python/tfr/keras/premade/TFRBertModelBuilder
- from: /ranking/api_docs/python/tfr/keras/premade/tfrbert_task/TFRBertModelConfig
to: /ranking/api_docs/python/tfr/keras/premade/TFRBertModelConfig
- from: /ranking/api_docs/python/tfr/keras/premade/tfrbert_task/TFRBertScorer
to: /ranking/api_docs/python/tfr/keras/premade/TFRBertScorer
- from: /ranking/api_docs/python/tfr/keras/premade/tfrbert_task/TFRBertTask
to: /ranking/api_docs/python/tfr/keras/premade/TFRBertTask
- from: /ranking/api_docs/python/tfr/keras/premade/tfrbert_task/TensorDict
to: /ranking/api_docs/python/tfr/keras/premade/TensorDict
- from: /ranking/api_docs/python/tfr/keras/premade/tfrbert_task/TensorLike
to: /ranking/api_docs/python/tfr/keras/model/TensorLike
24 changes: 24 additions & 0 deletions tensorflow_ranking/g3doc/api_docs/python/tfr/_toc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,30 @@ toc:
path: /ranking/api_docs/python/tfr/keras/pipeline/SimpleDatasetBuilder
- title: SimplePipeline
path: /ranking/api_docs/python/tfr/keras/pipeline/SimplePipeline
- title: premade
section:
- title: Overview
path: /ranking/api_docs/python/tfr/keras/premade
- title: TFRBertConfig
path: /ranking/api_docs/python/tfr/keras/premade/TFRBertConfig
- title: TFRBertDataConfig
path: /ranking/api_docs/python/tfr/keras/premade/TFRBertDataConfig
- title: TFRBertDataLoader
path: /ranking/api_docs/python/tfr/keras/premade/TFRBertDataLoader
- title: TFRBertModelBuilder
path: /ranking/api_docs/python/tfr/keras/premade/TFRBertModelBuilder
- title: TFRBertModelConfig
path: /ranking/api_docs/python/tfr/keras/premade/TFRBertModelConfig
- title: TFRBertScorer
path: /ranking/api_docs/python/tfr/keras/premade/TFRBertScorer
- title: TFRBertTask
path: /ranking/api_docs/python/tfr/keras/premade/TFRBertTask
- title: TensorDict
path: /ranking/api_docs/python/tfr/keras/premade/TensorDict
- title: tfrbert_task
section:
- title: Overview
path: /ranking/api_docs/python/tfr/keras/premade/tfrbert_task
- title: saved_model
section:
- title: Overview
Expand Down
20 changes: 20 additions & 0 deletions tensorflow_ranking/g3doc/api_docs/python/tfr/all_symbols.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,26 @@
* <a href="../tfr/keras/pipeline/PipelineHparams.md"><code>tfr.keras.pipeline.PipelineHparams</code></a>
* <a href="../tfr/keras/pipeline/SimpleDatasetBuilder.md"><code>tfr.keras.pipeline.SimpleDatasetBuilder</code></a>
* <a href="../tfr/keras/pipeline/SimplePipeline.md"><code>tfr.keras.pipeline.SimplePipeline</code></a>
* <a href="../tfr/keras/premade.md"><code>tfr.keras.premade</code></a>
* <a href="../tfr/keras/premade/TFRBertConfig.md"><code>tfr.keras.premade.TFRBertConfig</code></a>
* <a href="../tfr/keras/premade/TFRBertDataConfig.md"><code>tfr.keras.premade.TFRBertDataConfig</code></a>
* <a href="../tfr/keras/premade/TFRBertDataLoader.md"><code>tfr.keras.premade.TFRBertDataLoader</code></a>
* <a href="../tfr/keras/premade/TFRBertModelBuilder.md"><code>tfr.keras.premade.TFRBertModelBuilder</code></a>
* <a href="../tfr/keras/premade/TFRBertModelConfig.md"><code>tfr.keras.premade.TFRBertModelConfig</code></a>
* <a href="../tfr/keras/premade/TFRBertScorer.md"><code>tfr.keras.premade.TFRBertScorer</code></a>
* <a href="../tfr/keras/premade/TFRBertTask.md"><code>tfr.keras.premade.TFRBertTask</code></a>
* <a href="../tfr/keras/premade/TensorDict.md"><code>tfr.keras.premade.TensorDict</code></a>
* <a href="../tfr/keras/model/TensorLike.md"><code>tfr.keras.premade.TensorLike</code></a>
* <a href="../tfr/keras/premade/tfrbert_task.md"><code>tfr.keras.premade.tfrbert_task</code></a>
* <a href="../tfr/keras/premade/TFRBertConfig.md"><code>tfr.keras.premade.tfrbert_task.TFRBertConfig</code></a>
* <a href="../tfr/keras/premade/TFRBertDataConfig.md"><code>tfr.keras.premade.tfrbert_task.TFRBertDataConfig</code></a>
* <a href="../tfr/keras/premade/TFRBertDataLoader.md"><code>tfr.keras.premade.tfrbert_task.TFRBertDataLoader</code></a>
* <a href="../tfr/keras/premade/TFRBertModelBuilder.md"><code>tfr.keras.premade.tfrbert_task.TFRBertModelBuilder</code></a>
* <a href="../tfr/keras/premade/TFRBertModelConfig.md"><code>tfr.keras.premade.tfrbert_task.TFRBertModelConfig</code></a>
* <a href="../tfr/keras/premade/TFRBertScorer.md"><code>tfr.keras.premade.tfrbert_task.TFRBertScorer</code></a>
* <a href="../tfr/keras/premade/TFRBertTask.md"><code>tfr.keras.premade.tfrbert_task.TFRBertTask</code></a>
* <a href="../tfr/keras/premade/TensorDict.md"><code>tfr.keras.premade.tfrbert_task.TensorDict</code></a>
* <a href="../tfr/keras/model/TensorLike.md"><code>tfr.keras.premade.tfrbert_task.TensorLike</code></a>
* <a href="../tfr/keras/saved_model.md"><code>tfr.keras.saved_model</code></a>
* <a href="../tfr/keras/saved_model/Signatures.md"><code>tfr.keras.saved_model.Signatures</code></a>
* <a href="../tfr/keras/strategy_utils.md"><code>tfr.keras.strategy_utils</code></a>
Expand Down
3 changes: 3 additions & 0 deletions tensorflow_ranking/g3doc/api_docs/python/tfr/keras.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ tfr.keras.
[`pipeline`](../tfr/keras/pipeline.md) module: Ranking pipeline to train
tf.keras.Model in tfr.keras.

[`premade`](../tfr/keras/premade.md) module: TensorFlow Ranking Premade Orbit
Task Module.

[`saved_model`](../tfr/keras/saved_model.md) module: SavedModel utilities for
TF-Ranking.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ description: The central part of internal API.
# tfr.keras.model.TensorDict

<!-- Insert buttons and diff -->

This symbol is a **type alias**.

The central part of internal API.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,6 @@ batch.
</table>

<!-- Tabular view -->

<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
Expand Down Expand Up @@ -1504,7 +1503,6 @@ the same key to combine in a single batch, which will be passed to
</table>

<!-- Tabular view -->

<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
Expand Down Expand Up @@ -2499,7 +2497,6 @@ accumulates one or more state tensors, whose initial values are `initial_state`.
```

<!-- Tabular view -->

<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
Expand All @@ -2526,7 +2523,6 @@ structure of `initial_state`.
</table>

<!-- Tabular view -->

<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
Expand Down Expand Up @@ -2874,7 +2870,6 @@ By default, snapshot parallelizes reads by the number of cores available on the
system, but will not attempt to shuffle the data.

<!-- Tabular view -->

<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
Expand Down Expand Up @@ -2917,7 +2912,6 @@ a snapshot.
</table>

<!-- Tabular view -->

<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
Expand Down Expand Up @@ -2997,7 +2991,6 @@ A transformation that stops dataset iteration based on a `predicate`.
```

<!-- Tabular view -->

<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Args</th></tr>
Expand All @@ -3015,7 +3008,6 @@ shapes and types defined by `self.output_shapes` and
</table>

<!-- Tabular view -->

<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
Expand Down Expand Up @@ -3086,7 +3078,6 @@ Note: This transformation only supports datasets which fit into memory and have
elements of either `tf.int32`, `tf.int64` or `tf.string` type.

<!-- Tabular view -->

<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2">Returns</th></tr>
Expand Down
82 changes: 82 additions & 0 deletions tensorflow_ranking/g3doc/api_docs/python/tfr/keras/premade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
description: TensorFlow Ranking Premade Orbit Task Module.

<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tfr.keras.premade" />
<meta itemprop="path" content="Stable" />
<meta itemprop="property" content="DOCUMENT_ID"/>
<meta itemprop="property" content="QUERY_ID"/>
</div>

# Module: tfr.keras.premade

<!-- Insert buttons and diff -->

<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/ranking/tree/master/tensorflow_ranking/python/keras/premade/__init__.py">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
</td>
</table>

TensorFlow Ranking Premade Orbit Task Module.

## Modules

[`tfrbert_task`](../../tfr/keras/premade/tfrbert_task.md) module: TF-Ranking
BERT task.

## Classes

[`class TFRBertConfig`](../../tfr/keras/premade/TFRBertConfig.md): The
tf-ranking BERT task config.

[`class TFRBertDataConfig`](../../tfr/keras/premade/TFRBertDataConfig.md): Data
config for TFR-BERT task.

[`class TFRBertDataLoader`](../../tfr/keras/premade/TFRBertDataLoader.md): A
class to load dataset for TFR-BERT task.

[`class TFRBertModelBuilder`](../../tfr/keras/premade/TFRBertModelBuilder.md):
Model builder for TFR-BERT models.

[`class TFRBertModelConfig`](../../tfr/keras/premade/TFRBertModelConfig.md): A
TFR-BERT model configuration.

[`class TFRBertScorer`](../../tfr/keras/premade/TFRBertScorer.md): Univariate
BERT-based scorer.

[`class TFRBertTask`](../../tfr/keras/premade/TFRBertTask.md): Task object for
tf-ranking BERT.

## Type Aliases

[`TensorDict`](../../tfr/keras/premade/TensorDict.md): The central part of
internal API.

[`TensorLike`](../../tfr/keras/model/TensorLike.md): Union of all types that can
be converted to a `tf.Tensor` by `tf.convert_to_tensor`.

<!-- Tabular view -->

<table class="responsive fixed orange">
<colgroup><col width="214px"><col></colgroup>
<tr><th colspan="2"><h2 class="add-link">Other Members</h2></th></tr>

<tr>
<td>
DOCUMENT_ID<a id="DOCUMENT_ID"></a>
</td>
<td>
`'document_id'`
</td>
</tr><tr>
<td>
QUERY_ID<a id="QUERY_ID"></a>
</td>
<td>
`'query_id'`
</td>
</tr>
</table>
Loading

0 comments on commit 6cf8f70

Please sign in to comment.