Skip to content

jkhall/neural_sonnet

Repository files navigation

Neural Sonnet

Poems generated by neural nets, yo

This is my first (extremely naive) attempt to generate poems using a neural network. I used pytorch and Fastai.

I used a pretrained English language model via Fastai and I finetuned it on some of Shakespeare's sonnets. This generated the general structure of the poem. To enforce rhyme I trained a seperate model that learned a vector representation of rhyming words, so that words that did rhyme were closer together in the vector space. This is the most interesting part of the model and I'm a little surprised it works as well as it does.

The dataset and the rhyme model were cribbed from this paper: https://aclweb.org/anthology/P18-1181

The poems aren't necessarily romantic, but for the duration of Valentine's Day I'll be hosting the model here: ec2-18-223-29-17.us-east-2.compute.amazonaws.com Best on a desktop

Examples:

image

TODO:

[] Make sure the net doesn't inject dumb characters [] Enforce iambic pentameter [] Use semantic similarity to make more thematically coherent poems

About

Neural Nets for poetry, yo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published