Created
October 27, 2019 01:24
-
-
Save mbklein/db6a34e1a8eeb65a1cf62d0d9d2a9746 to your computer and use it in GitHub Desktop.
My dumb neural net generator
This file contains 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
#!/usr/bin/env python3 | |
import pathlib | |
import sys | |
from textgenrnn import textgenrnn | |
stem = sys.argv[1] | |
count = 100 if len(sys.argv) < 3 else int(sys.argv[2]) | |
temp = [1.0, 0.5, 0.2, 0.2] if len(sys.argv) < 4 else float(sys.argv[3]) | |
hdfile = f"{stem}.hdf5" | |
if pathlib.Path(hdfile).exists(): | |
t = textgenrnn(hdfile) | |
else: | |
t = textgenrnn() | |
t.train_from_file(f"{stem}.txt", num_epochs=5) | |
t.save(hdfile) | |
t.generate_to_file(f"generated_{stem}.txt", n=count, temperature=temp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment