Skip to content

Commit b24bc4e

Browse files
authored
Some minor fixes for keras-nlp docs (#1178)
We will use the same install line everywhere which will update tensorflow to the latest version (useful for colab with old tf). Also switch the optimizer from AdamW -> Adam in our quickstart, as AdamW does not converge on tf 2.9, and the quickstart may be copied and pasted into a lot of environments we don't control.
1 parent 417d071 commit b24bc4e

File tree

7 files changed

+38
-19
lines changed

7 files changed

+38
-19
lines changed

guides/ipynb/keras_nlp/getting_started.ipynb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@
4949
"<img src=\"https://storage.googleapis.com/keras-nlp/getting_started_guide/prof_keras_evolution.png\" alt=\"drawing\" height=\"250\"/>"
5050
]
5151
},
52+
{
53+
"cell_type": "code",
54+
"execution_count": 0,
55+
"metadata": {
56+
"colab_type": "code"
57+
},
58+
"outputs": [],
59+
"source": [
60+
"!pip install -q --upgrade keras-nlp tensorflow"
61+
]
62+
},
5263
{
5364
"cell_type": "code",
5465
"execution_count": 0,

guides/ipynb/keras_nlp/transformer_pretraining.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
},
5757
"outputs": [],
5858
"source": [
59-
"!pip install -q keras-nlp"
59+
"!pip install -q --upgrade keras-nlp tensorflow"
6060
]
6161
},
6262
{

guides/keras_nlp/getting_started.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
<img src="https://storage.googleapis.com/keras-nlp/getting_started_guide/prof_keras_evolution.png" alt="drawing" height="250"/>
3737
"""
3838

39+
"""shell
40+
pip install -q --upgrade keras-nlp tensorflow
41+
"""
42+
3943
import keras_nlp
4044
import tensorflow as tf
4145
from tensorflow import keras

guides/keras_nlp/transformer_pretraining.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"""
3333

3434
"""shell
35-
pip install -q keras-nlp
35+
pip install -q --upgrade keras-nlp tensorflow
3636
"""
3737

3838
import os

guides/md/keras_nlp/getting_started.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ reference for the complexity of the material:
4040
<img src="https://storage.googleapis.com/keras-nlp/getting_started_guide/prof_keras_evolution.png" alt="drawing" height="250"/>
4141

4242

43+
```python
44+
!pip install -q --upgrade keras-nlp tensorflow
45+
```
46+
4347
```python
4448
import keras_nlp
4549
import tensorflow as tf

guides/md/keras_nlp/transformer_pretraining.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ faster training!
3333

3434

3535
```python
36-
!pip install -q keras-nlp
36+
!pip install -q --upgrade keras-nlp tensorflow
3737
```
3838

3939

templates/keras_nlp/index.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
<a class="github-button" href="https://github.com/keras-team/keras-nlp" data-size="large" data-show-count="true" aria-label="Star keras-team/keras-nlp on GitHub">Star</a>
44

55
KerasNLP is a natural language processing library that supports users through
6-
their entire development cycle. Our workflows are built from modular components
7-
that have state-of-the-art preset weights and architectures when used
8-
out-of-the-box and are easily customizable when more control is needed. We
9-
emphasize in-graph computation for all workflows so that developers can expect
6+
their entire development cycle. Our workflows are built from modular components
7+
that have state-of-the-art preset weights and architectures when used
8+
out-of-the-box and are easily customizable when more control is needed. We
9+
emphasize in-graph computation for all workflows so that developers can expect
1010
easy productionization using the TensorFlow ecosystem.
1111

12-
This library is an extension of the core Keras API; all high-level modules are
13-
[`Layers`](/api/layers/) or [`Models`](/api/models/) that recieve that same
14-
level of polish as core Keras. If you are familiar with Keras, congratulations!
12+
This library is an extension of the core Keras API; all high-level modules are
13+
[`Layers`](/api/layers/) or [`Models`](/api/models/) that recieve that same
14+
level of polish as core Keras. If you are familiar with Keras, congratulations!
1515
You already understand most of KerasNLP.
1616

17-
See our [Getting Started guide](/guides/keras_nlp/getting_started)
18-
for example usage of our modular API starting with evaluating pretrained models
19-
and building up to designing a novel transformer architecture and training a
20-
tokenizer from scratch.
17+
See our [Getting Started guide](/guides/keras_nlp/getting_started)
18+
for example usage of our modular API starting with evaluating pretrained models
19+
and building up to designing a novel transformer architecture and training a
20+
tokenizer from scratch.
2121

2222
KerasNLP is new and growing! If you are interested in contributing, please
2323
check out our
@@ -47,19 +47,19 @@ check out our
4747
To install the latest official release:
4848

4949
```
50-
pip install keras-nlp --upgrade
50+
pip install --upgrade keras-nlp tensorflow
5151
```
5252

5353
To install the latest unreleased changes to the library, we recommend using
5454
pip to install directly from the master branch on github:
5555

5656
```
57-
pip install git+https://github.com/keras-team/keras-nlp.git --upgrade
57+
pip install --upgrade git+https://github.com/keras-team/keras-nlp.git tensorflow
5858
```
5959

6060
## Quickstart
6161

62-
Fine-tune BERT on a small sentiment analysis task using the
62+
Fine-tune BERT on a small sentiment analysis task using the
6363
[`keras_nlp.models`](/api/keras_nlp/models/) API:
6464

6565
```python
@@ -78,7 +78,7 @@ classifier = keras_nlp.models.BertClassifier.from_preset(
7878
)
7979
classifier.compile(
8080
loss=keras.losses.SparseCategoricalCrossentropy(from_logits=True),
81-
optimizer=keras.optimizers.experimental.AdamW(5e-5),
81+
optimizer=keras.optimizers.Adam(5e-5),
8282
metrics=keras.metrics.SparseCategoricalAccuracy(),
8383
jit_compile=True,
8484
)
@@ -120,4 +120,4 @@ Here is the BibTeX entry:
120120
year={2022},
121121
howpublished={\url{https://github.com/keras-team/keras-nlp}},
122122
}
123-
```
123+
```

0 commit comments

Comments
 (0)