Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifying the text_classification_with_hub.ipynb #2330

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading