Skip to content

Instantly share code, notes, and snippets.

@mbklein
Created October 26, 2019 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbklein/6aebfa01c6e8a2d08afe7e7217517c28 to your computer and use it in GitHub Desktop.
Save mbklein/6aebfa01c6e8a2d08afe7e7217517c28 to your computer and use it in GitHub Desktop.
Bare Bones Neural Net
#! /usr/bin/env python3
import pathlib
import sys
from textgenrnn import textgenrnn
stem = sys.argv[1]
count = int(sys.argv[2])
hdfile = f"{stem}.hdf5"
path = pathlib.Path(hdfile)
if path.exists():
t = textgenrnn(hdfile)
else:
t = textgenrnn()
t.train_from_file(f"{stem}.txt", num_epochs=5)
t.generate(count, temperature=0.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment