updated setup.sh
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
import tensorflow as tf
|
||||||
|
|
||||||
|
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
|
||||||
|
print("Is built with CUDA: ", tf.test.is_built_with_cuda())
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
git config --global user.email "nathan@hintonclan.org"
|
||||||
|
git config --global user.name "bionickatana"
|
||||||
|
|
||||||
# Make virtual env
|
# Make virtual env
|
||||||
|
|
||||||
python3 -m venv venv
|
python3 -m venv venv
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ import numpy as np
|
|||||||
# ==========================================
|
# ==========================================
|
||||||
# 1. ARCHITECTURE CONFIGURATION
|
# 1. ARCHITECTURE CONFIGURATION
|
||||||
# ==========================================
|
# ==========================================
|
||||||
EMBEDDING_DIM = 512
|
EMBEDDING_DIM = 64
|
||||||
RNN_UNITS = 512
|
RNN_UNITS = 256
|
||||||
|
|
||||||
# Pipeline & Training Hyperparameters
|
# Pipeline & Training Hyperparameters
|
||||||
TEXT_FILE = "combined_training_data.txt"
|
TEXT_FILE = "combined_training_data.txt"
|
||||||
@@ -113,7 +113,7 @@ if os.path.exists(TEXT_FILE):
|
|||||||
# ==========================================
|
# ==========================================
|
||||||
|
|
||||||
class CharacterTextModel(tf.keras.Model):
|
class CharacterTextModel(tf.keras.Model):
|
||||||
def __init__(self, vocab_size, embedding_dim, rnn_units, num_layers=2, dropout_rate=0.2):
|
def __init__(self, vocab_size, embedding_dim, rnn_units, num_layers=2, dropout_rate=0.4):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.embedding = tf.keras.layers.Embedding(vocab_size, embedding_dim)
|
self.embedding = tf.keras.layers.Embedding(vocab_size, embedding_dim)
|
||||||
|
|
||||||
@@ -201,6 +201,13 @@ class GenerationCallback(tf.keras.callbacks.Callback):
|
|||||||
checkpoint_prefix = os.path.join(CHECKPOINT_DIR, "ckpt_{epoch}.weights.h5")
|
checkpoint_prefix = os.path.join(CHECKPOINT_DIR, "ckpt_{epoch}.weights.h5")
|
||||||
checkpoint_callback = tf.keras.callbacks.ModelCheckpoint(filepath=checkpoint_prefix, save_weights_only=True)
|
checkpoint_callback = tf.keras.callbacks.ModelCheckpoint(filepath=checkpoint_prefix, save_weights_only=True)
|
||||||
|
|
||||||
|
# Stop training when validation loss stops improving for 3 epochs
|
||||||
|
early_stopping = tf.keras.callbacks.EarlyStopping(
|
||||||
|
monitor='val_loss',
|
||||||
|
patience=3,
|
||||||
|
restore_best_weights=True # Automatically rolls back to epoch 15 weights!
|
||||||
|
)
|
||||||
|
|
||||||
# ==========================================
|
# ==========================================
|
||||||
# 6. START RUN
|
# 6. START RUN
|
||||||
# ==========================================
|
# ==========================================
|
||||||
|
|||||||
Reference in New Issue
Block a user