Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save saimadhu-polamuri/dfa401b51160ac18fee812d5aef87943 to your computer and use it in GitHub Desktop.

Select an option

Save saimadhu-polamuri/dfa401b51160ac18fee812d5aef87943 to your computer and use it in GitHub Desktop.
import tensorflow as tf
from tensorflow.keras.layers import Embedding, LSTM, Dense, Dropout
from tensorflow.keras.models import Sequential
# Define model architecture
model = Sequential([
Embedding(input_dim=vocab_size, output_dim=embedding_dim),
LSTM(units=256, return_sequences=True),
Dropout(0.2),
LSTM(units=256),
Dropout(0.2),
Dense(vocab_size, activation='softmax')
])
# Compile the model
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment