Skip to content

Commit

Permalink
Update text_classification_with_hub.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
tilakrayal authored Sep 23, 2024
1 parent 98fa059 commit 2cafc4b
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 2cafc4b

Please sign in to comment.