adding scaffolding

This commit is contained in:
2026-07-02 00:40:23 +00:00
parent 9d9bd5f9df
commit 9c1e6dc0fd
4 changed files with 668 additions and 1 deletions
+10 -1
View File
@@ -29,6 +29,7 @@ RNN_UNITS = 512
# Pipeline & Training Hyperparameters
TEXT_FILE = "saved_files/pg14314.txt"
FILE_URL = 'https://www.gutenberg.org/cache/epub/14314/pg14314.txt'
VOCAB_FILE = "vocab.txt"
# DYNAMICALLY MANGLED DIRECTORY:
@@ -77,7 +78,15 @@ if os.path.exists(VOCAB_FILE):
vocab = json.load(f)
else:
if not os.path.exists(TEXT_FILE):
sys.exit(f"Error: Neither '{VOCAB_FILE}' nor '{TEXT_FILE}' was found.")
print(f"File '{TEXT_FILE}' not found locally. Downloading it.")
# Download the file\mn",
downloaded_path = tf.keras.utils.get_file('tmp', FILE_URL)
# Save the downloaded file to the designated local directory
with open(downloaded_path, 'rb') as source_file:
with open(local_path, 'wb') as dest_file:
dest_file.write(source_file.read())
print(f"Loading raw text from {TEXT_FILE} to build vocabulary...")
with open(TEXT_FILE, 'r', encoding='utf-8') as f: