A recurrent neural network to generate new YouTube comments from existing ones.
Given several youtube links, this will use yt-dlp to download all of the comments from those videos. It will then put the comments through a recurrent neural network (RNN) and provide you with a GUI that will create brand new comments based on the existing ones.
On some types of YouTube videos, such as shorts made for children, you'll see many comments that are unintelligible, use lots of emojis and feature many brainrot words. I wanted to see if I could make a simple text generation model to try and mimic these types of comments.
- Install the requirements using
pip install -r requirements.txt.
- If you don't want to train your own model with your own links, simply just run
gui.pyand use the GUI to generate new comments. The existing model,rnn_model.pthis currently trained on 10,000 of these brainrot comments.
- Collect the links of various YouTube videos that feature the type of comments that you want to replicate.
- Put these links in
links.txt, each on a new line. - Run
download.py. Be careful, as this uses YouTube's API to download comments. You could get rate limited. - Train the model by running
train.py. You can modify themax_commentsvariable to determine how many comments from the dataset will be used for training. Currently it is set to 10,000, but you can increase it if you have a lot of VRAM. - Run the model using
gui.py.
You can run create-comments-list.py to create a list of all comments in your dataset at comments.txt. This is useful to see if the comments you're generating are copies of comments in the dataset or if they're new. If some comments are copies, you are likely training too many epochs and overfitting the dataset. Consider reducing the number of epochs.
