Creating my digital clone from Facebook messages using nanoGPT

As a software developer, I am always on the lookout for exciting new ways to use natural language processing (NLP) to enhance user experiences. Recently, I took on an interesting weekend project: creating a digital clone of myself based on the Facebook messages I’ve sent over the last three years. The idea was inspired by the TV show “Silicon Valley”, where Gilfoyle creates a digital clone of himself that can interact with people just like the real thing.

To create my digital clone, I turned to an open-source language model called nanoGPT. Using Python, I wrote a parser to convert my Facebook messages from JSON format into a dialog form that could be fed into the model. In case you were wondering, I exchanged 2.3 million characters using Facebook Messenger over the last three years and I am open-sourcing the complete dataset on this link so anyone can reproduce the results reported in this blog post.

An example of the resulting dialog dataset before handling Serbian non-unicode characters.

The model generates text letter by letter, allowing it to capture the nuances of human language and create a more natural-sounding conversation.

At first, the results were less than impressive. The dialogue generated by the model was often nonsensical and riddled with errors.

The result after couple of epochs don’t make much sense. On the positive note, it at least figured out the English generated input “Roses are red, violets are blue, unhanded exceptions at line thirty two” should probably continue with an English speaker, i.e. my wife Rubí Díaz. 🙂

However, I persevered and continued to refine the model’s training parameters. Using the new PyTorch 2.0 model.compile() sped up the training drastically, allowing me to run more iterations. With each iteration, the model grew more sophisticated and its output more coherent.

After many rounds of iteration and refinement, the model was able to generate text that was eerily similar to my own writing style. The resulting output was quite cool, and it felt like I was observing myself talking with a chosen Facebook friend. My clone was able to carry on conversations just like I would, with all the quirks and idiosyncrasies that make me unique.

Although this is a toy weekend project, the potential applications for this technology are limitless. Imagine a chatbot that can converse with customers in the exact same way that you do, or a virtual assistant that can represent you in digital spaces. The possibilities are endless!

In conclusion, creating a digital clone based on your Facebook messages is an exciting and ambitious project. While the process can be challenging and time-consuming, the results are well worth the effort. With the help of cutting-edge language models like nanoGPT, we can create digital representations of ourselves that are truly indistinguishable from the real thing. I am excited to continue exploring this fascinating field and seeing where it takes us in the future.

1 Comment

Leave a Comment