Got-book-6 - LSTM trained on the first five ASOIAF/GOT books

Overview

GOT Book 6 Generator

Are you tired of waiting for the next GOT book to come out? I know that I am, which is why I decided to train a RNN on the first five GOT books and use predictions from the network to create the sixth book in the series. The first five chapters of the generated sixth book are now available and are packed with as many twists and turns as the books we've all come to know and love. Here's the sparknotes summary:

Sansa is actualy a Baratheon and Jaime fears her because she is one of the second sons of the onion concubine...

“I feared Master Sansa, Ser,” Ser Jaime reminded her. “She Baratheon is one of the crossing. The second sons of your onion concubine.”

Reek is still annoying people...

“Some must, for you,” a woman’s voiced up lazily. “Gods, Reek.”

A new protagonist named Greenbeard is intorduced to the plot...

“Aye, Pate.” the tall man raised a sword and beckoned him back and pushed the big steel throne to where the girl came forward. Greenbeard was waiting toward the gates, big blind bearded pimple with his fallen body scraped his finger from a ring of white apple. It was half-buried mad on honey of a dried brain, of two rangers, a heavy frey.

Greenbeard is actually a minor character in the ASOIAF books

Hodor comes back and can say something other than "Hodor!"

Hodor looked at them bellowing, “which road you should be home.”

Ned is still alive and Jon is a Lannister!

At once they were back there and they realize the way they wanted him to answer. When Jon Lannister staggered backward, Ned saw his axe and left hand in his head.

Varys poisons Daenerys and a dead man.

Varys poisoned Daenerys and another of the dead men. As he woke, it was a peaceful song, and now the low and the dawn was breaking up and there no smaller, robar the broken bones.

Jon rides a dragon and starts to get a little perverted...

Jon rode the dragons in a steep circle, buried fingers in the sand and there a burnt slope. “With a man should leave us clean, wench,” he said. “Stop him. Is that much? Until you’re at Winterfell simply get inside ’em o’ wildlings, or on the sound of a bastard dies.”

Lord Friendzone is off eating stew with chunks of butter...

Ser Jorah lingered to where the banners wending their descent down a long ways of rain. The marsh was ladling out beef-and-barley stew, cold as shy of three colors, chunks of butter.

Jaime kills Cersei and Jon becomes the wolf...

Jaime killed Cersei and was cold and full of words, and Jon thought he was the wolf now, and white harbor... Something about the day made the butt of her grow from the hem, half the white dogs running between two of Hizdahr’s arms.

They decide to let the dogs make decisions...

“Ask the dogs.”

It ends on a weird note during a winter storm with Jon's Targaryen side coming out in full color...

Once, she thought, it was wrong, climbing through the cloudless terrible light noise that was no last snow. Jon did not need to share a cup or part of it, but maybe this, a fat little blind girl.

Posted Elsewhere

And many other places on Google

Connect with me

If you'd like to collaborate on a project, learn more about me, or just say hi, feel free to contact me using any of the social channels listed below.

Training the Model

If you would like to train this model, you will need to use a GPU and Tensorflow 1.0. I used FloydHub with the following command:

floyd run <your-project-id> --gpu --env tensorflow-1.0 --mode jupyter

The text data can be found many places online.

Contributing

There are still so many unanswered questions. Is Jon actually a Lannister-Targaryen? How will the dogs rule the seven kingdoms? Why did Varys poison Daenerys? Who are the seconds sons of the onion concubine?

If you would like to help sing the song of fire and ice, feel free to use this repository and offer advice on how to improve the model. I'm still fairly new to neural networks, so any help would be greatly appreciated. I will consider merging pull requests if they make significant changes and improvements to the model.

Comments
  • IndexError: index 1 is out of bounds for axis 0 with size 1

    IndexError: index 1 is out of bounds for axis 0 with size 1

    IndexError Traceback (most recent call last) in () 29 {input_text: dyn_input, initial_state: prev_state}) 30 ---> 31 pred_word = pick_word(probabilities[dyn_seq_length-1], int_to_vocab) 32 33 gen_sentences.append(pred_word)

    IndexError: index 1 is out of bounds for axis 0 with size 1

    opened by tonyatml 5
  • RNN or LSTM?

    RNN or LSTM?

    Is this a vanilla RNN or an LSTM? I can't find the actual code.

    Also take a look at the newer text generation papers. In particular, there was this one paper (from Baidu research i believe?) on Chinese poetry generation that did incredibly well. I would in particular try GANs and autoregressive CNN models.

    opened by sixsamuraisoldier 4
  • ValueError: object too deep for desired array

    ValueError: object too deep for desired array

    Hi Buddy,

    There is an error when I run your program via 'ipython notebook' with following tips

    NFO:tensorflow:Restoring parameters from ./save

    ValueError Traceback (most recent call last) in () 30 31 #pred_word = pick_word(probabilities[dyn_seq_length-1], int_to_vocab) ---> 32 pred_word = pick_word(probabilities[0], int_to_vocab) 33 34 gen_sentences.append(pred_word)

    in pick_word(probabilities, int_to_vocab) 6 :return: String of the predicted word 7 """ ----> 8 return np.random.choice(list(int_to_vocab.values()), 1, p=probabilities)[0]

    mtrand.pyx in mtrand.RandomState.choice (numpy/random/mtrand/mtrand.c:17602)()

    ValueError: object too deep for desired array

    opened by tonyatml 3
  • It could take days not hours to train...

    It could take days not hours to train...

    Greetings,

    Nice project... With the default parameters you've gave, it takes days not hours, even with powerful GPUs on AWS.

    num_epochs = 10000; batch_size = 512; rnn_size = 512; num_layers = 3; keep_prob = 0.7; embed_dim = 512; seq_length = 30; learning_rate = 0.001;

    Also I have to cut the batch_size to 256 (as I think you also did) since I've got a GPU memory overflow. I'm curious to know if there is less greedy hyperparameters. In your Notebook, the executable shows more than 24 days.

    I'm also curious to compare with a simple Markov chain.

    Anyway thanks for the nice project that allows us to dream with tales.

    Claude Coulombe

    opened by ClaudeCoulombe 2
  • Greenbeard

    Greenbeard

    Greenbeard was actually a character (although I've forgotten him) I was initially perplexed thinking the network came up with a word outside the vocab.

    http://awoiaf.westeros.org/index.php/Greenbeard

    Just clearing it up for anybody who might be thinking along similar lines.

    opened by aneesh-joshi 1
  • Could you tell me the approximate final train_loss?

    Could you tell me the approximate final train_loss?

    In the notebook, the last train_loss is approximately 2.4. Since I am training a language generating model like yours, i am very curious about the final train_loss you get. Thanks!

    opened by zldrobit 1
  • Making trained model available?

    Making trained model available?

    Nice project! Is there any chance you could provide the trained model, so we can play a bit with it without going through the trouble of training a new one from scratch?

    opened by erickrf 1
  • Input dataset contains concerning non-speech artefacts

    Input dataset contains concerning non-speech artefacts

    No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without permission in writing from the publisher.

    This passage (line 27 /data/got1.txt) is stylistically different from George's usual prose, and may have some impact on the quality of the data that can be generated.

    opened by Birch-san 0
  • Saving and Reloading

    Saving and Reloading

    Hi, I'm wondering if it is possible to reload the model from a saved checkpoint. I've tried to implement this myself, but I don't really know much about tensorflow and run into errors.

    opened by PintsizedSix40 0
  • Memory issue

    Memory issue

    Hi. that's a great project there.. i loved it.. Could you please tell me about your hardware, I have MacBook Air with 8gb ram and it took almost 13 hours and then it crashed.. I was thinking to run it on a server so if you could just give me an idea about the memory.. i would really appreciate it... Thanks!

    opened by AakashChugh 0
  • New script

    New script

    Script thats allow you to generate book from already trained model. Only problems is that UTF8 characters not show up corectly, but i hope someone will fix it.

    opened by kodxana 0
  • Some questions.

    Some questions.

    1.Wiil it work if I put no GOT book? 2.Is there any way to start training and when I dont wanna train i can pause it and resume it from place that I stoped? 3.How can I generate book using trained model without starting training from begining?

    Hope you will anserw my questions :)

    Your project is so amazing 👍

    opened by kodxana 0
  • Porting to TensorFlow 1.4

    Porting to TensorFlow 1.4

    Hello, has anybody successfully ported to TensorFlow 1.4 ? I am encountering problems, and would appreciate help.

    1. crash here
    38     # Build RNN
    ---> 39     outputs, final_state = tf.nn.dynamic_rnn(cell, embed, dtype=tf.float32)
    

    if embed_dim is different from rnn_size. For the time being, I leave the 2 values equal.

    1. crash here
    ---> 34         pred_word = pick_word(probabilities[dyn_seq_length-1], int_to_vocab)
    IndexError: index 2 is out of bounds for axis 0 with size 1
    

    same problem as #15

    Any ideas ?

    opened by r3mi 2
Owner
Zack Thoutt
Personal blog - zackthoutt.com | Software and AI - autosalesvelocity.com | Beating Vegas - gridironai.com | OCR ninja knowlj.com
Zack Thoutt
Bible-App : Simple Tool To Show Bible Books

Bible App Simple Tool To Show Bible Books Socials: Language:

ميخائيل 5 Jan 18, 2022
This program tries to book a tennis court slot in either Southwark Park or Tanner Street Park in Southwark, London.

Book tennis courts in London This program tries to book a tennis court slot in either Southwark Park or Tanner Street Park in Southwark, London. Note:

Daniele 1 Jul 25, 2022
That is a example of a Book app on Python, made with support of all JS libraries on React framework

React+Python Books App You can use this repository whenever you want Used for a video Create the database: python -m dbutils Start the web server: pyt

Koma Human 1 Apr 20, 2022
Open source book about making Python packages.

Python packages Tomas Beuzen & Tiffany Timbers Python packages are a core element of the Python programming language and are how you create organized,

Python Packages 169 Jan 6, 2023
Open source home automation that puts local control and privacy first

Home Assistant Open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiast

Home Assistant 57k Jan 2, 2023
The first Python 1v1.lol triggerbot working with colors !

1v1.lol TriggerBot Afin d'utiliser mon triggerbot, vous devez activer le plein écran sur 1v1.lol sur votre naviguateur (quelque-soit ce dernier). Vous

Venax 5 Jul 25, 2022
Recreating my first CRUD in python, but now more professional

Recreating my first CRUD in python, but now more professional

Ricardo Deo Sipione Augusto 2 Nov 27, 2021
The blancmange curve can be visually built up out of triangle wave functions if the infinite sum is approximated by finite sums of the first few terms.

Blancmange-curve The blancmange curve can be visually built up out of triangle wave functions if the infinite sum is approximated by finite sums of th

Shankar Mahadevan L 1 Nov 30, 2021
It is Keqin Wang first project in CMU, trying to use DRL(PPO) to control a 5-dof manipulator to draw line in space.

5dof-robot-writing this project aim to use PPO control a 5 dof manipulator to draw lines in 3d space. Introduction to the files the pybullet environme

Keqin Wang 4 Aug 22, 2022
Async-first dependency injection library based on python type hints

Dependency Depression Async-first dependency injection library based on python type hints Quickstart First let's create a class we would be injecting:

Doctor 8 Oct 10, 2022
A Lynx that manages a group that puts the federation first.

Lynx Super Federation Management Group Lynx was created to manage your groups on telegram and focuses on the Lynx Federation. I made this to root out

Unknown 2 Nov 1, 2022
A site devoted to celebrating to matching books with readers and readers with books. Inspired by the Readers' Advisory process in library science, Literati, and Stitch Fix.

Welcome to Readers' Advisory Greetings, fellow book enthusiasts! Visit Readers' Advisory! Menu Technologies Key Features Database Schema Front End Rou

jane martin 6 Dec 12, 2021
Py address book gui - An address book with graphical user interface developed with Python Tkinter

py_address_book_gui An address book with graphical user interface developed with

Milton 4 Feb 1, 2022
A python scripts that uses 3 different feature extraction methods such as SIFT, SURF and ORB to find a book in a video clip and project trailer of a movie based on that book, on to it.

A python scripts that uses 3 different feature extraction methods such as SIFT, SURF and ORB to find a book in a video clip and project trailer of a movie based on that book, on to it.

tooraj taraz 3 Feb 10, 2022
A cross-platform script to book first available time for getting a passport in Sweden - Ett skript som automatiskt bokar pass hos polisen

Automatic passport booker - Boka pass automatiskt hos Svenska polisen A cross-platform script to book first available time for getting a passport in S

Elias Floreteng 14 Oct 17, 2022
Tensorflow-based CNN+LSTM trained with CTC-loss for OCR

Overview This collection demonstrates how to construct and train a deep, bidirectional stacked LSTM using CNN features as input with CTC loss to perfo

Jerod Weinman 489 Dec 21, 2022
a reccurrent neural netowrk that when trained on a peice of text and fed a starting prompt will write its on 250 character text using LSTM layers

RNN-Playwrite a reccurrent neural netowrk that when trained on a peice of text and fed a starting prompt will write its on 250 character text using LS

Arno Barton 1 Oct 29, 2021
LSTM model trained on a small dataset of 3000 names written in PyTorch

LSTM model trained on a small dataset of 3000 names. Model generates names from model by selecting one out of top 3 letters suggested by model at a time until an EOS (End Of Sentence) character is not encountered.

Sahil Lamba 1 Dec 20, 2021
An implementation of the AlphaZero algorithm for Gomoku (also called Gobang or Five in a Row)

AlphaZero-Gomoku This is an implementation of the AlphaZero algorithm for playing the simple board game Gomoku (also called Gobang or Five in a Row) f

Junxiao Song 2.8k Dec 26, 2022
Drug Discovery App Using Lipinski's Rule-of-Five.

Drug Discovery App A Drug Discovery App Using Lipinski's Rule-of-Five. TAPIWA CHAMBOKO ?? About Me I'm a full stack developer experienced in deploying

tapiwa chamboko 3 Nov 8, 2022