diff --git a/debugging.py b/debugging.py new file mode 100644 index 0000000..8b7e7f0 --- /dev/null +++ b/debugging.py @@ -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()) diff --git a/setup.sh b/setup.sh index 9c089e9..7f30464 100755 --- a/setup.sh +++ b/setup.sh @@ -1,5 +1,8 @@ #!/bin/bash +git config --global user.email "nathan@hintonclan.org" +git config --global user.name "bionickatana" + # Make virtual env python3 -m venv venv diff --git a/train.py b/train.py index f53ef34..4acc5d4 100644 --- a/train.py +++ b/train.py @@ -25,8 +25,8 @@ import numpy as np # ========================================== # 1. ARCHITECTURE CONFIGURATION # ========================================== -EMBEDDING_DIM = 512 -RNN_UNITS = 512 +EMBEDDING_DIM = 64 +RNN_UNITS = 256 # Pipeline & Training Hyperparameters TEXT_FILE = "combined_training_data.txt" @@ -113,7 +113,7 @@ if os.path.exists(TEXT_FILE): # ========================================== 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__() 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_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 # ==========================================