Skip to content

Commit

Permalink
A few typos were updated in documentation.
Browse files Browse the repository at this point in the history
Reference respective Github PR's.
#10955
#10928
#10892
#11100
#11107
#11123
#11120
#11118
#11111
#11144

PiperOrigin-RevId: 604865440
  • Loading branch information
tensorflower-gardener committed Feb 7, 2024
1 parent 9ecdb57 commit 50aa3dd
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Public docs for TensorFlow Models

This directory contains the top-level public documentation for
[TensorFlow Models](https://github.com/tensorflow/models)
[TensorFlow Models](https://github.com/tensorflow/models).

This directory is mirrored to https://tensorflow.org/tfmodels, and is mainly
concerned with documenting the tools provided in the `tensorflow_models` pip
Expand Down
16 changes: 8 additions & 8 deletions docs/nlp/fine_tune_bert.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@
"id": "2oHOql35k3Dd"
},
"source": [
"Note: The pretrained `TransformerEncoder` is also available on [TensorFlow Hub](https://tensorflow.org/hub). Go to the [TF Hub appendix](#hub_bert) for details."
"Note: The pre-trained `TransformerEncoder` is also available on [TensorFlow Hub](https://tensorflow.org/hub). Go to the [TF Hub appendix](#hub_bert) for details."
]
},
{
Expand Down Expand Up @@ -1148,8 +1148,8 @@
"\n",
"First, build a wrapper class to export the model. This wrapper does two things:\n",
"\n",
"- First it packages `bert_inputs_processor` and `bert_classifier` together into a single `tf.Module`, so you can export all the functionalities.\n",
"- Second it defines a `tf.function` that implements the end-to-end execution of the model.\n",
"- First, it packages `bert_inputs_processor` and `bert_classifier` together into a single `tf.Module`, so you can export all the functionalities.\n",
"- Second, it defines a `tf.function` that implements the end-to-end execution of the model.\n",
"\n",
"Setting the `input_signature` argument of `tf.function` lets you define a fixed signature for the `tf.function`. This can be less surprising than the default automatic retracing behavior."
]
Expand Down Expand Up @@ -1189,7 +1189,7 @@
"id": "qnxysGUfIgFQ"
},
"source": [
"Create an instance of this export-model and save it:"
"Create an instance of this exported model and save it:"
]
},
{
Expand Down Expand Up @@ -1280,7 +1280,7 @@
"id": "CPsg7dZwfBM2"
},
"source": [
"Congratulations! You've used `tensorflow_models` to build a BERT-classifier, train it, and export for later use."
"Congratulations! You've used `tensorflow_models` to build a BERT-classifier, train it, and export it for later use."
]
},
{
Expand Down Expand Up @@ -1391,7 +1391,7 @@
"id": "cjojn8SmLSRI"
},
"source": [
"At this point it would be simple to add a classification head yourself.\n",
"At this point, it would be simple to add a classification head yourself.\n",
"\n",
"The Model Garden `tfm.nlp.models.BertClassifier` class can also build a classifier onto the TF Hub encoder:"
]
Expand Down Expand Up @@ -1429,7 +1429,7 @@
"id": "u_IqwXjRV1vd"
},
"source": [
"For concrete examples of this approach, refer to [Solve Glue tasks using BERT](https://www.tensorflow.org/text/tutorials/bert_glue)."
"For concrete examples of this approach, refer to [Solve Glue tasks using the BERT](https://www.tensorflow.org/text/tutorials/bert_glue)."
]
},
{
Expand Down Expand Up @@ -1494,7 +1494,7 @@
"id": "ywn5miD_dnuh"
},
"source": [
"The advantage to using `config` objects is that they don't contain any complicated TensorFlow objects, and can be easily serialized to JSON, and rebuilt. Here's the JSON for the above `tfm.optimization.OptimizationConfig`:"
"The advantage of using `config` objects is that they don't contain any complicated TensorFlow objects, and can be easily serialized to JSON, and rebuilt. Here's the JSON for the above `tfm.optimization.OptimizationConfig`:"
]
},
{
Expand Down
16 changes: 8 additions & 8 deletions official/README-TPU.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@

## Natural Language Processing

* [bert](nlp/bert): A powerful pre-trained language representation model:
* [bert](https://arxiv.org/abs/1810.04805): A powerful pre-trained language representation model:
BERT, which stands for Bidirectional Encoder Representations from
Transformers.
[BERT FineTuning with Cloud TPU](https://cloud.google.com/tpu/docs/tutorials/bert-2.x) provides step by step instructions on Cloud TPU training. You can look [Bert MNLI Tensorboard.dev metrics](https://tensorboard.dev/experiment/LijZ1IrERxKALQfr76gndA) for MNLI fine tuning task.
[BERT FineTuning with Cloud TPU](https://cloud.google.com/ai-platform/training/docs/algorithms/bert-start) provides step by step instructions on Cloud TPU training. You can look [Bert MNLI Tensorboard.dev metrics](https://tensorboard.dev/experiment/LijZ1IrERxKALQfr76gndA) for MNLI fine tuning task.
* [transformer](nlp/transformer): A transformer model to translate the WMT
English to German dataset.
[Training transformer on Cloud TPU](https://cloud.google.com/tpu/docs/tutorials/transformer-2.x) for step by step instructions on Cloud TPU training.

## Computer Vision

* [efficientnet](vision/image_classification): A family of convolutional
* [efficientnet](https://github.com/tensorflow/models/blob/master/official/vision/modeling/backbones/efficientnet.py): A family of convolutional
neural networks that scale by balancing network depth, width, and
resolution and can be used to classify ImageNet's dataset of 1000 classes.
See [Tensorboard.dev training metrics](https://tensorboard.dev/experiment/KnaWjrq5TXGfv0NW5m7rpg/#scalars).
* [mnist](vision/image_classification): A basic model to classify digits
* [mnist](https://www.tensorflow.org/datasets/catalog/mnist): A basic model to classify digits
from the MNIST dataset. See [Running MNIST on Cloud TPU](https://cloud.google.com/tpu/docs/tutorials/mnist-2.x) tutorial and [Tensorboard.dev metrics](https://tensorboard.dev/experiment/mIah5lppTASvrHqWrdr6NA).
* [mask-rcnn](vision/detection): An object detection and instance segmentation model. See [Tensorboard.dev training metrics](https://tensorboard.dev/experiment/LH7k0fMsRwqUAcE09o9kPA).
* [resnet](vision/image_classification): A deep residual network that can
* [mask-rcnn](https://www.tensorflow.org/api_docs/python/tfm/vision/configs/maskrcnn/MaskRCNN): An object detection and instance segmentation model. See [Tensorboard.dev training metrics](https://tensorboard.dev/experiment/LH7k0fMsRwqUAcE09o9kPA).
* [resnet]((https://www.tensorflow.org/api_docs/python/tfm/vision/configs/image_classification/image_classification_imagenet)): A deep residual network that can
be used to classify ImageNet's dataset of 1000 classes.
See [Training ResNet on Cloud TPU](https://cloud.google.com/tpu/docs/tutorials/resnet-2.x) tutorial and [Tensorboard.dev metrics](https://tensorboard.dev/experiment/CxlDK8YMRrSpYEGtBRpOhg).
* [retinanet](vision/detection): A fast and powerful object detector. See [Tensorboard.dev training metrics](https://tensorboard.dev/experiment/b8NRnWU3TqG6Rw0UxueU6Q).
* [shapemask](vision/detection): An object detection and instance segmentation model using shape priors. See [Tensorboard.dev training metrics](https://tensorboard.dev/experiment/ZbXgVoc6Rf6mBRlPj0JpLA).
* [retinanet](https://www.tensorflow.org/api_docs/python/tfm/vision/retinanet): A fast and powerful object detector. See [Tensorboard.dev training metrics](https://tensorboard.dev/experiment/b8NRnWU3TqG6Rw0UxueU6Q).
* [shapemask](https://cloud.google.com/tpu/docs/tutorials/shapemask-2.x): An object detection and instance segmentation model using shape priors. See [Tensorboard.dev training metrics](https://tensorboard.dev/experiment/ZbXgVoc6Rf6mBRlPj0JpLA).

## Recommendation
* [dlrm](recommendation/ranking): [Deep Learning Recommendation Model for
Expand Down
4 changes: 2 additions & 2 deletions official/nlp/MODEL_GARDEN.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ on how to train models with this codebase.
By default, the experiment runs on GPUs. To run on TPUs, one should overwrite
`runtime.distribution_strategy` and set the tpu address. See [RuntimeConfig](https://github.com/tensorflow/models/blob/master/official/core/config_definitions.py) for details.

In general, the experiments can run with the folloing command by setting the
In general, the experiments can run with the following command by setting the
corresponding `${TASK}`, `${TASK_CONFIG}`, `${MODEL_CONFIG}`.
```
EXPERIMENT=???
Expand Down Expand Up @@ -72,7 +72,7 @@ Note that

[How to Train Models](https://github.com/tensorflow/models/blob/master/official/nlp/docs/train.md)

[List of Pretrained Models for finetuning](https://github.com/tensorflow/models/blob/master/official/nlp/docs/pretrained_models.md)
[List of Pre-trained Models for finetuning](https://github.com/tensorflow/models/blob/master/official/nlp/docs/pretrained_models.md)

[How to Publish Models](https://github.com/tensorflow/models/blob/master/official/nlp/docs/tfhub.md)

Expand Down
2 changes: 1 addition & 1 deletion official/nlp/data/classifier_data_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ def __init__(self,
self._labels = list(range(info.features[self.label_key].num_classes))

def _process_tfds_params_str(self, params_str):
"""Extracts TFDS parameters from a comma-separated assignements string."""
"""Extracts TFDS parameters from a comma-separated assignments string."""
dtype_map = {"int": int, "float": float}
cast_str_to_bool = lambda s: s.lower() not in ["false", "0"]

Expand Down
4 changes: 2 additions & 2 deletions official/nlp/data/create_finetuning_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
"while ALBERT uses SentencePiece tokenizer.")

flags.DEFINE_string(
"tfds_params", "", "Comma-separated list of TFDS parameter assigments for "
"tfds_params", "", "Comma-separated list of TFDS parameter assignments for "
"generic classfication data import (for more details "
"see the TfdsProcessor class documentation).")

Expand Down Expand Up @@ -270,7 +270,7 @@ def generate_classifier_dataset():
}
task_name = FLAGS.classification_task_name.lower()
if task_name not in processors:
raise ValueError("Task not found: %s" % (task_name))
raise ValueError("Task not found: %s" % (task_name,))

processor = processors[task_name](process_text_fn=processor_text_fn)
return classifier_data_lib.generate_tf_record_from_data_file(
Expand Down
6 changes: 3 additions & 3 deletions official/nlp/data/create_pretraining_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ def _contiguous(sorted_grams):
def _masking_ngrams(grams, max_ngram_size, max_masked_tokens, rng):
"""Create a list of masking {1, ..., n}-grams from a list of one-grams.
This is an extention of 'whole word masking' to mask multiple, contiguous
This is an extension of 'whole word masking' to mask multiple, contiguous
words such as (e.g., "the red boat").
Each input gram represents the token indices of a single word,
Expand Down Expand Up @@ -509,7 +509,7 @@ def _masking_ngrams(grams, max_ngram_size, max_masked_tokens, rng):
rng.shuffle(v)

# Create the weighting for n-gram length selection.
# Stored cummulatively for `random.choices` below.
# Stored cumulatively for `random.choices` below.
cummulative_weights = list(
itertools.accumulate([1./n for n in range(1, max_ngram_size+1)]))

Expand All @@ -519,7 +519,7 @@ def _masking_ngrams(grams, max_ngram_size, max_masked_tokens, rng):
# Loop until we have enough masked tokens or there are no more candidate
# n-grams of any length.
# Each code path should ensure one or more elements from `ngrams` are removed
# to guarentee this loop terminates.
# to guarantee this loop terminates.
while (sum(masked_tokens) < max_masked_tokens and
sum(len(s) for s in ngrams.values())):
# Pick an n-gram size based on our weights.
Expand Down
2 changes: 1 addition & 1 deletion official/nlp/data/create_xlnet_pretraining_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def _create_a_and_b_segments(
Args:
tokens: The 1D input token ids. This represents an individual entry within a
batch.
sentence_ids: The 1D input sentence ids. This represents an indivdual entry
sentence_ids: The 1D input sentence ids. This represents an individual entry
within a batch. This should be the same length as `tokens`.
begin_index: The reference beginning index to split data.
total_length: The target combined length of segments A and B.
Expand Down
4 changes: 2 additions & 2 deletions official/nlp/data/pretrain_dataloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class XLNetPretrainDataConfig(cfg.DataConfig):
Attributes:
input_path: See base class.
global_batch_size: See base calss.
global_batch_size: See base class.
is_training: See base class.
seq_length: The length of each sequence.
max_predictions_per_seq: The number of predictions per sequence.
Expand Down Expand Up @@ -259,7 +259,7 @@ def _parse(self, record: Mapping[str, tf.Tensor]):
input_mask=input_mask[:self._reuse_length])

# Creates permutation mask and target mask for the rest of tokens in
# current example, which are concatentation of two new segments.
# current example, which are concatenation of two new segments.
perm_mask_1, target_mask_1, tokens_1, masked_1 = self._get_factorization(
inputs[self._reuse_length:], input_mask[self._reuse_length:])

Expand Down
6 changes: 3 additions & 3 deletions official/nlp/data/squad_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ def _improve_answer_span(doc_tokens, input_start, input_end, tokenizer,
#
# However, this is not always possible. Consider the following:
#
# Question: What country is the top exporter of electornics?
# Question: What country is the top exporter of electronics?
# Context: The Japanese electronics industry is the lagest in the world.
# Answer: Japan
#
Expand Down Expand Up @@ -720,7 +720,7 @@ def postprocess_output(all_examples,
start_logit=pred.start_logit,
end_logit=pred.end_logit))

# if we didn't inlude the empty option in the n-best, inlcude it
# if we didn't include the empty option in the n-best, include it
if version_2_with_negative and not xlnet_format:
if "" not in seen_predictions:
nbest.append(
Expand Down Expand Up @@ -815,7 +815,7 @@ def get_final_text(pred_text, orig_text, do_lower_case, verbose=False):
# What we really want to return is "Steve Smith".
#
# Therefore, we have to apply a semi-complicated alignment heruistic between
# `pred_text` and `orig_text` to get a character-to-charcter alignment. This
# `pred_text` and `orig_text` to get a character-to-character alignment. This
# can fail in certain cases in which case we just return `orig_text`.

def _strip_spaces(text):
Expand Down
4 changes: 2 additions & 2 deletions official/nlp/data/squad_lib_sp.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __repr__(self):
tokenization.printable_text(self.question_text))
s += ", paragraph_text: [%s]" % (" ".join(self.paragraph_text))
if self.start_position:
s += ", start_position: %d" % (self.start_position)
s += ", start_position: %d" % (self.start_position,)
if self.start_position:
s += ", end_position: %d" % (self.end_position)
if self.start_position:
Expand Down Expand Up @@ -776,7 +776,7 @@ def postprocess_output(all_examples,
start_logit=pred.start_logit,
end_logit=pred.end_logit))

# if we didn't inlude the empty option in the n-best, include it
# if we didn't include the empty option in the n-best, include it
if version_2_with_negative and not xlnet_format:
if "" not in seen_predictions:
nbest.append(
Expand Down
2 changes: 1 addition & 1 deletion official/nlp/data/wmt_dataloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def _batch_examples(dataset, batch_size, max_length):
# Validates bucket batch sizes.
if any([batch_size <= 0 for batch_size in bucket_batch_sizes]):
raise ValueError(
'The token budget, global batch size, is too small to yeild 0 bucket '
'The token budget, global batch size, is too small to yield 0 bucket '
'window: %s' % str(bucket_batch_sizes))

# bucket_id will be a tensor, so convert this list to a tensor as well.
Expand Down
2 changes: 1 addition & 1 deletion official/nlp/modeling/ops/beam_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ def _gather_beams(nested, beam_indices, batch_size, new_beam_size):
Nested structure containing tensors with shape
[batch_size, new_beam_size, ...]
"""
# Computes the i'th coodinate that contains the batch index for gather_nd.
# Computes the i'th coordinate that contains the batch index for gather_nd.
# Batch pos is a tensor like [[0,0,0,0,],[1,1,1,1],..].
batch_pos = tf.range(batch_size * new_beam_size) // new_beam_size
batch_pos = tf.reshape(batch_pos, [batch_size, new_beam_size])
Expand Down
18 changes: 9 additions & 9 deletions official/nlp/modeling/ops/segment_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def _get_random(positions, random_fn):
return positions.with_flat_values(flat_random)


# For every position j in a row, sample a position preceeding j or
# For every position j in a row, sample a position preceding j or
# a position which is [0, j-1]
def _random_int_up_to(maxval, random_fn):
# Need to cast because the int kernel for uniform doesn't support bcast.
Expand Down Expand Up @@ -87,22 +87,22 @@ def get_sentence_order_labels(sentences,
dtype.
random_threshold: (optional) A float threshold between 0 and 1, used to
determine whether to extract a random, out-of-batch sentence or a
suceeding sentence. Higher value favors succeeding sentence.
succeeding sentence. Higher value favors succeeding sentence.
random_next_threshold: (optional) A float threshold between 0 and 1, used to
determine whether to extract either a random, out-of-batch, or succeeding
sentence or a preceeding sentence. Higher value favors preceeding
sentence or a preceding sentence. Higher value favors preceding
sentences.
random_fn: (optional) An op used to generate random float values.
Returns:
a tuple of (preceeding_or_random_next, is_suceeding_or_random) where:
preceeding_or_random_next: a `RaggedTensor` of strings with the same shape
as `sentences` and contains either a preceeding, suceeding, or random
a tuple of (preceding_or_random_next, is_succeeding_or_random) where:
preceding_or_random_next: a `RaggedTensor` of strings with the same shape
as `sentences` and contains either a preceding, succeeding, or random
out-of-batch sentence respective to its counterpart in `sentences` and
dependent on its label in `is_preceeding_or_random_next`.
is_suceeding_or_random: a `RaggedTensor` of bool values with the
dependent on its label in `is_preceding_or_random_next`.
is_succeeding_or_random: a `RaggedTensor` of bool values with the
same shape as `sentences` and is True if it's corresponding sentence in
`preceeding_or_random_next` is a random or suceeding sentence, False
`preceding_or_random_next` is a random or succeeding sentence, False
otherwise.
"""
# Create a RaggedTensor in the same shape as sentences ([doc, (sentences)])
Expand Down

0 comments on commit 50aa3dd

Please sign in to comment.