Skip to content

Commit

Permalink
Merge pull request #2330 from tilakrayal:patch-17
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 686262704
  • Loading branch information
copybara-github committed Oct 15, 2024
2 parents a1137cb + 2cafc4b commit bd1c161
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions site/en/tutorials/keras/text_classification_with_hub.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@
"outputs": [],
"source": [
"!pip install tensorflow-hub\n",
"!pip install tensorflow-datasets"
"!pip install tensorflow-datasets\n",
"!pip install tf-keras"
]
},
{
Expand All @@ -138,6 +139,7 @@
"import tensorflow as tf\n",
"import tensorflow_hub as hub\n",
"import tensorflow_datasets as tfds\n",
"import tf_keras as keras\n",
"\n",
"print(\"Version: \", tf.__version__)\n",
"print(\"Eager mode: \", tf.executing_eagerly())\n",
Expand Down Expand Up @@ -290,10 +292,10 @@
},
"outputs": [],
"source": [
"model = tf.keras.Sequential()\n",
"model = keras.Sequential()\n",
"model.add(hub_layer)\n",
"model.add(tf.keras.layers.Dense(16, activation='relu'))\n",
"model.add(tf.keras.layers.Dense(1))\n",
"model.add(keras.layers.Dense(16, activation='relu'))\n",
"model.add(keras.layers.Dense(1))\n",
"\n",
"model.summary()"
]
Expand Down Expand Up @@ -339,7 +341,7 @@
"outputs": [],
"source": [
"model.compile(optimizer='adam',\n",
" loss=tf.keras.losses.BinaryCrossentropy(from_logits=True),\n",
" loss=keras.losses.BinaryCrossentropy(from_logits=True),\n",
" metrics=['accuracy'])"
]
},
Expand Down

0 comments on commit bd1c161

Please sign in to comment.