@crazydave on Recurrent Neural Network
I made a recurrent neural network from scratch in Python using numpy, which generates text one character at a time in the style of Shakespeare. Because it keeps a memory of what it has recently seen, it learnt capitalisation, line breaks, punctuation, character-name formatting and roughly what English words look like, starting from nothing but the raw text, which I think is super cool! The most challenging part of this project was getting it to produce good output, first through backpropagation through time, where off-by-one bugs in the hidden state indexing and a bias gradient I forgot to update meant it wasn’t training properly, and then after training it with more layers, the error was much lower but the output was terrible, which took me a very long time to figure out. It turned out the model had barely ever seen a blank memory during training, so I fixed it by building up its memory on some text before it starts generating. I also added command line arguments to the code so that people can generate text or train their own model in their terminal without editing the python file. To test it, follow the install instructions on the README, you can either download the python code and run that, or download the compiled versions in the releases page on Github.
- 5 devlogs
- 32h