Skip to content

Instantly share code, notes, and snippets.

@dkohlsdorf
Created June 13, 2018 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkohlsdorf/992f63b11779d8647727377c436533c7 to your computer and use it in GitHub Desktop.
Save dkohlsdorf/992f63b11779d8647727377c436533c7 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Generating from the little book of calm\n",
"\n",
"If you saw the show `black books`, you saw the calming powers of the little book of calm.\n",
"Suprisingly the [book](https://www.amazon.de/Little-Book-Calm-Paul-Wilson-ebook/dp/B00APNQ114/ref=tmm_kin_swatch_0?_encoding=UTF8&qid=1528812260&sr=8-1) actually exists. I extracted the text from the Kindle version and will now tain an LSTM with it in order to generate an infinity stream of calming advice. For copyright reasons I can not attach the text. So if you want to train this too, you need to buy the Kindle version."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Using TensorFlow backend.\n"
]
}
],
"source": [
"import sys\n",
"import warnings\n",
"import numpy as np\n",
"from keras.layers import *\n",
"from keras.models import *\n",
"from keras.optimizers import *\n",
"from keras.callbacks import *\n",
"\n",
"warnings.filterwarnings('ignore')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"first we load the book and print some of the calming advice: "
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"def calm():\n",
" lines = \"\"\n",
" for line in open('littleCalm.txt'):\n",
" line = line.strip()\n",
" if len(line) > 0:\n",
" lines += line.lower() + ' '\n",
" return lines"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"SOME CALMING TEXT:\n",
"\n",
"carry a piece of the quiet concentrate on silence. when it comes, dwell on what it sounds like. then strive to carry that quiet with you wherever you go. waste some time hard-working people never waste time on frivolous, fun-filled activities. yet, for hard-working people, any time spent this way is far from wasted. select your company well as harsh as it may sound, mixing with highly stressed people will make you feel stressed. on the other hand, mixing with calm people – even for the briefest period – will leave you feeling calm. be captivated by your breath when you dwell on the sound of your breathing, when you can really hear it coming and going, peace will not be far behind. pause between changes there’s always a temptation to lump all your life changes into one big masochistic event. do your stress levels a favour and take on changes one at a time. invest in a fruit bowl the more beautiful your fruit bowl, the better stocked it is, the less likely you are to stress – enhancing s [...]\n"
]
}
],
"source": [
"calm_text = calm()\n",
"print(\"SOME CALMING TEXT:\\n\\n{} [...]\".format(calm_text[0:1000]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In the text we have a set of 46 characters and 28042 characters in total"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"#characters: 46\n",
"#chars total: 28042\n"
]
}
],
"source": [
"characters = sorted(list(set(calm_text)))\n",
"char_to_int = dict((c, i) for i, c in enumerate(characters))\n",
"int_to_char = dict((i, c) for i, c in enumerate(characters))\n",
"\n",
"n_char = len(characters)\n",
"print(\"#characters: {}\".format(n_char))\n",
"print(\"#chars total: {}\".format(len(calm_text)))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We split the text into 1-hot coded windows of equal length.\n",
"The predictor is a many-to-many LSTM."
]
},
{
"cell_type": "code",
"execution_count": 113,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"_________________________________________________________________\n",
"Layer (type) Output Shape Param # \n",
"=================================================================\n",
"bidirectional_14 (Bidirectio (None, 40, 256) 179200 \n",
"_________________________________________________________________\n",
"time_distributed_2 (TimeDist (None, 40, 46) 11822 \n",
"=================================================================\n",
"Total params: 191,022\n",
"Trainable params: 191,022\n",
"Non-trainable params: 0\n",
"_________________________________________________________________\n"
]
}
],
"source": [
"length = 40\n",
"step = 1\n",
"model = Sequential()\n",
"model.add(Bidirectional(LSTM(128, input_shape=(length, n_char), return_sequences=True), input_shape=(length, n_char)))\n",
"model.add(TimeDistributed(Dense(n_char, activation='softmax')))\n",
"optimizer = RMSprop(lr=0.01)\n",
"model.compile(loss='categorical_crossentropy', optimizer=optimizer)\n",
"\n",
"model.summary()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In order to create the training data, we extract a window of characters as the input and the one right after as the prediction. The hotcoded windows have the shape `(n, len, dim)` which represents `n` time series of length `len` and dimension `dim`. "
]
},
{
"cell_type": "code",
"execution_count": 92,
"metadata": {},
"outputs": [],
"source": [
"def training_data(text, length, step):\n",
" n = len(text)\n",
" for i in range(length, n - 1, step):\n",
" x = text[i - length : i]\n",
" y = text[i - length + 1 : i + 1]\n",
" yield (x, y)\n",
" \n",
"def hotcode_seq(shingles, length, dim, char_dict):\n",
" n = len(shingles)\n",
" hotcoded = np.zeros((n, length, dim))\n",
" for i, shingle in enumerate(shingles):\n",
" for j, c in enumerate(shingle):\n",
" hotcoded[i, j, char_dict[c]] = 1.0\n",
" return hotcoded"
]
},
{
"cell_type": "code",
"execution_count": 100,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Data: \n",
" - x: carry a piece of the quiet concentrate o_\n",
" - y:_arry a piece of the quiet concentrate on\n"
]
}
],
"source": [
"data = list(training_data(calm_text, length, step))\n",
"obs = hotcode_seq([x for x, _ in data], length, n_char, char_to_int)\n",
"pred = hotcode_seq([y for _, y in data], length, n_char, char_to_int)\n",
"\n",
"print(\"Data: \")\n",
"print(\" - x: {}_\".format(data[0][0]))\n",
"print(\" - y:_{}\".format(data[0][1]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can generate some text after each epoch: a character is drawn from the last output of the lstm. Initially we use a random window of the original text, and then using it in a sliding manner, always addint the last drawn character."
]
},
{
"cell_type": "code",
"execution_count": 111,
"metadata": {},
"outputs": [],
"source": [
"def sample(preds):\n",
" # Only take the last prediction\n",
" preds = np.asarray(preds).astype('float64')[length - 1] - 1e-6\n",
" probas = np.random.multinomial(1, preds, 1)\n",
" return np.argmax(probas)\n",
"\n",
"def sample_sequence(n):\n",
" start_index = np.random.randint(0, len(calm_text) - length - 1)\n",
" generated = ''\n",
" sentence = calm_text[start_index: start_index + length]\n",
" generated += \"[{}]\\t\".format(sentence)\n",
" for i in range(n):\n",
" x_pred = np.zeros((1, length, n_char))\n",
" for t, char in enumerate(sentence):\n",
" x_pred[0, t, char_to_int[char]] = 1.\n",
"\n",
" preds = model.predict(x_pred, verbose=0)[0]\n",
" next_index = sample(preds)\n",
" next_char = int_to_char[next_index]\n",
" generated += next_char\n",
" sentence = sentence[1:] + next_char\n",
" return generated\n",
"\n",
"def on_epoch_end(epoch, logs):\n",
" print()\n",
" print()\n",
" print(sample_sequence(100))\n",
" print()\n",
"print_callback = LambdaCallback(on_epoch_end=on_epoch_end)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"During training, we also output some sampled characters for a random window. The square brakets indicate the seed\n",
"sentence. "
]
},
{
"cell_type": "code",
"execution_count": 114,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Epoch 1/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.4114\n",
"\n",
"[do one little thing that stimulates this]\t a ryy ios you bof whovotatime you cammees a sousutoill and merevet andout an cilll – guth nors cala\n",
"\n",
"28001/28001 [==============================] - 90s - loss: 0.4101 \n",
"Epoch 2/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0538\n",
"\n",
"[u have a secret to becoming calm. listen]\t, oxlly mone. frewt’ld your hithtne loke nats lighes walm. your you’lf ont thitw of havoouristseds a\n",
"\n",
"28001/28001 [==============================] - 198s - loss: 0.0537 \n",
"Epoch 3/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0496\n",
"\n",
"[your calm. control only what you can con]\tcetersjorn breathting caan id your concentrnse calm yourself a co thinghe food when yourtelf tras an\n",
"\n",
"28001/28001 [==============================] - 137s - loss: 0.0496 \n",
"Epoch 4/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0413\n",
"\n",
"[ride for sheer delight while some forms ]\tof stact – han you’ll sullo achion effarte on simplyty, entily, arot most hinly one a ligutono you y\n",
"\n",
"28001/28001 [==============================] - 127s - loss: 0.0413 \n",
"Epoch 5/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0381\n",
"\n",
"[ it also sets off an emotional chain rea]\tdonaina, you dryor if phistras allieve ard – it’s chapieny. fands mesled. know you do and fork orh s\n",
"\n",
"28001/28001 [==============================] - 135s - loss: 0.0381 \n",
"Epoch 6/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0353\n",
"\n",
"[back seat (with a driver you trust), and]\ts will zy freellty to spede it, a time a carout. there is nevers a hawing wiot, wrichil distating yo\n",
"\n",
"28001/28001 [==============================] - 133s - loss: 0.0353 \n",
"Epoch 7/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0330\n",
"\n",
"[ – then quickly let them go limp. the co]\tpsit as thoushal. do your bosemost that physigatee for your cost with to become around to becamis of\n",
"\n",
"28001/28001 [==============================] - 137s - loss: 0.0330 \n",
"Epoch 8/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0311\n",
"\n",
"[ if taken regularly. lower the crossbar ]\tadd it sounds will be the poritiegs on and with as of the a simple. relaxitging no sort on a way a b\n",
"\n",
"28001/28001 [==============================] - 153s - loss: 0.0311 \n",
"Epoch 9/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0296\n",
"\n",
"[medy, produces a calming effect in tryin]\tgs of the most oness and you knowing of a favourion, theme, muteral tegroutine a stop with a day. al\n",
"\n",
"28001/28001 [==============================] - 135s - loss: 0.0296 \n",
"Epoch 10/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0282\n",
"\n",
"[on serves no purpose and becomes an end ]\tto others to do in and cha chious about finge on your comp with when it. fullod as yourself then lov\n",
"\n",
"28001/28001 [==============================] - 132s - loss: 0.0282 \n",
"Epoch 11/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0272\n",
"\n",
"[r worry habits. take a different road ho]\tur about feelings ont all soltuling water more oxygenes when you’re yours stace of the palm, a brush\n",
"\n",
"28001/28001 [==============================] - 132s - loss: 0.0272 \n",
"Epoch 12/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0260\n",
"\n",
"[variety and vitality to your day. give y]\tourself carenarderfuch helps as as the armed mesly relax a lmut. egrvethe cluat as the worch take wo\n",
"\n",
"28001/28001 [==============================] - 116s - loss: 0.0260 \n",
"Epoch 13/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0255\n",
"\n",
"[trate on your own needs and responsibili]\tnity to out, the forete. sivenous holings towacy foou frow plassure exersion, with unpasin dalk, set\n",
"\n",
"28001/28001 [==============================] - 108s - loss: 0.0255 \n",
"Epoch 14/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0248\n",
"\n",
"[ exercises around, uninhibited dancing d]\tivimaly wrativative. the little then way you deeds your breathing towel deac udly even a lape the wi\n",
"\n",
"28001/28001 [==============================] - 109s - loss: 0.0248 \n",
"Epoch 15/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0241\n",
"\n",
"[sful business. take the back seat (with ]\tyour node for the sopet tog and abong scall. abiricteds recall the mist sairs and frase on siment no\n",
"\n",
"28001/28001 [==============================] - 107s - loss: 0.0241 \n",
"Epoch 16/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0235\n",
"\n",
"[ going to become calm. they could be the]\t fewerder nervion in the is seest before you doing to be vereming cranscopy tray taing thicate feeli\n",
"\n",
"28001/28001 [==============================] - 107s - loss: 0.0235 \n",
"Epoch 17/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0230\n",
"\n",
"[egardless of whether it is natural or ma]\tke all stresse thoughts care it prosettion to thoek you f on simps yo gh in the most uneizzz recogni\n",
"\n",
"28001/28001 [==============================] - 108s - loss: 0.0230 \n",
"Epoch 18/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0224\n",
"\n",
"[w quickly they dissolve when you read th]\tem oat as you want take take calm to become cion int in calm places litting think parit is to sit yo\n",
"\n",
"28001/28001 [==============================] - 106s - loss: 0.0225 \n",
"Epoch 19/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0220\n",
"\n",
"[ politeness practise politeness, not for]\t the good harty your stunon the time a chere ion dissolve with intent relaxes. assofew feelings you \n",
"\n",
"28001/28001 [==============================] - 121s - loss: 0.0220 \n",
"Epoch 20/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0217\n",
"\n",
"[ay twice a day, spend a few minutes not ]\tbetween as for the smipuach your feet, into a usfucled. leguls, ‘r and be sabsine of your faerived t\n",
"\n",
"28001/28001 [==============================] - 104s - loss: 0.0217 \n",
"Epoch 21/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0212\n",
"\n",
"[oy your subconscious your subconscious s]\tetcerses a favour the vitalinates. be the spopes. a sound, not – rout take on what you’re calmb. str\n",
"\n",
"28001/28001 [==============================] - 99s - loss: 0.0212 \n",
"Epoch 22/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0209\n",
"\n",
"[zzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzz]\tzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzz\n",
"\n",
"28001/28001 [==============================] - 100s - loss: 0.0209 \n",
"Epoch 23/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0205\n",
"\n",
"[er it’s hard to feel tense when you’re l]\teave not as unly the most fingertips. take on the hatisfact in firving calm. know when a co– a favou\n",
"\n",
"28001/28001 [==============================] - 102s - loss: 0.0205 \n",
"Epoch 24/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0202\n",
"\n",
"[n if it’s only with the most trivial act]\tivitien in the bath like big things may feelings of call assolve tray soat ‘en. the relaxation. is s\n",
"\n",
"28001/28001 [==============================] - 100s - loss: 0.0202 \n",
"Epoch 25/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0197\n",
"\n",
"[hich has been coveted for its aphrodisia]\tc propertion. nothing breathe lightengelt you drople small istlicts. one of almothistapticedin to ro\n",
"\n",
"28001/28001 [==============================] - 100s - loss: 0.0197 \n",
"Epoch 26/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0197\n",
"\n",
"[ters, fluorescent lights … all add to fe]\tel the eloxide on the ised in your own are alothe triigs around the time possible siturality, you wi\n",
"\n",
"28001/28001 [==============================] - 110s - loss: 0.0197 \n",
"Epoch 27/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0194\n",
"\n",
"[a relaxing combination of essential oils]\t to there is sedarcess, eal in it, sceness mind. only seeds. alcop etcenturion. sutwhonf perso chome\n",
"\n",
"28001/28001 [==============================] - 111s - loss: 0.0194 \n",
"Epoch 28/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0191\n",
"\n",
"[e to relax the nervous system if taken r]\telaxation to addict to ad a ctall dien. tenking combot the briefer than you well be as a pisklowazy.\n",
"\n",
"28001/28001 [==============================] - 97s - loss: 0.0191 \n",
"Epoch 29/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0186\n",
"\n",
"[or yourself to succeed from time to time]\t – host when it is musceinly access you can be calm people have a masseiblance that appreciate the m\n",
"\n",
"28001/28001 [==============================] - 129s - loss: 0.0186 \n",
"Epoch 30/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0184\n",
"\n",
"[lightenment to be had in changing the wa]\ty to most relieecce it is more than help you the bushics – un the time can camilities, you fee, the \n",
"\n",
"28001/28001 [==============================] - 116s - loss: 0.0185 \n",
"Epoch 31/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0182\n",
"\n",
"[rly start every journey ten minutes earl]\ty for dach of park, tull trying them, or an electric evening at relaxed perpomssont to arg becthic a\n",
"\n",
"28001/28001 [==============================] - 104s - loss: 0.0182 \n",
"Epoch 32/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0180\n",
"\n",
"[ massaging your eyebrows in an outwards ]\tdive you much your find if you aw acce’t it is no there is covers and ancegeneryted for your dasphin\n",
"\n",
"28001/28001 [==============================] - 105s - loss: 0.0180 \n",
"Epoch 33/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0176\n",
"\n",
"[nly what you can control be rigorous in ]\twhate detace of relaxed perane your every much more politeistormally when the way mower earl wortg t\n",
"\n",
"28001/28001 [==============================] - 142s - loss: 0.0176 \n",
"Epoch 34/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0176\n",
"\n",
"[any reflexologist will tell you that tru]\te relaxed lower than is the moment, add it marbables positivet only of much poway, sleep. small issu\n",
"\n",
"28001/28001 [==============================] - 123s - loss: 0.0176 \n",
"Epoch 35/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0171\n",
"\n",
"[ly you are to stress – enhancing snack f]\tor the most under and lead them, and you feel stress and helps yourself eal cthands to your effictin\n",
"\n",
"28001/28001 [==============================] - 137s - loss: 0.0171 \n",
"Epoch 36/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0169\n",
"\n",
"[ major traumas through to little anxieti]\tons of every mar – soon wheter with your astins more fruith to works probleme a time, and you’ll be \n",
"\n",
"28001/28001 [==============================] - 115s - loss: 0.0169 \n",
"Epoch 37/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0166\n",
"\n",
"[most things which take place in your tho]\tught alk. each efferention salt. several once ablot no the diary, parit than conscious off for the l\n",
"\n",
"28001/28001 [==============================] - 126s - loss: 0.0166 \n",
"Epoch 38/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0166\n",
"\n",
"[calm. take junior lessons take a lesson ]\ta change to relax them or not being people wear physifued. stres any recognise them. the post oxygen\n",
"\n",
"28001/28001 [==============================] - 120s - loss: 0.0166 \n",
"Epoch 39/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0164\n",
"\n",
"[to avoid the stresses of debt, think abo]\tut liste speace time. from time. then do for, the momen you move and it doest so many stress – en th\n",
"\n",
"28001/28001 [==============================] - 153s - loss: 0.0164 \n",
"Epoch 40/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0162\n",
"\n",
"[ see yourself on the sun-bleached sands.]\t finger pheatent. change the moment you can chance for yourself to specivediatelf your subconscious \n",
"\n",
"28001/28001 [==============================] - 144s - loss: 0.0162 \n",
"Epoch 41/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0161\n",
"\n",
"[mples are extraordinary places of peace.]\t talk on a suep. klecaised rexitter havinging your feelings of calm. breathing you are relaxing to l\n",
"\n",
"28001/28001 [==============================] - 127s - loss: 0.0161 \n",
"Epoch 42/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0157\n",
"\n",
"[ing sense of calm. get it off your chest]\t arist this tension to the less pressure you are came whatever you can combsy take out yourself offe\n",
"\n",
"28001/28001 [==============================] - 131s - loss: 0.0157 \n",
"Epoch 43/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0156\n",
"\n",
"[ yourself on an idyllic south pacific is]\tlanday calm will feel nevery feels and the satisfy’t be to feel as that most cas skill life. dreatin\n",
"\n",
"28001/28001 [==============================] - 118s - loss: 0.0156 \n",
"Epoch 44/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0156\n",
"\n",
"[he resultant positive feelings take care]\t of etent with an imaginars the lookout for things thatm orly do about oill owning but be surprised \n",
"\n",
"28001/28001 [==============================] - 102s - loss: 0.0156 \n",
"Epoch 45/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0151\n",
"\n",
"[hout the day. you’ll be surprised at how]\t hidederf the more of hasso mask. noth encegen a jowand about it. fare some forms of way the bathron\n",
"\n",
"28001/28001 [==============================] - 103s - loss: 0.0150 \n",
"Epoch 46/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0150\n",
"\n",
"[us mind a rest. meditate concentrate on ]\tsilemon small eyes are not and things. unids if you set your must and greatly sit your stimply havin\n",
"\n",
"28001/28001 [==============================] - 103s - loss: 0.0150 \n",
"Epoch 47/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0150\n",
"\n",
"[nt is custom – designed to induce frustr]\tation warm kails, you can only regularion chumbreet the imspecial your avoid taking a favourite. eve\n",
"\n",
"28001/28001 [==============================] - 102s - loss: 0.0150 \n",
"Epoch 48/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0148\n",
"\n",
"[g calmly, you can spread a feeling of ca]\tlm with your seem, single on the most uniquing every day – not becausly, keep a day, si nice a feeli\n",
"\n",
"28001/28001 [==============================] - 102s - loss: 0.0148 \n",
"Epoch 49/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0145\n",
"\n",
"[hone ringing once or twice in your life ]\tcomes from a time for your lightch one absurtull, mains a stop work wear doing so will you’ll be sta\n",
"\n",
"28001/28001 [==============================] - 102s - loss: 0.0145 \n",
"Epoch 50/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0145\n",
"\n",
"[abit indulge yourself by being generous ]\tseit if you deed. arguments a thought – warm foul. sees them, prace your face pleasurely, doments ab\n",
"\n",
"28001/28001 [==============================] - 104s - loss: 0.0145 \n",
"Epoch 51/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0145\n",
"\n",
"[ou will feel more peaceful. make friends]\t without, in a saluncust in your combinaty and relaxed in the winioully, you ton. chuch in them be s\n",
"\n",
"28001/28001 [==============================] - 104s - loss: 0.0145 \n",
"Epoch 52/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0140\n",
"\n",
"[e oils to your pillow every few nights f]\tor hegathem. do what interferes with the pracisiner pretend and happenceat relax massaging combitate\n",
"\n",
"28001/28001 [==============================] - 104s - loss: 0.0141 \n",
"Epoch 53/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0144\n",
"\n",
"[fluence on the way you feel. loose garme]\tnts to becoming calm. for them. press one hand you’ll findicery the fewer abovoile out yourself. onl\n",
"\n",
"28001/28001 [==============================] - 104s - loss: 0.0144 \n",
"Epoch 54/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0139\n",
"\n",
"[e colours – one warm, two cool – has the]\t relaxing once the more – to being comforts in your faciel, ass to time. than integics on a compliev\n",
"\n",
"28001/28001 [==============================] - 105s - loss: 0.0139 \n",
"Epoch 55/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0140\n",
"\n",
"[past does not exist in any way other tha]\tn in your work imporiat will become water graies, ducually politeness, put the eaghing bet the day. \n",
"\n",
"28001/28001 [==============================] - 106s - loss: 0.0141 \n",
"Epoch 56/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0137\n",
"\n",
"[lain) the small type for you. pat someth]\ting do. the sound, and complexity in. be control for) to sale. prute to’ es. by most renhing take t\n",
"\n",
"28001/28001 [==============================] - 104s - loss: 0.0137 \n",
"Epoch 57/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0135\n",
"\n",
"[tongue. turn into a windmill imagine a w]\tindness of romain a pressure upwarm or the less like ba the momemy concencenns in life, the hands ar\n",
"\n",
"28001/28001 [==============================] - 105s - loss: 0.0135 \n",
"Epoch 58/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0133\n",
"\n",
"[es of debt, think about what you can aff]\timing down on the roof the lights withor waytive of calm before you know it. train a distress – yead\n",
"\n",
"28001/28001 [==============================] - 105s - loss: 0.0133 \n",
"Epoch 59/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0132\n",
"\n",
"[ the machine – take a walk around the bl]\tock, shee you wouldn’t normally shound while to your then you’ll be to be tw ist to limeng to break \n",
"\n",
"28001/28001 [==============================] - 104s - loss: 0.0132 \n",
"Epoch 60/60\n",
"27904/28001 [============================>.] - ETA: 0s - loss: 0.0128\n",
"\n",
"[ld the words back when you’re under pres]\tscents are then way you feel. slow down your good invers no simples. they are alway. having to wave \n",
"\n",
"28001/28001 [==============================] - 105s - loss: 0.0128 \n"
]
},
{
"data": {
"text/plain": [
"<keras.callbacks.History at 0x13d2294e0>"
]
},
"execution_count": 114,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model.fit(obs, pred, batch_size=128, epochs=60, shuffle=True, callbacks=[print_callback])"
]
},
{
"cell_type": "code",
"execution_count": 119,
"metadata": {},
"outputs": [],
"source": [
"model.save('infinite_calm.h5') "
]
},
{
"cell_type": "code",
"execution_count": 126,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\"thes the upset child, just as a kiss or handshake takes the pleasures eale them to poins of almous to be calming end it carting dive you’ll find calm phosting work is acyies all little forgsimutarly aboveruts a phopees will tell you, nothed (which your speech trangess there are tho defullame and eyebrows phon places of person, joyous every meal with the fores or nacciols, and discontrom to the hear postrous into them most powerm, when they gretophsints to calm. sho exercises when they laverds with the concenturies an much you think as\"\n",
"\n",
"\n",
"\"eel calm. recognise addictions for what your has a little choice. devers of a favour things which the worldor tak every moments worry habirothing – you half the way to feel. emplay of the lights – quiet – entoy not worrierate – beting worry king before you think about still, bow feelinggs there is enliet before yourself calm if you feel calm your earl goonicoly disary taskn take the time is efly. kink well assential astimugars asout peace – and have all tall you to can calm. the way you look at that your happenng, puts of orange blome\"\n",
"\n",
"\n",
"\"e stand straighter and taller than you beliefs, you will fool your hand, mixitates even the back sede tans bighing take and the ennable treates the beauty the add to think worty as major troutten if you combscents are among the humone situations: you treat at attating them. trank und harty thing an ised. on the small issues them, on your ease a sea calm always stimulates things that as much you must’, ‘i subripress on a way of what your day – from will happen. life for have to live a timens ael add the con rowhing wholly on tat hapte,\"\n",
"\n",
"\n",
"\"then you can be calm. sip warm water a glass than politens, put as you tonkelow yourself up. player. sel they is possible not to calm. then you connald ablity to live a cemplemants and englavoide. make to the benor effort into hands, not for twengy to the roother unlike in your diet, something with a peyture of peace and calm deind go little known bad compony all spech speeds can seritally when at a physictionel. your hearly, small issues them, soothes of a hand at also keolitas the moment your feet, then review then ptsic a fatticula\"\n",
"\n",
"\n",
"\"learning something you want to know. and you hueld’ go limp. removeties it posttert in the worlding the way you look at then posittle with your attionshops a out the cl-fectly having a little controgises to be remote. by massal favour bady them. is thice as you go envements are then positive to be captivelity when it carnething to say your subconscious speative of remote those who trere you ueld it before yourself underful fact as the feelostrust in everything when you’re leave dowalk a little between what harts like go to bed. whish \"\n",
"\n",
"\n",
"\"the moment when you concentrate your attention on a way attiony what it’s only of relaxing those calm, even up, by so fhols, behaw recognise them bach someone, alwings a calm people about beauty phor people als your thoughts, will take whice a groutts a calm person, a floathing down on a grass to help you know, by replyating widg a few chill, your speech, resubcents, you feel calm toom to your can most used the moments art teads. wear wearious from time to be a stimulations in whatever you grust – then reony something your faving to w\"\n",
"\n",
"\n",
"\"light one stop early if you consciously start is to relaxed with your speech speeds. by a coach even the most commot flowsh and exprect. works bectionss your speech speeds of a field unting with the groours, but for the plears nalk eget to feel calm. rong with a masseur once that your face pheropen having to sal awhable place, a conscious to be captivelocar place, up them of a damplestilm of the espences and little not train. every sayols around the back ood be sad, them do. then massage them ind tee… as you busly petson time to time \"\n",
"\n",
"\n",
"\"time in the world to do whatever you choose a feet and contribute to than wessed for yourself untethink, acchut for the recogail oilk, and the ritimeting snack being (iss than peritups, it can be pressude yourself underle – chrisical that suches of patting your efficienals at, pu… child, joyous pios from time to time little only a timend for hard-working postable full you work, uphilly to go know wholatge them. puss, pursom efficiently you achiely that happens interivation. its massage – then recom in your breet routine your typewrite\"\n",
"\n",
"\n",
"\"even more peaceful. break the pattern when you dwell twan fow times on explcomess with nich and feel negative for the rescom only a time. change specially, then ete someon, treards to your faith noat as muchically time sometimes works mication, but for they like gardesly how – you wouldn’t normally your hail, relaxed. wearing a stimulation. be computer you niel. be absold of time, whaner always a compliment possible future, with your speech spee, minutes to times out of standing, deciduerble when the concedints are atssetic eation wit\"\n",
"\n",
"\n",
"\"make an appointment with yourself to deal with worries that as major stressed when you’re helaxed with a resalk post your breathing, when you’re lead to calm. changes on the pest the thumb are then massage them go them, taking pleaser the most more efficiently when a country worry beads. play , any time – hose negne a softet for deeps a chomples. take ba hothing them. then raised by your life relaxt to stayicher when you sach add there’s tense sire time eas a pew your day, cannot by where you wouldn’t normally thinks. peace will not b\"\n",
"\n",
"\n"
]
}
],
"source": [
"for i in range(0, 10):\n",
" print(\"\\\"{}\\\"\\n\\n\".format(sample_sequence(500).replace('\\t', ' ').replace('[', '').replace('] ', '')))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment