NaNoGenMo / 2019

National Novel Generation Month, 2019 edition.
97 stars 5 forks source link

Athos & Porthos & Aramis & D'AtGuy #72

Open spikelynch opened 4 years ago

spikelynch commented 4 years ago

Final web versions are up now: https://etc.mikelynch.org/nanogenmo2019/APAD.html

A spinoff of #52 which I hacked up last night: the Three Musketeers without the letter 'e':

“I will ask you what you wish your lacky by that cask.”

“And you will blow your hands, monsiaus and first, and that is all my army,” said d’Artagnan.

“What is that?” ask this was this committing a singling country, and was not proposing to this distancing his hand to him.

“What do you must havh ago and having somorrow.”

“What do you say, sir,” rapting this man and this convulsion as this momining so much things happing on this sword and a half.”

“I don’t know that,” rising d’Artagnan, who was about to making his hand a littly a thousand pistols. This was a modk of his brothhing hand, and said that his frightful protrudy in this manning, “I will suit you making my pocking at oncy as a convulsion of this poor man.”

“That’s truly, you arriving my sword at that loving young man,” said Athos, “you will go to him.”

spikelynch commented 4 years ago

My fork of torch-rnn with the oulipian 'suppress' flag: https://github.com/spikelynch/torch-rnn/tree/feature-oulipo

enkiv2 commented 4 years ago

Is suppress rejecting suggested completions that include the letter 'e'? The output looks a lot better (and more like a real lipogram) than I'd expect from something that merely filters that glyph from training input or output...

On Thu, Nov 7, 2019 at 10:13 PM Mike Lynch notifications@github.com wrote:

My fork of torch-rnn with the oulipian 'suppress' flag: https://github.com/spikelynch/torch-rnn/tree/feature-oulipo

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/NaNoGenMo/2019/issues/72?email_source=notifications&email_token=AADXUGK7NNHSWEUBI2NE47TQSTKO5A5CNFSM4JKORCL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDOS4TY#issuecomment-551366223, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADXUGPGAN3P6JX2QMOBZLTQSTKO5ANCNFSM4JKORCLQ .

spikelynch commented 4 years ago

Yes, the RNN was trained on the full text of the novel, and I've tweaked the RNN sampling method so that it sets the probability for 'e' and 'E' to zero.

The way the RNN samples is one character at a time, returning a set of weighted scores for every token, and then emitting the one with the highest probability. I've hacked it to zero the probabilities at that level. So when it can't pick 'e' or 'E' it gets the next most likely, so the output is still fairly good.

(see https://github.com/spikelynch/torch-rnn/blob/e57250a720630e0c6f9d95b3a01df06409642c95/LanguageModel.lua#L211 for the relevant code)

As it is now, I can suppress multiple letters, and there's scope for more refined ways of interfering with the net's output, like tweaking the bias of certain letters. For my first NaNoGenMo idea I wanted to use the RNN to select words from another text, so I want to use what's available in the secondary text to prune the weights of the RNN output somehow.

spikelynch commented 4 years ago

Example of suppressing all vowels apart from 'e':

“Pledge he whenks we held the letter the develhers fresh develess the develret the credy essees the wheels were pledged the deference the chest the cry we were strenders. They were never seen the streets, the twelve cheeks belt he held twenty three she where he held freely. The detemmer were strender, when he held the mercer where they were brevent them they went three theses freely. The chrecthes were strengthened, the secret when they were never certed the streets when they held them the chestny dress were wretches were served the chestny three fresh develess the hedge, where they were freed when they were free there, then, then, then, then, then, then, then, then, then, then, then, then, then, then, then, then, then, then, then, then, then, then, then, then, these secrets where they were never the devy well. There were freely been the enemy there were then.”

“Why, the develwe!” crested M. de Trevelet.

MichaelPaulukonis commented 4 years ago

I am pleasantly surprised at how readable both results are (suppress e/ only e) from the char-level. The irregular words that show up seem more like archaisms than charnnfabulations.

spikelynch commented 4 years ago

Big batch of sample output at different temperature settings, using a new technique which restricts the vocab to only oulipo-compliant words from the source text. For some reason (I think to do with tokenisation) this version can't get d'Artagnan's name right.

“That is truly,” said d’Art’gna calling his hand to him.

“You having a ring, this man is not that I will announcing that you will bring him to bring you to think against on this convulsion of this apart lad. I shall bland admirably for a hands of a man who has happy committing a hands to that of my ordinary man, who has happy round to that of my housing a husband who has but thrown or two of this company.”

“What that is thirty-first my frightful charming lit our company of Monta--host! I having a dona lit right that I having this only things with a singly day affairs a lit ought to pass in that casks. I told you that you would bring any doubt. This is that cap, and that I am a profound sigh which I don’t know who you having promising yours, I having lost you to bring a stak! Why, that is that I do not know what that is my finding man, and I will surround anything to this man who has somn of that lady with that cask, and who has not thrown your hands of your loving.”

“Monday naturally,” ros his additionally, “I will go and find his hand to your Mass boy, which I having a stray liking, and who has somn of your window of a man who has happy round to that of my housing and proud in that cask, and who has a suspicion for a hors not to bring him that this is all that which I had to do with that of this poor man.”

“What do you say?”

https://github.com/spikelynch/torch-rnn/tree/feature-excavate/Samples/Autolipo

spikelynch commented 4 years ago

Renamed because d'Artagnan's name bug is now part of the aesthetic.

Final sample:

This smiling and profound ridiculous holds his mast complaints which had should run through this woman who had scar on that misanthropic spot his hands to that of this lit off a mining of surprising his hands, and as his hors had but on this man who had brought our protruding of this point and this timid as had busy in that cask, and was constantly paint and with a singly pack. Having thrown thoughtful, as his family did not providing this to this sad and stout at a tapping at that part of this man.

“That’s trul!” said d’Artois, “it will not buy my duchy into that of my boots which would bring him that you would bring this man in that casks. I am surrounds that you arrival at that poor child, and that I having thrown your court of this ball. I having thrown your conviction and that I had a confiding in this man who has no occasion to my champion. That is to say, you having taking this morning, and that this is an ambush. I was about to say to you, and who has not for a conviction and that housing my own cask of him to obstinacy. I having this morning to my part that has but thrown of this ball. That is truly, and that I am constantly surrounds my hands that I having thrown your hors by that of my housing with this insult.”

“What that bravo! I am a man of any intrusion, and who has not told my pursuit if you had not brought any official of this housing window. This is frightfully doubt, and with that cask of mystification to my husband as a convulsion of that difficult and thanks you, and who has not built in that casks.”

“That is to say, you shall know that, monstrous is a mortal of this poor man, and that is a profound living in this man and that I had thrown your hand to your Mass boy.”

“That is to say, you may rid you to try and said that this is an approach, mad, monstrous! This is that of this loving man.”

“That is truly, that is truly, monstrous agitation?”

“It is that you would blow my own sword.”

“What do you say?”

“I say that it is not that which I having thrown your hors but my honor to bring him I am running about it. It is not that that which I should bring that day and his companions and that housing many distant. I will announcing that which I having him a fortnight, and that you arriving at that month of this som of any in this man.”

“That is truly,” said thought, “a sort of bravo, and I will turn him to think of your loving.”

“What is that?”

“It is that I am a good fortn-for it is only that you may bring him that you having a champion of my brow and to that of my will, and I will assuring you to try and supposing that I having thrown your hands.”

“What do you say?”

“You having a mining that this is an artificial advancing such a lit right as a convulsion of that loving lit our court, and with that hoping for that of this poor duch. This man is a convulsion of that of this woman, who was a grow back with his conviction, that this last two of thought having so strong and grand and protruding a lit d’Artois and that his hand on his part through this sun.

“I am a gracious man, who has not told my now far of your fathom.”

“That’s it,” said Athos, “I having his sword for him to do with that of this ball. That is truly, and will do som that suburban of a man who has don’t burrow.”

“But what do you say?”

“I am surprising that this cask of him to his frightful pistol in this man. This split is a lit conviction, that this last ridiculous port which his mast compromising him in his hand, and that his lack own party was thrown on this should in hand.

As to that which this timid all this was a singly manuscript, that it was that this confiding this man who had no long.

“I am at this morning, my dual!” said through this carrying a glass of a Guard to d’Art-goa.

spikelynch commented 4 years ago

incidentally calling your comrades "My dual!" is very category-theory-ish.

spikelynch commented 4 years ago

Full samples in both

d'Ass mode https://github.com/spikelynch/torch-rnn/blob/feature-excavate/Samples/NaNoGenMo19/APAD/dAss.280000.0.3.txt d'Artagnan mode https://github.com/spikelynch/torch-rnn/blob/feature-excavate/Samples/NaNoGenMo19/APAD/dArtagnan.280000.0.3.txt

hugovk commented 4 years ago

Good stuff! Ready for a "completed" label?

Is this right link for the code? https://github.com/spikelynch/torch-rnn/tree/feature-excavate

spikelynch commented 4 years ago

Yes, that's the right link, and the texts are completed, the only other thing I wanted to do was PDF them

spikelynch commented 4 years ago

Final web versions (rather than PDF - this goes better with the main project they spun off from)

https://etc.mikelynch.org/nanogenmo2019/APAD.html