Source: Deep Learning on Medium
I conditioned (the correct word for “forced”) OpenAi’s mini GPT2 model to combine Star Trek, Star Wars, Harry Potter and The Lord of the Rings in a single story.
In bold is my input, the rest is the output of the model.
CHAPTER 10 — Lieutenant Commander Data instructs Harry Potter to take his lightsaber and destroy the ring of power. Is the only way to save the planet. Harry turns to the ring. The red light of the saber glimmers in the golden surface. Harry is in awe and the ring glints in a brilliant light that makes him believe it is real.
I am Harry Potter, I am Harry, and you must destroy the ring of power that is so precious to me…
Harry is in the dark and is not sure what is going on but he has to.
“I have been told that it has been destroyed. The ring is a symbol that is in my blood… and I will not leave you. I am a Jedi Knight, a warrior, an adventurer… a Jedi Master, a Jedi Master, a Master… I am not a Jedi Knight, I am Harry.
The Force of my will will will destroy all life in this world.” The red ring in my hand glints in brilliant sunlight as Harry turns to the lightsaber in question…
Harry has never seen a Force-powered Jedi before…
“You are Harry.” He tells him. “It’s time to go. It’s time to get out there, get back on my ship, to find out if this will work.
The lightsaber glimmers and the lightsaber in Harry is shattered and Harry turns away from it as his heart breaks. He looks down on the shattered saber.
The lightsaber is broken in two pieces by Harry and he has to take a step back. The ring glimmers as the ring in the lightsaber explodes into pieces. Harry is forced back into space, but the ring does a terrible, horrible, thing.
The red ring glimmens as Harry turns to look at the ring in his hand, but he cannot.
Harry is in space and the ring in space is broken into smaller pieces. The lightsaber in Harry is destroyed in a blink and Harry is forced into space, but his heart is shattered as it is smashed to bits. Harry has a hard moment of realization and is about to take action. But then, the ring bursts and the red ring glints again as Harry looks at Harry in the darkness, his heart is broken in a single second. He has no other option other than to go back into hyperspace. But then, he turns and he has his mind destroyed, the lightsaber explodes. He is left alone, but the lightsaber in his right hand does nothing other than destroy him and Harry has no option else other to save himself from destruction.
Given a starting text Mini GPT2 can take over and continue writing the story. I had to make dozens of tests to find the right combination of words. Also I had to take into account the limitations of Mini GPT2: apparently can only handle a limited amount of characters in scene, and scene complexity.
The starting “CHAPTER 10 — ” gives the clue to Mini GPT2 that we are writing a story, and not a movie review, or movie description.
“Lieutenant Commander Data” introduces the Star Trek world, since the name Data can lead to multiple meanings, I use the rank for disambiguation.
“instructs” the action of “instructing” put Data in the place of a mentor, like Dumbledore. In some generated iterations Data would later speak to Hermione or Ron also: “Commander data informs Harry Potter and Hermione that their lives are now at an end.”
“Harry Potter to take his lightsaber”: the model was apparently trained on Harry Potter books, and somehow have a clear understanding of what a lightsaber is, and what universe it belongs. Truly amazing.
The goal of our main character is defined in the section “and destroy the ring of power.”. The model already knows what the “ring of power” is, and its effects on people and the fact that can’t be destroyed. One interesting iteration says: “The light glints a few inches from him as the saber strikes the ring, sending a wave across Harry’s body and knocking it to his side and knocking the lightsaber out of the hands of a few.”
In the line “Is the only way to save the planet.” I re introduce the Star Trek universe. And also the model receive information about why the ring must be destroyed. Interestingly I was inspired by the model itself “The ring of power that was destroyed by Data was sent to Earth.”
“Harry turns to the ring.” forces the attention on Harry and the Ring, as main agents of the story. Some times the model will get confused about who is the protagonist and the antagonist.
“The red light of the saber glimmers in the golden surface.” I just wanted to add something visual and artistic, and set the relationship between the lightsaber and the ring.
The last word “Harry ” directs the agent to describe the following actions of our main hero.
The model really likes to make character speak to themselves: “Harry turns around, looking at Harry.”
Some times it generates new (very accurate) chapter names “Chapter 11 (Part 3) — A Time for Action”
Sometimes Voldemort is mentioned “His lightsaber, which had been used to defeat the Great Fire Lord of the Rings in The Silmarillion , has now been used to take the power from Voldemort”