Inspiration
I remember nodding my head to We Will Rock You oftentimes without realizing who performed it. But, it all changed when I watched the movie "Bohemian Rhapsody" which was about Freddie Mercury- the lead singer of Queen. Through the movie, I was introduced to their music and fell in love with it. I always felt sad that they couldn't continue making great music due to the untimely death of Freddie. When I heard rock and roll as a theme, I couldn't stop myself from paying tribute to this great band.
What it does
To create new Queen songs, all you need to do is supply it with a starting phrase and wait for it to come up with new song lyrics based on the style of Queen's discography.
How I built it
This has a simple front-end created using Bootstrap and uses Flask in the backend. It takes the input from the front end and then calls a function in Flask that utilizes the model created. The aforementioned model was trained with Queen's song lyrics using transfer learning on the GPT-2 model. The model was trained on Google Colab using their GPU resources to expedite training. The weights were saved and loaded in the Flask app.
Challenges I ran into
Getting a nice and clean dataset with all of Queen's lyrics was time-consuming. My first step was to create a small script that obtained Queen's lyrics from Genius.com. It worked but Genius.com had repeated the same song multiple times and the lyrics also had some artifacts that would need to be cleaned. I saw this to be too time-consuming, so I started searching more on the net and luckily was able to find a dataset on Kaggle from where I could get Queen's songs' lyrics and clean it up quickly.
The other major challenge I faced was in training the model. This is a huge model so training requires a lot of time which meant that I couldn't make a lot of mistakes while coding or my development time would balloon up. I also couldn't tune the hyperparameters of my model as much as I wanted to due to lack of time and couldn't compare a lot of different hyperparameter values to train the best model I could given the resources I had.
Lastly, I have never really used Flask, so I had to pick it up as I worked to connect my model to the front-end and it was a relatively smooth experience as there was a lot of online resources I could learn from.
Accomplishments that I'm proud of
This is only the second time I'm using transfer learning in my life- the first one being for a university project. I was really happy that I was able to bring what I had previously learnt and apply them well here. This is an almost finished product and given the time constraints and me working on it alone- I'm really proud and happy with how it turned out.
What I learnt
I learnt a lot about the GPT-2 project and the great developments that have been made in the field of text generation using Deep Learning models. I learned a lot about n-gram models and NLP. My initial thought was to design RNN/LSTM-based model but I quickly understood that given my computation resources and my coding abilities, I won't be able to make a model that would really create lyrics that made sense word after word and were grammatically correct. This made me study the exact architecture of these models and why they fall short and how GPT-2 has tried to overcome this. So, I decided to use transfer learning to harness GPT-2's abilities and train it with Queen's lyrics. I was also unfamiliar with Flask and through the course of building this program, I can confidently say that my understanding of Flask has definitely improved and I need to keep working at it.
What's next for Queen Songwriter
I plan on extending its functionalities to write complete songs on its own instead of the few lines it is doing right now. Furthermore, I think this project can be extended to any number of music artists and it will be fun to train the model more and extend its music writing capabilities to make it write lyrics worthy of the Hall of Fame! The hyperparameters can also be fine-tuned much more and the model can be trained for more epochs to gain accuracy. The front-end will also have added functionality to select the number of songs to generate and which artist you want the song to be written in the style of.
Log in or sign up for Devpost to join the conversation.