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

Update 08_introduction_to_nlp_in_tensorflow.ipynb #672

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
19 changes: 10 additions & 9 deletions 08_introduction_to_nlp_in_tensorflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3121,19 +3121,20 @@
"# Set random seed and create embedding layer (new embedding layer for each model)\n",
"tf.random.set_seed(42)\n",
"from tensorflow.keras import layers\n",
"model_3_embedding = layers.Embedding(input_dim=max_vocab_length,\n",
" output_dim=128,\n",
" embeddings_initializer=\"uniform\",\n",
"model_3_embedding = layers.Embedding(,\n",
" input_dim=max_vocab_length,\n",
" output_dim=128,",\n",
" embeddings_initializer="uniform",\n",
" input_length=max_length,\n",
" name=\"embedding_3\")\n",
" name="embedding_3"),
"\n",
"# Build an RNN using the GRU cell\n",
"inputs = layers.Input(shape=(1,), dtype=\"string\")\n",
"inputs = layers.Input(shape=(1,), dtype="string") # Adjust input shape for sequences\n",
"x = text_vectorizer(inputs)\n",
"x = model_3_embedding(x)\n",
"# x = layers.GRU(64, return_sequences=True) # stacking recurrent cells requires return_sequences=True\n",
"x = layers.GRU(64)(x) \n",
"# x = layers.Dense(64, activation=\"relu\")(x) # optional dense layer after GRU cell\n",
"# x = layers.GRU(64, return_sequences=True)(x) # Stacking recurrent cells requires return_sequences=True\n",
"x = layers.GRU(64)(x) # Last GRU without return_sequences\n",
"# x = layers.Dense(64, activation="relu")(x) # optional dense layer after GRU cell\n",
"outputs = layers.Dense(1, activation=\"sigmoid\")(x)\n",
"model_3 = tf.keras.Model(inputs, outputs, name=\"model_3_GRU\")"
]
Expand Down Expand Up @@ -7154,4 +7155,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}