Created
August 30, 2024 06:23
-
-
Save saimadhu-polamuri/dfa401b51160ac18fee812d5aef87943 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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