Inspiration
Image style transfer has been around since 2015/2016 and is a powerful tool for manipulating images. I wanted to create something similar for sentences and phrases.
What it does
Given a content sentence and style sentence, the script produces a final sentence.
How I built it
I took a pretrained sentence embedding model called InferSent along with precomputed word vectors fastText and iteratively updated a random sentence tensor to minimize the content loss, style loss, and regularization term. I use Flask to make a frontend for the script
Challenges I ran into
Nothing like this has been done before. In the literature, style transfer is done using different techniques centered around GANS. Text models are also wayyy behind their vision counterparts, making this a much harder problem. For example, they don't understand grammar so generated sentences are often unnatural. Also I have never used Flask before.
Accomplishments that I'm proud of
Stacked word vectors seem to be a decent representation of style, especially the flow of a sentence. In particular, the final sentence usually captures the flow of the style sentence well, especially if the style sentence is distinctive. Introducing a regularization term prevents the final sentence from repeating words. Also figuring out how to use Django/Flask (I initially wanted to use Django) last minute.
What I learned
Learned how to make a website. Practical style transfer between text longer than single sentences is an open problem.
What's next for Text Style Transfer
Use multiple layers for the sentence embedding model. Use cloud service to host website.
Log in or sign up for Devpost to join the conversation.