Skip to content

Instantly share code, notes, and snippets.

@StrikingLoo
Created April 26, 2020 20:46
Show Gist options
  • Save StrikingLoo/f8af069414dd7781a6c02ddb2c463c99 to your computer and use it in GitHub Desktop.
Save StrikingLoo/f8af069414dd7781a6c02ddb2c463c99 to your computer and use it in GitHub Desktop.
from textgenrnn import textgenrnn
import glob
textgen = textgenrnn()
# textGenRNN.train_from_file requires the whole dataset to be in a single file
corpus = ''
for file_name in glob.glob('lovecraft_corpus/*'):
with open(file_name) as f:
corpus+=f.read()
with open('lovecraft_corpus.txt', 'w') as f:
f.write(corpus)
textgen.train_from_file('lovecraft_corpus.txt', num_epochs = 1, batch_size = 4096)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment