Skip to content

Commit 71e05d3

Browse files
Updated the text and added some formatting to render better.
PiperOrigin-RevId: 438209905
1 parent 0c6367e commit 71e05d3

File tree

4 files changed

+32
-10
lines changed

4 files changed

+32
-10
lines changed

official/nlp/data/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
This directory contains binaries and utils required for input preprocessing,
22
tokenization, etc that can be used with model building blocks available in
3-
NLP modeling library [nlp/modelling]
4-
(https://github.com/tensorflow/models/tree/master/official/nlp/modeling) to
5-
train custom models and validate new research ideas.
3+
NLP modeling library [nlp/modelling](https://github.com/tensorflow/models/tree/master/official/nlp/modeling)
4+
to train custom models and validate new research ideas.

official/nlp/docs/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
This directory contain guides to help users to train NLP models.
2+
3+
1. [Training guide](train.md) explain the steps to follow for training NLP
4+
models on GPU and TPU.
5+
6+
2. [Pretrained_models guide](pretrained_models.md) explain how to load
7+
pre-trained NLP models (baselines and checkpoints) that can be finetuned
8+
further depending on application.
9+
10+
3. [TF-Hub guide](tfhub.md) explain how to use TF-NLP's
11+
[export_tfhub](https://github.com/tensorflow/models/blob/master/official/nlp/tools/export_tfhub.py)
12+
tool to export pre-trained Transformer encoders to SavedModels format that are
13+
suitable for publication on TF Hub.

official/nlp/docs/train.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Model Garden NLP Common Training Driver
22

3-
[train.py](https://github.com/tensorflow/models/blob/master/official/nlp/train.py) is the common training driver that supports multiple
3+
[train.py](https://github.com/tensorflow/models/blob/master/official/nlp/train.py)
4+
is the common training driver that supports multiple
45
NLP tasks (e.g., pre-training, GLUE and SQuAD fine-tuning etc) and multiple
56
models (e.g., BERT, ALBERT, MobileBERT etc).
67

78
## Experiment Configuration
89

9-
[train.py] is driven by configs defined by the [ExperimentConfig](https://github.com/tensorflow/models/blob/master/official/core/config_definitions.py)
10+
[train.py](https://github.com/tensorflow/models/blob/master/official/nlp/train.py)
11+
is driven by configs defined by the [ExperimentConfig](https://github.com/tensorflow/models/blob/master/official/core/config_definitions.py)
1012
including configurations for `task`, `trainer` and `runtime`. The pre-defined
1113
NLP related [ExperimentConfig](https://github.com/tensorflow/models/blob/master/official/core/config_definitions.py) can be found in
1214
[configs/experiment_configs.py](https://github.com/tensorflow/models/blob/master/official/nlp/configs/experiment_configs.py).
@@ -78,7 +80,9 @@ setting `task.validation_data.input_path` in `PARAMS`.
7880

7981
## Run on Cloud TPUs
8082

81-
Next, we will describe how to run the [train.py](https://github.com/tensorflow/models/blob/master/official/nlp/train.py) on Cloud TPUs.
83+
Next, we will describe how to run
84+
the [train.py](https://github.com/tensorflow/models/blob/master/official/nlp/train.py)
85+
on Cloud TPUs.
8286

8387
### Setup
8488
First, you need to create a `tf-nightly` TPU with
@@ -99,6 +103,8 @@ pip3 install --user -r official/requirements.txt
99103

100104
### Fine-tuning Sentence Classification with BERT from TF-Hub
101105

106+
<details>
107+
102108
This example fine-tunes BERT-base from TF-Hub on the the Multi-Genre Natural
103109
Language Inference (MultiNLI) corpus using TPUs.
104110

@@ -163,8 +169,12 @@ python3 train.py \
163169
You can monitor the training progress in the console and find the output
164170
models in `$OUTPUT_DIR`.
165171

172+
</details>
173+
166174
### Fine-tuning SQuAD with a pre-trained BERT checkpoint
167175

176+
<details>
177+
168178
This example fine-tunes a pre-trained BERT checkpoint on the
169179
Stanford Question Answering Dataset (SQuAD) using TPUs.
170180
The [SQuAD website](https://rajpurkar.github.io/SQuAD-explorer/) contains
@@ -219,4 +229,6 @@ python3 train.py \
219229

220230
```
221231

232+
</details>
233+
222234
Note: More examples about pre-training will come soon.

official/nlp/modeling/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ examples.
2020
* [`losses`](losses) contains common loss computation used in NLP tasks.
2121

2222
Please see the colab
23-
[nlp_modeling_library_intro.ipynb]
24-
(https://colab.sandbox.google.com/github/tensorflow/models/blob/master/official/colab/nlp/nlp_modeling_library_intro.ipynb)
23+
[nlp_modeling_library_intro.ipynb](https://colab.sandbox.google.com/github/tensorflow/models/blob/master/official/colab/nlp/nlp_modeling_library_intro.ipynb)
2524
for how to build transformer-based NLP models using above primitives.
2625

2726
Besides the pre-defined primitives, it also provides scaffold classes to allow
@@ -44,8 +43,7 @@ custom hidden layer (which will replace the Transformer instantiation in the
4443
encoder).
4544

4645
Please see the colab
47-
[customize_encoder.ipynb]
48-
(https://colab.sandbox.google.com/github/tensorflow/models/blob/master/official/colab/nlp/customize_encoder.ipynb)
46+
[customize_encoder.ipynb](https://colab.sandbox.google.com/github/tensorflow/models/blob/master/official/colab/nlp/customize_encoder.ipynb)
4947
for how to use scaffold classes to build noval achitectures.
5048

5149
BERT and ALBERT models in this repo are implemented using this library.

0 commit comments

Comments
 (0)