Skip to content

Instantly share code, notes, and snippets.

@fedden
Created April 21, 2018 17:38
Show Gist options
  • Save fedden/bf32234ba4de609fcfe02e8397b19dd0 to your computer and use it in GitHub Desktop.
Save fedden/bf32234ba4de609fcfe02e8397b19dd0 to your computer and use it in GitHub Desktop.
# Create the model.
network = CharRNN(dataset.vocabulary_size,
dataset.sequence_length,
dropout_rate=0.5,
batch_size=512,
rnn_size=256,
amount_layers=3,
embedding_size=512,
learning_rate=0.001,
clip_norm=5.0)
# Load previous progress (assuming there is some!)
network.load()
# Train on the dataset previously established.
network.train(dataset, epochs=10)
# Create some starting tokens for inference.
tokens = dataset.empty_start_tokens
tokens = np.random.choice(list(dataset.token_to_char.keys()), dataset.sequence_length)
# Print random inference.
print(network.inference(tokens.tolist(),
dataset,
inference_length=60,
temperature=0.5))
# Printed results.
>> ♀️
>> I am a conversation and personality of the looking for politics and will strong.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment