Skip to content

NLP analysis on heavy metal lyrics and NN-based lyrics generator

License

Notifications You must be signed in to change notification settings

lballore/deep-metal

Repository files navigation

deep-metal

Deep Metal: when heavy metal meets data science.
Text analysis of heavy metal lyrics and deep learning based lyrics generator.

deep-metal

Legal notes

Due to incertainity about legal rights, I decided not to release a copy of the dataset used for this analysis. I hope you'll understand. The lyrics in question have been scraped from DarkLyrics with this Python library.

Requirements

Make sure you have a Python version >= 3.6 installed in your environment. To install all the required libraries just run:

pip install -r requirements.txt

Contents

Analysis notebooks

The analysis is divided in three Jupyter notebooks, stored in the notebooks folder:

  • Part I - Brief analysis of dataset contents: quantities (amount of artists, albums, album types, songs etc.) and simple statistics, album releases and distribution over the years,language distribution, bands popularity etc.
  • Part II - Readability analysis: swear words ratio and Coleman-Liau grade index, word frequence and definition of "metalness", POS analysis etc.
  • Part III - Word based sentiment analysis, sentiment analysis with VADER, bands clustering based on sentiment and "metalness", bands emotional arcs, emotional arcs applied on literature, LDA topics modeling etc.

Heavy metal lyrics generator

Model description

DeepMetal is a model capable of generating lyrics taylored for heavy metal songs. The model is based on the OpenAI GPT-2 and has been finetuned on a dataset of 141,718 heavy metal songs lyrics.

Intended uses and limitations

The model is released under the Apache 2.0 license. You can use the raw model for lyrics generation or fine-tune it further to a downstream task.

How to use

The DVC repository for dataset and model is private, so it's not possible to download them using the commands in the Makefile. The model files have been released on HuggingFace, together with related documentation and how-tos for using it with the HuggingFace transformers library. If you want to use the model using the scripts stored in this repo, you need your system to be equipped with:

  • Docker;
  • The model files to be stored in src/model/deepmetal;

Then you can build and run the Docker image with this command:

make generator-build generator-run

Once in the container, you can launch the command:

./model/scripts/generate.sh

You can edit the generate.sh file in order to regulate the parameters for the generation.

You can use this model directly with a pipeline for text generation. Since the generation relies on some randomness, it could be good to set a seed for reproducibility:

Demo web application

I built a little SPA able to demonstrate some capabilities of the model. You can find the related repository here

About this project

Medium articles are available for each part of this project:

Any form of feedback is really appreciated :)

About

NLP analysis on heavy metal lyrics and NN-based lyrics generator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages