A Newly Discovered Greek Play

What if you discovered a ‘new’ ancient greek play?

Yeah, not likely to happen, at least for me: ancient greek was probably my worst subject. But… given the time, the place, and the context of writing… maybe we could generate a ‘new’ play from the writings of the ancients. Maybe we could identify patterns of thought, of verse, and make something that simulates the process of writing a play? Andrej Karpathy has an intriguing post on ‘the unreasonable effectiveness of recurrent neural networks‘ – I’ll wait while you go read it. It’s *awesome*.

His code is on github; it works very well. I had to install Torch; the instructions there worked a bit better than the instructions on Andrej’s page (I was getting some weird git error when I did his instructions; switched to the Torch page, all went tickety boo). I had to create a .profile file as well – we’re on the Mac here, Windows folks, I have no idea – and then I ran it on his test dataset.


So I fed it the english versions of some Sophocles, Aesychlus, and Aristophanes  because I needed around 1mb of text. Remembering to

source ~/.profile

first, I then trained the model:

$ th train.lua -data_dir data/greekplays -rnn_size 512 -num_layers 2 -dropout 0.5 -gpuid -1

and we were off to the races. These values are those suggested in Andrej’s readme for the code. After a while, we reached a checkpoint and the code wrote a snapshot of what was going on; it’s still merrily ticking away as I write this. It gets better with time. If this machine had any horsepower, I’d probably be done by now. Anyway, let us see what our newly discovered greek play looks like:

$ th sample.lua cv/lm_lstm_epoch2.65_1.6008.t7 -gpuid -1 -primetext "Gods of the ancient cradle of my race" -temperature 0.85

In this line, I’m feeding it the most recent checkpoint I have, and I’m priming the generation with the phrase, ‘Gods of the ancient cradle of my race’. You don’t have to do this, but it seems to generate more sensible output (even with this *first pass* of the training) this way. The other important element is ‘temperature’. Closer to 0, the more conservative the neural net’s guesses; closer to 1, and we’re swinging for the bleachers. So what do we get? Something that feels as if it’s slowly coming into focus, as if it’s still blury, or perhaps being transcribed & translated by Shawn Graham ca 1996 in his first year Ancient Greek class…

Gods of the ancient cradle of my race--
  Of the wise blood-claft of all the phomer,
         with man not great with rade,
  The lumber, my pittible sprong the perise is eanth and survanign--
  Reelly eremy shall have yarded and fire his rid.
  And hear my sire the night Cryophenes,
  Where the stalls it bar exisile ground,
  No long course with sound of Hellacles, fire--
  A steppounce but is man's good,
            Poward and muntage
  rished from Zeus for the self-to me
for us.                         II 1
    Ay! Ah! not him! I know they sounds and pull,
  Yet shall have hath not for the wards to with hour,
  Arcey-lodned of the name to her perish fine away
  Deep his shade the warraors of the thought at the ruin for suppliant thought
  For all the lagkend of their father comes,
    Who she died and begint the grace,
  When when a round save indorred the ungreat. Yet hither speak all the naboe's slight.
                                                      [_Exit_ THE KING OF ARGOS

  How then I'll de to three the hate to my sire.
  And who thou whom are gundled of just fatterland hall!
  Lake this hour!
    Nover sent this race!

      With who may to more immortal over the whole
  Who stands on mine yea-strose enemy-speeth so now to sire,
    Not shall be let a parrest thine cleared
    Hevelled to from our stay,
  But even the angien of the blood hither life,
  The tomber of what resolve with heed
  Lest far the on to sweet persafte! boy his desore were that and thratt and bear.
      When his miders, of it, and her hound!

CH. O hapless heart will tell, nor saith down to me,
  Word saids of the blooding of the wisean poor brought.

CH.                  So stool.

CH. I might do you who drould her country to die.

CR. Strick so, I must get here in thy fate here was to swift,
  Of their binds mey hear and jay.


I’ll just let this tick over night, and we’ll see what our newly discovered greek play looks like in the morning…

update, 30 minutes or so later: it’s updating every 1000 iterations, taking roughly half an hour to do so.

Gods of the ancient cradle of my race,
          O more of the breath of the shore,
    And here and rended the stranger gods,
    When the speed and the fight to the child,
        Threatened disclear and to me
                                                                                          II 2
                                                                                                                                        II 1
      The clamour and the sea--come, when the sacred father haste,
      When he will be endowed in the way,
    When of his father taught his father's wards
      And who shall your seas a prade
            The eagle as terror of the face,
  And we must still me not as the steed of the storm,
                                                                                                                                                  I 1
                                                                                            II 2
                                                                                           II 2
      But of the bride and the earth, who revealed
                                                                                                                                         I 2
        And the act in our hand.
  For a with the storm of holy sure.
                                                                                 I 1
    The shame and wise to see,
  But the day to the shore, when the every word,
    And the shame with land and is here.
  And where it from the haughter of the doom,
      And Zeus is a distracles here,
      Suffer out and here with shame.
    And then the the terror of the shores and the son!

  DIO. Then shall I most least our deserve the stranger strung the sight, and fell
  The the lightless of the fleet, and the abloged tongue and the deather of

…the stranger gods… I like that phrase…

update feb 17 I meant to run it over night, but forgot that the computer goes to sleep. So this morning I let it continue to 5000 iterations. I think you’ll enjoy the result.

2 thoughts on “A Newly Discovered Greek Play

Comments are closed.