I miss The Office. So I made an AI write me new scripts.

Hitesh Nair
4 min readJul 10, 2019

--

It’s a Sunday morning. I wake up, brush my teeth, and settle down for some breakfast. Browsing mindlessly through the never-ending farrago of digital content available for my consumption, I sigh. None of them can fill the big wide hole in my heart. None of them is The Office.

It’s hard to explain what exactly I like about the show. Maybe it’s the atmosphere, a place where literally anything could happen. Maybe it’s all the fun jokes, and the references.

Who am I kidding? I love it because it has Michael Scott.

But all good things must come to an end, and the final season aired in 2013, leaving countless numbers of fans hollow and empty inside, never complete again.

Until now.

A screenshot from The Guardian’s news report

Around February of 2019, OpenAI, the Elon Musk-backed group working for the promotion of “safe” artificial intelligence, released a paper outlining their new AI text generation model.

“We’ve trained a large-scale unsupervised language model which generates coherent paragraphs of text, achieves state-of-the-art performance on many language modelling benchmarks, and performs rudimentary reading comprehension, machine translation, question answering, and summarization — all without task-specific training.”

But with great power comes great responsibility. Fearing that their model would be used for generating “high-quality” fake news, they decided not to publish their code, to the despair of students and machine learning researchers worldwide.

Screenshot from the OpenAI website

In May 2019, however, they released a much smaller version of their original model, so that people could play around with it without causing much damage. Called ‘GPT-2 small’, it’s now available on Github.

The GPT-2 model was trained on a dataset of 8 million web pages, allowing it to learn the intricacies of language. By itself, it can generate impressive, grammatically accurate text.

Yes, that’s cool, but what’s the fun part, you ask? The fun part is that you can take this model, and then re-train it with your own data.

Which means if I fed this model a dataset containing every single line from every single episode of The Office, I could theoretically have an AI “buddy” who could keep generating imaginary scenarios containing the people we’ve come to know and love, from the Dunder Mifflin Paper Company Inc, Scranton.

The dataset in csv format.

Getting started wasn’t as hard as I had expected. Data.world had a dataset containing the lines from the show. I imported it into Python using pandas and generated a text file with the following format —

[speaker]+”: ” +[line_text]

Is this what they call nostalgia?

Then I used minimaxir’s port of the GPT-2 model to run a Colab notebook and trained the model on the text. I trained two models, one for 1000 steps, and another one for 2000 steps. If you’d like to play around with them yourself, they’re hosted on Drive and are available for download, or importing into your Colab environment. I would recommend the 1000 steps model.

Results

Of course, a full episode-length script generated wholly by AI is still an ambitious dream, or until OpenAI releases the complete model. For now, here are some cherry-picked outputs.

Some good ol’ Michael Scott advice.
Sounds like a pretty fun episode.
Yep.
An AI wrote this.

Conclusion

The most misguided idea with regard to AI in general is that it would take all our jobs, and then we’d be out of work. For most fields, artificial intelligence agents are merely going to end up being a sort of ‘creative partner’, assisting you in the work that you do, not replacing. In this very case, an AI agent could analyze and see connections in the scripts that most humans may never catch, and bring their own interesting insights to the table, helping human show writers and plot authors to use those ideas and expand upon them. In a creative process, ideas are gold, and the more the ideas you have with you, the better.

P.S: I’ll post more examples from the model on Instagram.

--

--