Skip to content

Commit

Permalink
Fix dtype in keras nlp guide
Browse files Browse the repository at this point in the history
  • Loading branch information
fchollet committed Feb 11, 2024
1 parent 9326eb3 commit 8e7d849
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
26 changes: 13 additions & 13 deletions guides/ipynb/keras_nlp/transformer_pretraining.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand All @@ -58,7 +58,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -95,7 +95,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -132,7 +132,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -174,7 +174,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -233,7 +233,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -338,7 +338,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -435,7 +435,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -492,7 +492,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -565,7 +565,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand Down Expand Up @@ -603,7 +603,7 @@
},
{
"cell_type": "code",
"execution_count": 0,
"execution_count": null,
"metadata": {
"colab_type": "code"
},
Expand All @@ -613,7 +613,7 @@
"encoder_model = keras.models.load_model(\"encoder_model.keras\", compile=False)\n",
"\n",
"# Take as input the tokenized input.\n",
"inputs = keras.Input(shape=(SEQ_LENGTH,), dtype=tf.int32)\n",
"inputs = keras.Input(shape=(SEQ_LENGTH,), dtype=\"int32\")\n",
"\n",
"# Encode and pool the tokens.\n",
"encoded_tokens = encoder_model(inputs)\n",
Expand Down Expand Up @@ -687,4 +687,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
4 changes: 2 additions & 2 deletions guides/keras_nlp/transformer_pretraining.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def preprocess(inputs):
the context in which it appeared.
"""

inputs = keras.Input(shape=(SEQ_LENGTH,), dtype=tf.int32)
inputs = keras.Input(shape=(SEQ_LENGTH,), dtype="int32")

# Embed our tokens with a positional embedding.
embedding_layer = keras_nlp.layers.TokenAndPositionEmbedding(
Expand Down Expand Up @@ -430,7 +430,7 @@ def preprocess(sentences, labels):
encoder_model = keras.models.load_model("encoder_model.keras", compile=False)

# Take as input the tokenized input.
inputs = keras.Input(shape=(SEQ_LENGTH,), dtype=tf.int32)
inputs = keras.Input(shape=(SEQ_LENGTH,), dtype="int32")

# Encode and pool the tokens.
encoded_tokens = encoder_model(inputs)
Expand Down
2 changes: 1 addition & 1 deletion guides/md/keras_nlp/transformer_pretraining.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ the context in which it appeared.


```python
inputs = keras.Input(shape=(SEQ_LENGTH,), dtype=tf.int32)
inputs = keras.Input(shape=(SEQ_LENGTH,), dtype="int32")

# Embed our tokens with a positional embedding.
embedding_layer = keras_nlp.layers.TokenAndPositionEmbedding(
Expand Down
2 changes: 1 addition & 1 deletion scripts/autogen.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
PROJECT_URL = {
"keras": f"{KERAS_TEAM_GH}/keras/tree/v3.0.4/",
"keras_tuner": f"{KERAS_TEAM_GH}/keras-tuner/tree/v1.4.6/",
"keras_cv": f"{KERAS_TEAM_GH}/keras-cv/tree/v0.8.1/",
"keras_cv": f"{KERAS_TEAM_GH}/keras-cv/tree/v0.8.2/",
"keras_nlp": f"{KERAS_TEAM_GH}/keras-nlp/tree/v0.7.0/",
"tf_keras": f"{KERAS_TEAM_GH}/tf-keras/tree/v2.15.0/",
}
Expand Down

0 comments on commit 8e7d849

Please sign in to comment.