Natural Language Processing

In [1]:
from ipypublish import nb_setup

Introduction

Natural Language Processing or NLP is an important application area for Neural Networks. Just as images are full of patterns in pixel space which can detected by Neural Networks, human language also presents a rich panorama of patterns which Neural Networks can exploit. In order to detect these patterns, words and sentences have to coded and then fed into the model. We start by describing how this is done in the section on Word Embeddings. It is shown there that words can be represented using 1-D tensors or vectors, the contents of which are analogous to the RGB pixels in an image. These vectors, called Word Embeddings, are arranged in N dimensional vector space in a way such that words with similar meanings have their embeddings cluster together. Once we know how to embed words, the next step is to encode entire sentences or even larger units. In order to do this we use the Neural Network models that we have developed in the last few chapters, in particular RNNs and LSTMs (including GRUs). The process of finding representations for a sequence of words is called Language Modeling and we show how this can be accomplished using Self-Supervised Learning. Once we have such a representation, it can be used for a variety of useful tasks, including:

  • Machine Translation
  • Text Categorization
  • Speeech Transcription
  • Question-Answering
  • Text Summarization

Since NLP is an commercially important technology, decades of work had gone into it the pre-Deep Learning era. Within a few short years, Neural Network models have begun to equal or better older techniques in tasks such as Speech Transcription and Machine Translation, and steady progress is being made in other areas as well.

In this chapter we will make extensive use of Neural Network models as Generators, i.e., they will be used to generate sentences (in contrast to earlier chapters in which Neural Networks were used mainly for classification). Generative Modeling is an emerging area in Deep Learning, and has also been used to generate images as shown in Chapter ConvNetsPart2 and in the chapter on Unsupervised Learning. However unlike for Image Processing, Generative Modeling is integral to performing important NLP applications such Machine Translation and Speech Transcription.

In the next chapter we will introduce a class of Neural Network models called Transformers that were introduced recently (in 2017). They constitute another way of modeling sequences, beyond RNNs and LSTMs, and outperform these older models in most NLP tasks. Transformers can also be pre-trained and then used do Transfer Learning for NLP tasks, just like ConvNets are used for Transfer Learning for images. This is an exciting emerging area which is still in its research phase.

Word Embeddings

The coding rule used to encode words in a text document is known as Word Embedding and it is used to convert a vocabulary of words into points in a high dimensional co-ordinate space. In previous chapters we used Word Embeddings to encode the text in the IMDB Movie Review dataset, and the reader may recall that there were two ways in which it could be done:

  1. By using pre-trained Word Embeddings, such as Word2Vec or Glove
  2. By using Gradient Descent to find the embeddings as part of the model training process

Method 1 works better if the training data is limited, since the Word Emveddings are already pre-trained on a much larger vocabulary. If there is enough data available then Method 2 should be tried, since it learns embeddings that are more appropriate for the problem at hand. In this section we focus on Method 1 and show how pre-training is done for the Word2Vec model.

The most straightforward rule for embedding is the 1-of-K Encoding (also known as One-Hot Encoding), and works as follows: If the vocabulary under consideration consists of a certain number of words, say 20,000 words, then the system encodes them using a 20,000 dimensional vector, in which all the co-ordinates are zero, except for the index co-ordinate for the word, that is set one. There are two problems with this scheme:

  • It results in extremely high dimensional input vectors, and the dimension increases with increasing number of words in the vocabulary.
  • The coding scheme does not incorporate any semantic information about the words, since the representations are all located equi-distant from each other at the vertices of a K-dimensional cube.

In order to remedy these problems, researchers have come up with several alternative algorithms to do Word Embeddings, one of the most popular of which is Word2Vec. This representation is created by making use the words that occur frequently in the neighborhood of the target word, and it has been shown to capture many linguistic regularities.

In [6]:
#rnn50
nb_setup.images_hconcat(["DL_images/rnn50.png"], width=1000)
Out[6]:

In order to understand how the algorithm works, consider the table in Figure rnn50 which considers the problem of encoding the words "kitten", "cat" and "dog". In order to capture the meaning of these three words, we represent them using a vector of size four as shown. The co-ordinates of this vector encode the following characteristics which are found in the original three words: bite, cute, furry and loud. For example a kitten can be characterized as being cute, while a cat is furry and loud in addition to being cute. Representing of words using this vector scheme captures semantic information about them, and it is concievable that words that are closer in meaning will have vectors that occur closer to each other. One way of capturing this similarity is by using the inner product or cosine between the vectors, and as shown above, by this measure cats and kittens are more similar as compared to dogs and kittens.

Word2Vec encodes words into vectors by automating the procedure that was described above. Instead of having to manually specify the characteristics of a word, Word2Vec automatically infers this information by other words that occur frequently together in the same sentence as the target word (for example sentences that have the words "kitten" and "cute" would occur more frequently than sentences with the words "kitten" and "bite").

In [4]:
#CBOW
nb_setup.images_hconcat(["DL_images/rnn28.png"], width=1000)
Out[4]:

Word2Vec uses two algorithms to generate Word Embeddings, namely Continuous Bag of Words (CBOW) and Skip-Gram. Both these algorithms use shallow Neural Networks that are trained in a self-supervised manner, so they are extremely fast. Figure CBOW shows the CBOW network, and it works as follows: The Input Layer consists of 1 of K encoded representations for all the words in a sentence, except for the target word. In the example shown, for the sentence "the dog chased the cat", the target word is set to "dog" and the words "chased" and "cat" are the inputs into the network. The main idea of the algorithm is to train the network with backprop while using the target word as the label, and this is done in two linear stages:

  • In the first stage each of the 1-Hot-Encoded word vectors (which are of size V, where V is the number of words in the vocabulary) are transformed into a smaller vector of size N, where N is the dimension of the embedding, by using a matrix multiplication (the same matrix parameters are used for all the inputs).
  • In the second stage, the results of the first stage are added together to form a vector of size N, and then passed through another matrix multiplication into V output nodes, the contents of which are sent through a softmax layer to generate the classification probabilities.

This network is trained using all the sentences in the corpus, with each word in a sentence taking turns as the target word. Note that this is an example of Self-Supervised Learning, since the labels are generated automatically using the input dataset itself. Once the network is fully trained, the first stage of the network serves as the transform to generate an embedding.

In [5]:
#Skip-Gram
nb_setup.images_hconcat(["DL_images/rnn49.png"], width=1000)
Out[5]:

The operation of the Skip-Gram network, shown in Figure Skip-Gram, is some ways the inverse of the CBOW network. As we saw earlier, CBOW tries to predict a target word by making use of the context provided by the surrounding words. On the other hand, given a sentence, Skip-Gram tries to predict the surrounding words with the target word now serving as an input into the network. This is illustrated in the figure using the sentence "The dog chased the cat": The word "dog" is input into the Skip-Gram network while the words "cat" and "chased" serve as target labels for training the network. Note that this is an example of multi-label classification since the network is being used to do multiple classifications based on a single input. The network itself is a simple Dense Feedforward network with a single Hidden Layer and two transform stages, just as for the CBOW network. The transform carried out in the first stage serves as the Embedding Matrix, while the second stage transform is used to generate the Logit Values for classification.

In [7]:
#rnn51
nb_setup.images_hconcat(["DL_images/rnn51.png"], width=600)
Out[7]:

In general words that are semantically close to each other tend to cluster together in the embedded space as shown in FIgure rnn51. As an example, consider the following vector operation which makes use of Word Embeddings (vec('x') stands for the Word Embedding representation for the word 'x'):

$$ vec('Paris') - vec('France') = vec('Rome') - vec('Italy') $$

Hence Word Embeddings incorporate the meaning of word into their representations, which gives better results when these vectors used in various operations involving words and language.

It should also be noted that instead of encoding words, we could encode at the character level instead. The benefit of doing this is that the number of characters in a dataset are limited to a few hundred at most, while the number of words can easily number in the tens of thousands. The tradeoff is that there is less semantic structure at the character level so that model performance may not be optimun). Hence 1 of K encoding is almost always the default choice for character level embedding.

Text Classification

In [79]:
#rnn73
nb_setup.images_hconcat(["DL_images/rnn73.png"], width=800)
Out[79]:

Text Classification is an important applications of NLP. Here is a list of ways in which it can be used:

  • Detecting spam emails
  • Sentiment Analysis: For example classifying investor sentiment (Buy or Sell) based on classification of news articles or tweets
  • Classifying the topic of an article based on its text
  • Classifying the language for an article
  • Classifying the author of an article

The chapter on RNNs contains several examples of techniques for doing text classification, some of which are shown in Figure rnn73. Part (a) of this figure shows the most straightforward way for doing text classification, while (c) (c) show more complex networks which can improve the accuracy, either by incorporating multiple layers as in (b) or a bi-directional architecture as in (c). The latter two network types can also be combined easily with Keras into a multi-layer bi-directional RNN.

In [82]:
#rnn74
nb_setup.images_hconcat(["DL_images/rnn74.png"], width=600)
Out[82]:

Figure rnn74 shows an example of multi-label text classification using a multi-headed RNN. Note that we are trying to classify into just two categories for each class, i.e., present or not-present, hence we use Binary Cross Entropy Loss function for each. These are then aggregated across all the categories to obtain the final Loss Function as shown in the figure.

The following example, taken from Chollet Section 7.1.3, shows an application of multi-label classification applied to tweet inputs to predicting the following about the tweeter:

  1. Age: This is predicted using Mean Square Error based regression, hence the MSE Loss Function
  2. Income: This is classified into a number of discrete categories, hence uses the Categorical Cross Entrop Loss Function
  3. Gender: Since there are only 2 categories, we use the Binary Cross Entropy Loss Function
In [91]:
#rnn75
nb_setup.images_hconcat(["DL_images/rnn75.png"], width=800)
Out[91]:

In order to code the multi-headed model, we use the Keras Functional API. Each of the three prediction types gets its own Logit Layer. Note that since the Age prediction is being done using Regression, only a single node is needed for its Logit.

In [2]:
from keras import layers
from keras import Input
from keras.models import Model

vocabulary_size = 50000
num_income_groups = 10
posts_input = Input(shape=(None,), dtype='int32', name='posts')
embedded_posts = layers.Embedding(256, vocabulary_size)(posts_input)

x = layers.SimpleRNN(32)(embedded_posts)
x = layers.Dense(128, activation='relu')(x)

age_prediction = layers.Dense(1, name='age')(x)
income_prediction = layers.Dense(num_income_groups, activation='softmax', name='income')(x)
gender_prediction = layers.Dense(1, activation='sigmoid', name='gender')(x)

model = Model(posts_input, [age_prediction, income_prediction, gender_prediction])

Even though each output type gets its own loss function, all three of them need to be combined together into a singe scalar value in order to do Gradient Descent optimization. This can be done during model compilation as shown below. Since the three Loss Functions can differ in values by quite a bit, it is recommended that their values be appropriately weighted, which can be done using the loss_weights field. The MSE Loss Function assumes values around 3-5 while the Binary Cross Entropy Loss Function assumes values which are can be less than 1, which justifies the weights shown in the example.

In [89]:
model.compile(optimizer='rmsprop',
            loss={'age': 'mse',
                  'income': 'categorical_crossentropy',
                  'gender': 'binary_crossentropy'},
            loss_weights={'age': 0.25,
                          'income': 1.,
                          'gender': 10.})

Assuming that model input posts and the outputs age_targets, income targets and gender_targets are already in the form of Numpy arrays, they can be passed on to the fit command as shown.

In [ ]:
model.fit(posts, {'age': age_targets,
                  'income': income_targets,
                  'gender': gender_targets},
          epochs=10, batch_size=64)

In the following example we use an LSTM model to classify the movie reviews in the IMDB dataset. We start by invoking the text_dataset_from_directory function to create the training, validation and test samples.

In [3]:
import os, pathlib, shutil, random
from tensorflow import keras
batch_size = 32
base_dir = '/Users/subirvarma/handson-ml/datasets/aclImdb'

train_ds = keras.utils.text_dataset_from_directory(
    "/Users/subirvarma/handson-ml/datasets/aclImdb/train", batch_size=batch_size
)
val_ds = keras.utils.text_dataset_from_directory(
    "/Users/subirvarma/handson-ml/datasets/aclImdb/val", batch_size=batch_size
)
test_ds = keras.utils.text_dataset_from_directory(
    "/Users/subirvarma/handson-ml/datasets/aclImdb/test", batch_size=batch_size
)
text_only_train_ds = train_ds.map(lambda x, y: x)     
Found 20000 files belonging to 2 classes.
Found 5000 files belonging to 2 classes.
Found 25000 files belonging to 2 classes.

The TextVectorization in invoked to convert the text into integers, for each sample review. Each review is restricted to 600 characters or less, and the vocabulary used is restricted to the 20,000 most frequently ocurring words.

In [14]:
from tensorflow.keras import layers

max_length = 600
max_tokens = 20000
text_vectorization = layers.TextVectorization(
    max_tokens=max_tokens,
    output_mode="int",
    output_sequence_length=max_length,
)
text_vectorization.adapt(text_only_train_ds)

int_train_ds = train_ds.map(lambda x, y: (text_vectorization(x), y))
int_val_ds = val_ds.map(lambda x, y: (text_vectorization(x), y))
int_test_ds = test_ds.map(lambda x, y: (text_vectorization(x), y))

The main model is a single layer LSTM with 32 nodes per cell.

In [15]:
vocab_size = 20000
embed_dim = 32

inputs = keras.Input(shape=(None,), dtype="int64")
x = layers.Embedding(vocab_size, embed_dim)(inputs)

x = layers.LSTM(32)(x)
outputs = layers.Dense(1, activation='sigmoid')(x)
model = keras.Model(inputs, outputs)
model.compile(optimizer="rmsprop",
              loss="binary_crossentropy",
              metrics=["accuracy"])
model.summary()
Model: "model_6"
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
input_6 (InputLayer)         [(None, None)]            0         
_________________________________________________________________
embedding_6 (Embedding)      (None, None, 32)          640000    
_________________________________________________________________
lstm_5 (LSTM)                (None, 32)                8320      
_________________________________________________________________
dense_6 (Dense)              (None, 1)                 33        
=================================================================
Total params: 648,353
Trainable params: 648,353
Non-trainable params: 0
_________________________________________________________________
In [16]:
history = model.fit(int_train_ds, validation_data=int_val_ds, epochs=15)
Epoch 1/15
625/625 [==============================] - 143s 224ms/step - loss: 0.6935 - accuracy: 0.4949 - val_loss: 0.6932 - val_accuracy: 0.5000
Epoch 2/15
625/625 [==============================] - 133s 212ms/step - loss: 0.6922 - accuracy: 0.5025 - val_loss: 0.6875 - val_accuracy: 0.5124
Epoch 3/15
625/625 [==============================] - 134s 215ms/step - loss: 0.6851 - accuracy: 0.5102 - val_loss: 0.6977 - val_accuracy: 0.5084
Epoch 4/15
625/625 [==============================] - 134s 215ms/step - loss: 0.6817 - accuracy: 0.5163 - val_loss: 0.6873 - val_accuracy: 0.5086
Epoch 5/15
625/625 [==============================] - 133s 213ms/step - loss: 0.6706 - accuracy: 0.5787 - val_loss: 0.6773 - val_accuracy: 0.6232
Epoch 6/15
625/625 [==============================] - 133s 213ms/step - loss: 0.6098 - accuracy: 0.6816 - val_loss: 0.6522 - val_accuracy: 0.6336
Epoch 7/15
625/625 [==============================] - 133s 212ms/step - loss: 0.5918 - accuracy: 0.7066 - val_loss: 0.5835 - val_accuracy: 0.7388
Epoch 8/15
625/625 [==============================] - 133s 213ms/step - loss: 0.5767 - accuracy: 0.7246 - val_loss: 0.6021 - val_accuracy: 0.7166
Epoch 9/15
625/625 [==============================] - 134s 215ms/step - loss: 0.5742 - accuracy: 0.7232 - val_loss: 0.5960 - val_accuracy: 0.7408
Epoch 10/15
625/625 [==============================] - 138s 221ms/step - loss: 0.5820 - accuracy: 0.7329 - val_loss: 0.5793 - val_accuracy: 0.7436
Epoch 11/15
625/625 [==============================] - 138s 220ms/step - loss: 0.6003 - accuracy: 0.6848 - val_loss: 0.7171 - val_accuracy: 0.5056
Epoch 12/15
625/625 [==============================] - 137s 220ms/step - loss: 0.5919 - accuracy: 0.6920 - val_loss: 0.5772 - val_accuracy: 0.7496
Epoch 13/15
625/625 [==============================] - 138s 221ms/step - loss: 0.5871 - accuracy: 0.7046 - val_loss: 0.6061 - val_accuracy: 0.7044
Epoch 14/15
625/625 [==============================] - 138s 220ms/step - loss: 0.5708 - accuracy: 0.7199 - val_loss: 0.6384 - val_accuracy: 0.6780
Epoch 15/15
625/625 [==============================] - 138s 220ms/step - loss: 0.5928 - accuracy: 0.7007 - val_loss: 0.5868 - val_accuracy: 0.7408

Language Models

Language Modeling is a fundamental task in NLP. It enables the NLP model to learn the underlying statistical structure of a language, which then enables it to generate valid sentences that are gramatically correct and are likely to have been spoken in that language. Language generation based on Language Models is very powerful tool that has been put to use in a number of commercially important applications such as Machine Translation, Speech Transcription etc.

There are two equivalent definitions of a Language Model that we find in the literature:

  1. Given a sequence of words $(w_1,...,w_N)$, a Language Model can be used to generate the most probable next word $w_{N+1}$ in the sequence.
  2. Given a sequence of words $(w_1,...,w_N)$, a Language Model can be used to compute the probability $p(w_1,...,w_N)$ of that sequence occuring in the language (see Figure rnn52).
In [8]:
#rnn52
nb_setup.images_hconcat(["DL_images/rnn52.png"], width=600)
Out[8]:

Figure rnn53 shows an application of the first definition of Language Models that we see on an everyday basis, i.e., search engines with the ability to automatically generate the next few words in the search term before they are typed. Another common application is the Auto Reply feature for emails.

In [9]:
#rnn53
nb_setup.images_hconcat(["DL_images/rnn53.png"], width=600)
Out[9]:

The second definition of a Language Model is fundamental to the task of language generation. As we will see shortly, given a context (such as an image or a sentence in another language), the Language Model can be used to predict the probability $p(w_1,...,w_N)$ of all possible words that follow from that context. This allows the system to choose a set of words $(w_1,...,w_N)$ that have the highest joint probability, thus resulting in a caption if the context was an image, or a translaton if the input was a sentence in another language.

In [93]:
#rnn76
nb_setup.images_hconcat(["DL_images/rnn76.png"], width=600)
Out[93]:

A Language Model of Type 1 using an RNN architecture is shown in Figure rnn76. As shown in the figure, this model is trained by using N consecutive words from the training corpus as input, with the $(N+1)^{rst}$ word serving as the target. This is an example of Self-Supervised Learning since the training labels are being automatically generated from the input data. Once the model is fully trained then it can be used to generate new text once it is initialized using the first $N$ words. An example Keras program for this type of model is included at the end of this section.

In order to come up with a model for Language Models of Type 2, consider the following:

Recall that the objective of Language Model 2 is to compute the probability $p(X_1,...,X_N)$ of a sequence of words $(X_1,...,X_N)$ from some language. Consider the RNN shown below in Figure Training: Its input is the sequence of words $(X_1,...,X_N)$ whose joint probability we are trying compute. Unlike the RNN in Figure rnn76, this RNN outputs a prediction for the next word after each RNN stage. As shown in the figure, we train this model by using the word $X_2$ as the label at the first stage, $X_3$ as the label for the second stage, all the way to $X_{N+1} = EoS$ (end of sentence token) as the label for the $N^{th}$ stage. In other words, at stage $n$ with input $X_n$, the model tries to predict the next word $X_{n+1}$ in the sequence.

As shown in Figure rnn54, once this model has been trained, it will output the prediction $p(Y_1|X_1)$ at the first stage, $p(Y_2|X_1,X_2)$ at the second stage, all the way to $p(Y_N|X_1,X_2,...X_N)$ at the $N^{th}$ stage. Note that each of these is a probability distribution over the entire dictionary of words that is being used for the model. In order to compute the the probability $p(X_1,X_2,...,X_N)$ for an input sequence, we use the Law of Conditional Probabilities to decompose it into the product of conditional probabilities:

$$ p(X_1,...,X_N) = p(X_1)p(X_2|X_1)p(X_3|X_1,X_2)...p(X_{N+1}|X_1,X_2,...,X_N) $$

This implies that the probability of a sentence can be computed by finding the conditional probabilities $p(X_i|X_1,...,X_{i-1}), i=2,...,N+1$. These probabilities can be computed using the trained RNN model described earlier as shown in Figure Inference. In particular

$$ p(X_2|X_1) = p(Y_1=X_2|X_1) p(X_3|X_1,X_2) = p(Y_2=X_3|X_1,X_2) ... p(X_{N+1}|X_1,...,X_N) = p(Y_N|=X_{N+1}|X_1,X_2,...,X_N) $$

Hence the probability $p(X_1,X_2,...,X_N)$ for any sequence of words can be readily computed by using this technique.

In [95]:
#Training
nb_setup.images_hconcat(["DL_images/rnn55.png"], width=600)
Out[95]:
In [94]:
#rnn54
nb_setup.images_hconcat(["DL_images/rnn54.png"], width=500)
Out[94]:
In [13]:
#Inference
nb_setup.images_hconcat(["DL_images/rnn56.png"], width=600)
Out[13]:

Not only can this procedure be used to compute the probability of the occurrence of a sentence, it can also be used to actually generate a sentence. This is done by reducing the problem of generating a sentence consisting of $N$ words to solving $N$ successive classification problems as shown in Figure rnn8. To generate a sequence, we seed it using the start of sequence token $X_1$, and then:

  • The second word $X_2$ is chosen by sampling from the distribution $P(Y_1|X_1)$
  • The third word $X_3$ is chosen by sampling from the distribution $P(Y_2|X_1,X_2)
  • etc.. until we generate the Eod of Sentence token

This type of recursive model, in which inputs to the model are chosen to be the outputs from the prior stage, is called an auto-regressive model. This ability of the Language Model to serve as a Generative Model, is fundamental to its use in tasks such as Machine Translation.

In [14]:
#rnn8
nb_setup.images_hconcat(["DL_images/rnn8.png"], width=600)
Out[14]:

Next Word Generation

In the language generation example in the previous section, we chose the next word by sampling from the conditional distribution $P(Y_i|X_1,X_2,...,X_i)$, which is an example of a Next Word Generation algorithm. However sampling this is just one example of Next Word Generation, and this section we survey other ways in which this can be done with better performance.

In [16]:
#rnn57
nb_setup.images_hconcat(["DL_images/rnn57.png"], width=1000)
Out[16]:

Four different Next Word Generation techniques are illustrated in Figure rnn57, we describe these next (these examples are taken from the blog post https://huggingface.co/blog/how-to-generate):

  • Greedy Search: The Greedy Search algorithm chooses the word with the highest probability as the next word. An example of this is shown in Part (a) of the figure. The word 'The' is used to seed the sentence, and this is followed by the word 'Nice' since it has the highest probability, and then 'woman', resulting in the sentence 'The Nice Woman'. Another example of a sentences generated by Greedy Search is shown at the bottom of the figure (with the phrase 'I enjoy walking with my cute dog' used as seed), and the reader will note that it suffers from the fact that it starts to repeat itself. Part of the reason why it does not work well is that it is not able to choose words that are deeper in the tree which have a high probability, for example the word 'has' at level 2 of the tree.

  • Beam Search: Beam Search tries to remedy Greedy Search by simultaneously generating $B$ sentences at the same time (where $B$ is a model parameter). In Stage 1, instead of choosing a single word as output, we choose the $B$ words whose output probabilities $(p_1^{1},...,p_1^{B})$ are the largest. Each one of these $B$ words is then fed as the input at the next step, resulting in a total $B^2$ candidate words at the end of the second stage. However this list is then pruned back to size $B$ by choosing the $B$ words for whom the product $p_1^{i}p_2^{j}$ is largest. These vectors are then fed as the input into the third step, and the process continues. Part (b) of the figure shows an example of this process for $N=2$:

    • At the first stage the sentences 'The nice' and 'The dog' are generated since these have the highest probabilities of 0.5 and 0.4 respectively.
    • At the second stage the sentences 'The nice woman' and 'The dog has' are generated, with joint probabilites of 0.50.4 = 0.2 and 0.40.9 = 0.36. Note that this algorithm has overcome the problem in Greedy Search by being able to make use of the high probability word 'has' at the second stage, thus resulting in a sentence with higher joint probability. In general Beam Search works better than Greedy Search, however in practice it still suffers from the repeating words problam, as shown in the example at the bottom of the figure.
  • Sampling: As the name implies, at each stage of the Language Model, we sample from the output distribution to generate the next word. In the example shown in Part (c) of the figure, the word 'car' is chosen at the first stage even though it has the lowest probability, since the choice is now entirely random. In practice this results in sentences that are bit weird, as shown in the example in the bottom of the figure.

  • Sampling with Softmax Temperature: The output of Sampling can be improved by modulating the probability distribution using a new parameter called Temperature. It changes the output probability distribution at each stage of the RNN to the following:

$$ P(b_i) = {{\exp({a_i\over T})}\over{\sum\exp({a_i\over T})}} $$

where ${a_i}$ is the model generated probability distribution and ${b_i}$ is the modified probability distribution with Temperature = T. Lowering the Temperature causes the peaks in the distribution to become more pronounced, while increasing it tends to move the distribution towards equal values. in our running exaple we choose to $T=0.7$, which results in the distribution shown in Part (d) of the figure with bigger peaks. Sampling from this distribution pretty much eliminates the word 'car' in the first stage and the makes the output more coherent, as shown in the examples in the bottom of the figure. Note that $T=0$ corresponds to using the Greedy Search method.

In [96]:
#rnn58
nb_setup.images_hconcat(["DL_images/rnn58.png"], width=1000)
Out[96]:

We end this section with the description of two other techniques that have been discovered in the last 2 years, which often work better:

  • Top-K Sampling: This is another technique in which the output probability distribution is modulated, followed by sampling. In this case the modulation is done by choosing the K words with the highest probability values, and then re-distributing the probabilities among these K words so that it normalizes to one. The example in Part (e) of Figure rnn58 shows the application of this algorithm for $K=6$. Note that this technique eliminates words that have low probability value, but which can still get selected if sampling is done over the entire vocabulary. Top-K sampling results in output that sound more human like compared to the other techniques, as shown in the example in the bottom of the figure. Top-K sampling has the following shortcoming: If the probability distribution is relatively flat, as in the LHS of the figure, it tends to eliminate many words that are promising candidates. On the other hand if the probability distribution is peaked, as in the RHS of the figure, it tends to include too many low probability words.

  • Top-p Sampling: This technique corrects for the shortcoming of the Top-K sampling by restricting the sampling to the subset of words whose aggregate probability is $p$ or less. This set of words expands if the distribution is flat and contracts if the distribution is peaked, thus correcting the problem. The sentences synthesized by using this technique are further improved as the example shows.

It is also possible to combine the Top-p and Top-K sampling methods together.

Example of a Character based Language Model

The following example, taken from Chollet Section 8.1, is for a character based Language Model of Type 1.

We start by downloading the training dataset, which happens to be the a selection of works of Nietzsche, and converting it to lowercase. It consists of 600,893 lines of text.

In [4]:
import keras
import tensorflow
import numpy as np

path = tensorflow.keras.utils.get_file(
    'nietzsche.txt',
    origin='https://s3.amazonaws.com/text-datasets/nietzsche.txt')
text = open(path).read().lower()
print('Corpus length:', len(text))
Corpus length: 600893

The code below does the following:

  • The entire text is broken up into 60 character segments and stored in the list sentences, which results in a total of 200,278 segments. Furthermore for each segment, the $61^{rst}$ character serves as the training target and is stored in the list next_chars.

  • The unique characters in the test are extracted and stored in the sorted list chars and a dictionary mapping is created for mapping these characters to their integer index in chars.

  • We create and then populate the input tensor X and the target tensor y. The input tensor X has a 3-dimensional structure, consisting of len(sentences) (= 200,278) 2-D samples each of which is a matrix of size (maxlen, len(chars)) (= (60,57)). This matrix has a binary structure, with each row representing a single character and consisting of zeroes, except for a one at the integer index for that character in the dictionary mapping (see Figure rnn78).

In [100]:
#rnn78
nb_setup.images_hconcat(["DL_images/rnn78.png"], width=600)
Out[100]:
In [5]:
# Length of extracted character sequences
maxlen = 60

# We sample a new sequence every `step` characters
step = 3

# This holds our extracted sequences
sentences = []

# This holds the targets (the follow-up characters)
next_chars = []

for i in range(0, len(text) - maxlen, step):
    sentences.append(text[i: i + maxlen])
    next_chars.append(text[i + maxlen])
print('Number of sequences:', len(sentences))

# List of unique characters in the corpus
chars = sorted(list(set(text)))
print('Unique characters:', len(chars))
# Dictionary mapping unique characters to their index in `chars`
char_indices = dict((char, chars.index(char)) for char in chars)

# Next, one-hot encode the characters into binary arrays.
print('Vectorization...')
x = np.zeros((len(sentences), maxlen, len(chars)), dtype=np.bool)
y = np.zeros((len(sentences), len(chars)), dtype=np.bool)
for i, sentence in enumerate(sentences):
    for t, char in enumerate(sentence):
        x[i, t, char_indices[char]] = 1
    y[i, char_indices[next_chars[i]]] = 1
Number of sequences: 200278
Unique characters: 57
Vectorization...
In [98]:
#rnn77
nb_setup.images_hconcat(["DL_images/rnn77.png"], width=800)
Out[98]:

The model for the system is shown in Figure rnn77 and coded below. It is a straightforward LSTM model with a single layer consisting of 128 nodes.

In [8]:
from keras import layers

model = keras.models.Sequential()
model.add(layers.LSTM(128, input_shape=(maxlen, len(chars))))
model.add(layers.Dense(len(chars), activation='softmax'))

optimizer = tensorflow.keras.optimizers.RMSprop(learning_rate=0.01)
model.compile(loss='categorical_crossentropy', optimizer=optimizer)

The code block below implements the Sampling based Next Character generation algorithm, modulated by the parameter temperature.

In [9]:
def sample(preds, temperature=1.0):
    preds = np.asarray(preds).astype('float64')
    preds = np.log(preds) / temperature
    exp_preds = np.exp(preds)
    preds = exp_preds / np.sum(exp_preds)
    probas = np.random.multinomial(1, preds, 1)
    return np.argmax(probas)
In [24]:
import random
import sys

for epoch in range(1, 60):
    print('epoch', epoch)
    # Fit the model for 1 epoch on the available training data
    model.fit(x, y,
              batch_size=128,
              epochs=1)

    # Select a text seed at random
    start_index = random.randint(0, len(text) - maxlen - 1)
    generated_text = text[start_index: start_index + maxlen]
    print('--- Generating with seed: "' + generated_text + '"')

    for temperature in [0.2, 0.5, 1.0, 1.2]:
        print('------ temperature:', temperature)
        sys.stdout.write(generated_text)

        # We generate 400 characters
        for i in range(400):
            sampled = np.zeros((1, maxlen, len(chars)))
            for t, char in enumerate(generated_text):
                sampled[0, t, char_indices[char]] = 1.

            preds = model.predict(sampled, verbose=0)[0]
            next_index = sample(preds, temperature)
            next_char = chars[next_index]

            generated_text += next_char
            generated_text = generated_text[1:]

            sys.stdout.write(next_char)
            sys.stdout.flush()
        print()
epoch 1
Epoch 1/1
200278/200278 [==============================] - 246s 1ms/step - loss: 1.6429
--- Generating with seed: "has ruled over europe for eighteen centuries in order to mak"
------ temperature: 0.2
has ruled over europe for eighteen centuries in order to make is the more of the soul of the sense of the sense of the stronger to the sense of the sense of the starity and in the more of the sense and stronger of the same and who are in the sense of the soul and stronger to the soul is the sense there is not a many and subjuct of the soul is the soul is the subjuct of the same and there is the most concerned there is the sense of the presential and there 
------ temperature: 0.5
st concerned there is the sense of the presential and there is the proviness of the superites of peritivesation of any all the more of a desired of the speak his presences of a desigution as the good some literalitial and sacrifines and words and thereby to its feiled and more in the knowledge in the such in the supplicep is the
starity, in greatest to the stardations of the most for the propers and of general and every a sonding to the many are also the s
------ temperature: 1.0
nd of general and every a sonding to the many are also the soul
say a and dopet but than the weredy, trot
tradision,
cogented i welion life"" be dearound toment variate egois of
justicnt
in a we, allich, to a huthorours if euror
iust furted andsy
not, and follownd in persecationly
into about of gerlares; i tape foroundlem of chivered for thereforthing and it way dit, futter
of whoals and appeads bedocfanding and herele and to ouch been moral and it, can no
------ temperature: 1.2
edocfanding and herele and to ouch been moral and it, can nothing ethally scare times of
undomen of which anyther that leofung, have
worther, to w dil nigedly," without these in the
worrs" wha
 dees coniginatabily ditegrant produgion
is god ongenioned
eutoused
soriculard idelose: flowder; inmishantin also not
that elemon wegars able is heass--hor everythings experiint of the samt"ness, and judgenal.werhisonenes ofcenant all indistinespard
ildigg), of the o
epoch 2
Epoch 1/1
200278/200278 [==============================] - 236s 1ms/step - loss: 1.5506
--- Generating with seed: "beying and commanding, of keeping down and keeping at a
dist"
------ temperature: 0.2
beying and commanding, of keeping down and keeping at a
distimate and conscience of the such a condition of the such a scientific the such a scientific of the such the such a such a desire of the such a mode and the same and the such a condition of the such a present of the such a such the such the such the such a such a modent of the such the such a more and misunderstanity of the such a such a such the care the such the most conduct of the such a desires
------ temperature: 0.5
uch the care the such the most conduct of the such a desires and himself to present in the such its from one more of the called the put soul and scientific of him. which the mind with a deaticly and recortiverent of the spirit of the belief which the constitues and moral such the conflusion of the present of the right and prification and not himself the such existence of the future of the present in the stronge sticke and such called, and it is to the suff
------ temperature: 1.0
in the stronge sticke and such called, and it is to the suffer but, and, one
in its spilitismy esticmation
of implosionous from
goddlecenty but of view, and as lates that man from fattiblene, must concestionated he made opingment, 
eff ut all account in geasine! because long it, one
more know, achour
conduca, will intendenant cure, 
 have been cestificitiven to
sinkinity is to its find
about it culture lite of great possible, say for the explasion
on have

------ temperature: 1.2
lture lite of great possible, say for the explasion
on have
strongless, in ovictristing themselves a hendardes, pinasiemanty disposiently    crrextens
expiries opmoni as been still natures, and frouge in the
ectaces", with censuality. and platic.

in
even and immuntitism of all rather, and sense of which "racking suffering a or
padifes, in
calh theredf the wicces over who a strefacing
be art aricle only to generauld himself, hening ratimism the its serbord
epoch 3
Epoch 1/1
200278/200278 [==============================] - 231s 1ms/step - loss: 1.5026
--- Generating with seed: "er that the contest might seem sufficiently great to inspire"
------ temperature: 0.2
er that the contest might seem sufficiently great to inspire of the self-and the self-conscience of the self--the sense of the self-conscience of the self-acts of the sense of the self-conscience of the sense of the self-desire in the self-conscience of the same that is a man of the sense of the self-alling of the self-and some the self--the self-alling of a some the self-and the some the seems the constitute of the self-atterming of the self-atter of the 
------ temperature: 0.5
e constitute of the self-atterming of the self-atter of the will man before in the subject and is the fearon, man, and that the presenting the whole do the most a some is in the sought franster of even is religions in
the believe which the beforence of the ormany presentiment of the deides. this finer of the self-destrume the general interpres and mensed and
subject in the sense and inventive in the consisting thing the great desire of a constant of even i
------ temperature: 1.0
he consisting thing the great desire of a constant of even in empleusterly
to act of "expealed gree, and loott.. if the will defels unffilus, enjoy
insuitedment in "i artsly refining being exactsg and delight is him is duck and endurunterrhis
"give leness he always--but the most imint himself
actual muguets of the most from lorrurlical self-spirit insolemed referes its fouls. peesity dicatien fantule of estens from the implane; knows contlerd of crect-asti
------ temperature: 1.2
ule of estens from the implane; knows contlerd of crect-astime and is he to owrety like thceriun pochs to pare of
schoolby rislringlome e asporbarical?
entop, exiester whone unquine becomes franismiginingly--uippiness stritt somening
to yautis pribosoced, you longome thoughacable, one befinin such
hus jueteal
to lose digfaring" the 2", crinasing "splalilent
of
sickr-""morberly thinks himself will tening that
the beolobed metarn of
bil through the nepserion
epoch 4
Epoch 1/1
200278/200278 [==============================] - 229s 1ms/step - loss: 1.4731
--- Generating with seed: ". the noble soul accepts the
fact of his egoism without ques"
------ temperature: 0.2
. the noble soul accepts the
fact of his egoism without question of the any an antimace the self for the philosophers and in the performed the special strong and a demands as a suster the expression of the expression of the expression and a present the expression of the faculty in the fathal influently and a man and the philosophers the fact of the sense of the present its spirit of the faculty and all the self an an an an an and a man and soul the faculty
------ temperature: 0.5
d all the self an an an an an and a man and soul the faculty seems a the philosophers at the convirtable and a such a manifests the feeling the say and accept
the hand the explander in the way really with the new and with the world, the men a consequently the really any reason the estimate and a man and this guld of a
demansist of a believes, as a strong, and world in the expression of a hearn the self even the means of a for a delightsing the self read as
------ temperature: 1.0
 self even the means of a for a delightsing the self read as
sed be standays hideed howolounce, a pred onounderind she call of those sinbs the gold in has we has
it heaven attaintys of
sucpenistion with for a become perfucedly, its thinkern
opinions to the ought petulately distrus of extravage., and sist because greaks sound to the own fact of the rick
of such to fir notrear and the decure
claim--it see
mmore skeptrisly be as long pessing of morblish capac
------ temperature: 1.2
it see
mmore skeptrisly be as long pessing of morblish capacitybly growescess, attain and
not to hear fline, sha the a realnens
in socabled phrater
for diseoten vicity and unknows aene youngermatere un fail virty or configice goodly, inlytinests barrian
a
tetter but taste one which though equal wead
the her not cearon so for disnullit
in pasimr purit
on the ineaine in dtead caincuss, not.lypes weit inamacilany, that no "namely.

capitie, a wod
brother prev
epoch 5
Epoch 1/1
200278/200278 [==============================] - 237s 1ms/step - loss: 1.4522
--- Generating with seed: "h great surprise, intimated to me that
there is something bo"
------ temperature: 0.2
h great surprise, intimated to me that
there is something both and the present and the precisely the self-conceiver the same that the spirit and the sense and self-contempt of the same that the self-conceivent and the spirit and the sense and the same time and the present mankind of the self-soul and the present that the senses of the present of the strength of the self-conceivent of the present mankind and the same to the sense of the present in the same 
------ temperature: 0.5
ankind and the same to the sense of the present in the same treat precisely to lister revelle and spirits, with the distret and the predect which attain a something himself and present the sortion; it is deligion that the same to their self-conceivent to satisfaction of the more will be been according to life of the self-detance with instinct the scientification of the say an appresent and that the ancient say it more present the painian and does a terd to
------ temperature: 1.0
e ancient say it more present the painian and does a terd to ma flitely the
storme sinimation of interligidated concite as spirct
evalistsy-count it states some at the time mens
and to frie is pleasure
readoroble and foth the porcch-2thereforacafia values: with change" in a different may be confict as to be that to europeans" them are they good or perhaps "musies, does but him appai., of
the
cansport head that that that is easage, the cears but the certyio
------ temperature: 1.2
ort head that that that is easage, the cears but the certyion enjoyent in inspiif to who day art which
fortidatir dangerous dedender.

xorates himself ectrice lives
swagnerable superpility they truth-abictible, may pateinfs fortine of
timesi
tunt, and sucheth coat verbable warihrrong, its ordative mind to anly for at prepertidem. on which according pur-hight
to function distratis a psylinieus; to evisal; learnt that some any, egoishd. there all tay testest
epoch 6
Epoch 1/1
200278/200278 [==============================] - 237s 1ms/step - loss: 1.4366
--- Generating with seed: "my breast," says an old scandinavian saga: it is thus rightl"
------ temperature: 0.2
my breast," says an old scandinavian saga: it is thus rightly the sense in the senses the spirit and the senses and a superficial such a probably the sense of the sense of the souls--the same the spirit and such a soul with the sense of the sense of the same the senses the spirit to be and the problem and the sense and at the spirit and a such a souls and a such a soulss and the spirit and the senses and the sense of the sense of the spirit in the same to 
------ temperature: 0.5
ses and the sense of the sense of the spirit in the same to encounter, in the fear the world to parts of the disposition to be again. and we desire the same such the same his belief in the taste every reader which we are their such a morality to the free spirits find to because he there is no ne to a such a desired and then confererous to be as the desires and that the does not at the any would not does not instincts and power in the such a "knowled in the
------ temperature: 1.0
t does not instincts and power in the such a "knowled in the
dleavy great the strong with violuen for pain by wantering
and in the states, flarcy, gok! grows certain seemed that is nending are sourchates (so not dignt significances, in certain with, and.ly; the always," accordanes-personal proquision in the schapacihhs to be tory they can may takes, who no deccline. it would sens to the soulss! in the facroventating and again-itys ane works
are as a get it
------ temperature: 1.2
 the facroventating and again-itys ane works
are as a get it
is,
great the cu-"unceptnustsly grel, he very express," and
placter--of as or beauejest with
minds (agains, one so se.. care of his searreabution os
objection, will

"donewine of rugrsching, and of the
superficial bor
threatening deep was, inspioude afflonbter origins, in a "metaphysical
caincule, which of mogan, even to high--are same there. but therever mirrow, to confectlese alal"? chnomoure o
epoch 7
Epoch 1/1
200278/200278 [==============================] - 227s 1ms/step - loss: 1.4232
--- Generating with seed: "which the vulgar antagonism to everything privileged and
aut"
------ temperature: 0.2
which the vulgar antagonism to everything privileged and
auther to the spirit to the fellow and the contrary and the spirit and the precisely the continue of the subtlity of the contrary the most disposition of the action of the free does a state of the man in the contradication of the fear of the great and and the contrary and contradication of the antither of the great the and the acts of the continue of the free does the spirit and former and the and th
------ temperature: 0.5
ntinue of the free does the spirit and former and the and the religion, and all emotional for much has been man has so is a grand as the fact of disposed to condition of self-religions of the formerly and in the consider that the distingums, which in a scholars and continue of the antither of the them the religions of the present-above in the sense the domanism in a christian to the noble in the moot of a spiritual to so philosophers and that so in the phi
------ temperature: 1.0
oot of a spiritual to so philosophers and that so in the philosophy by this was regard to injurion itrelserations woman-indeed oned with a new, in which the notle, but the history which the bellen: he is not unfersorable, the most historia
puoration, as one modes" upon a too, in modernt of aprever, oner-neverward all a dangers whether it is everythatered by them craviness of experience and senses bove, a supererimat course "new
origin as responsible opinio
------ temperature: 1.2
bove, a supererimat course "new
origin as responsible opinion in its present gived let.y
commormupresure doebs.ppich to soples. probably old penation in the asout-which
the
early than cereute world fourdudity, indior
to, s reasoning as priced,
into "miriture and his
spoars condition a light, such encraine? so retomections, and
so gram, kind orikes
him, roy, an enlipors then matature" of the loom of
givered, the flater
1boured,
as undifferentary, that readi
epoch 8
Epoch 1/1
200278/200278 [==============================] - 228s 1ms/step - loss: 1.4121
--- Generating with seed: "he entire
system that extends even to the brain functions. t"
------ temperature: 0.2
he entire
system that extends even to the brain functions. the strong the conscience and desires and the souls and self-can all the strange and conscience of the spiritual distinguished the same that the present case as a conscience the sense of the world the strong the world the delulty to the deeper the same the spiritual distinguished the does not be all the present in the conscience in the world and desires and the present case of the conscience and al
------ temperature: 0.5
ld and desires and the present case of the conscience and all the
instrumes of the platoin, and we distingly call the deception, also it is a world at the best and destruction to the happenest himself of the world and the other which all the expectuble with an insignificance of the father man is not a form of every doing the most self-caust the
interestic and instinct of every death the individual former that the paratfully and obstblong time to as a churc
------ temperature: 1.0
 former that the paratfully and obstblong time to as a church: all regard the flowey if
resilt does it i the such a the
human which is a hobelies that the
helled of freedom in spiritual sig, ethips of the pare the irmi
quality and suff of the
experiences envientual  ow
verdent. let us a perhaps in bickerr here anew
education of the blind, is thought thus
stands opinions of camp" to the world, and good, blood of the ly heacvate even of
cleare
attearde--to s
------ temperature: 1.2
good, blood of the ly heacvate even of
cleare
attearde--to soumhed is if theem them old assume
ivervenes hand from deceedes it may
condition of onlyy be mid auraw onded and re"stic
if 
smiys transman has naturax, le, and lirot
to be gold what he apteol chis: who allowed, romantidessmf
gelsc-being, rock to yest truth; then have dangerous: not actuous
sakes of sufficiers, andijust reveples, groodgorn; and 
sympathy whens the alsy of ut. they pening his
cheas
epoch 9
Epoch 1/1
200278/200278 [==============================] - 228s 1ms/step - loss: 1.4031
--- Generating with seed: "lung away its privileges with sublime disgust and sacrificed"
------ temperature: 0.2
lung away its privileges with sublime disgust and sacrificed the man in the spirit to the problem of the conduce to the spirit of the man for the conduct to the words and the power of the conduce to the words of the conduce to the convers and the and something the and the the conduce to the promps and conduce to the same to the best and who are strong to the such a man condement the the the spirit to the sense of the spirit is the false and that the proble
------ temperature: 0.5
 to the sense of the spirit is the false and that the problem and cannot for the deal one may between the "good that a convers and civilical one to be it such a was a century and always the conclusion of the great to that the latter and man and science and such an an antiquest of the strong and also and in the any
conditions and well all an individual and hards the dreams and conduct to a the fundamentally to the dult of the fell as if it is not the word t
------ temperature: 1.0
amentally to the dult of the fell as if it is not the word thing when it is nobleg, langue and len above the very only "may may wonews he "mastery and will men convedie and matter any once
like in one--as a race of to
itsic certai, to
owines for property. the are to all idea histous selfist and themapations a philosophic beradised, grow thereby an attelmres.

getieted, a tanciles.
the shaminomous teacher potenunent to o-deduced to one's
apparimities.


13

------ temperature: 1.2
teacher potenunent to o-deduced to one's
apparimities.


13

=fertry, with the eevolt says bring might
precisely, being fich with dorman--of definitive esseny to 
philosopher
presence, coloury have fort 2s profesrainly feoron of conscience for very cravomping primpted by a generality these unformy
                        he again into ran.


conount ideafed wish such "specials
our scaealing, sende man.

12

verenty, as our "premechogations (wher terems for
epoch 10
Epoch 1/1
200278/200278 [==============================] - 230s 1ms/step - loss: 1.3945
--- Generating with seed: " with which i ventured to baptize them, i have already
expre"
------ temperature: 0.2
 with which i ventured to baptize them, i have already
expression of the man in the conscience of the most christian and the really and period of the sense of the same to the reason the most personal and the sense of the sense of the conscience of the sense of the such and the world the promises of the fell the sense of the self-contemptions of the self-contemption of the most sense of the sense of the man in the feeling of the most conscience of the self-
------ temperature: 0.5
f the man in the feeling of the most conscience of the self-contemptioned in man one has a promises and the subliments of the characterisess, and at the very thinker of the nemily
individual of the truth as the fear the influence of the first expecial instinct of the philosopher and distinguisely man to be free spirit of christian to him that in such as the christian sensition there is
not morality in the present with the fact and the truth the cheast and 
------ temperature: 1.0
y in the present with the fact and the truth the cheast and learn time as muthobe action with the content philosophers of
by art all that that forcely action different instincts have not "moment and considianion for units find
too "unemoration is looked form of ?ffer if that who yet confiniding toare in body and an an intenton decisive without we men
of the conclude; and in tyrannice to remaints of voluntary and patism. the promise the ech like triwlis, no
------ temperature: 1.2
f voluntary and patism. the promise the ech like triwlis, nob lide"--it is old german typigurod val": mudapparion that
is ptications
namely). insthacism exprimter--a disysley place simply oround to mistake master nature is is for physion has fina that religion tonedly
bad andique of physive. he rither sympathlorion is attraffeful
home just
riment of sended iversition allea human that, they
can ackeniess, according, it act divine and volupilually
degulerent
epoch 11
Epoch 1/1
200278/200278 [==============================] - 228s 1ms/step - loss: 1.3858
--- Generating with seed: " attempted our life, for the
fact that we still live consist"
------ temperature: 0.2
 attempted our life, for the
fact that we still live consistence that the sense of the spirit of the sense of the interest and strength and religious the self-conscience of the spirit of the present and the fundamentally and the spirit of the spirit of the world the self-contradical and strife in the sense of the sense of the self-conscience and the condition of the spirit of the sense of the world in the sense of the sense of the every sense of the self t
------ temperature: 0.5
d in the sense of the sense of the every sense of the self that it is self-the their world every the opinions of the more something of religious and paining that every world self-greatest the virtues upon this and the actions.


13u
in such a reart and special only rule and child is as the sense, and live it is not the conditions as the man with one to the man and singerance and greatest sense of pation as we greatest and still to the acts for the mode as 
------ temperature: 1.0
pation as we greatest and still to the acts for the mode as lettlus exercimelogarious and with him
toonalist itself muture thinking partfulness, and in, in their place and
really foredow-evilizes probigation, and auggerbeld, the really for a manher
to great bar; it new, to homier
ruffience of
every human senses which hard. religious seeks the chample
werity, pensire which depresses: theses love suwday--was waltival with as some to the live, one mighth of o
------ temperature: 1.2
wday--was waltival with as some to the live, one mighth of ourn things (out of resolution: animar noo mankind and giving him war-will accoupte trult"--a rath and alt has spuchly su more man,
reveasing harrec.


11hinicats espomhind familially not
repuctives that
os
givent, herefulal; which has the certaist, or
graget allow theigur, boveed enx(pfety standoutly might from atyetik a trutility-some but fuile of
dangerist pleasures and threate, in bodulants
a t
epoch 12
Epoch 1/1
200278/200278 [==============================] - 228s 1ms/step - loss: 1.3794
--- Generating with seed: "free spirits, to remain ill quite a while and then bit by bi"
------ temperature: 0.2
free spirits, to remain ill quite a while and then bit by bitter of the strong the strong the strengt of the soul the strong and promises of the strong the strong to the still a person of the strengt of the superiority of the strength of the strengt of the strength of the strengt and the still present and conscience of the state of the strength and the will be something which is the strength and all the strengt in the strengt is the state of the strong and
------ temperature: 0.5
ll the strengt in the strengt is the state of the strong and attempt of the some the hand it is not instinct of a person and allow the instinct to be self-some world with our before the result the wort, as i may be the whole how man still not in the strengte stellly still also the consequently do and super-act of his such a ported as the former and disciplice and accordandance, in the primary of the compresong accords the tends to the strong and moral begi
------ temperature: 1.0
he compresong accords the tends to the strong and moral begins of restruct for all, the finally in order to actorh, the parts, as mare que unitpinaters, now a
point and fater it of, whytheavy only esseem men
truth--bad, their romoralical might old as the concert--he perceiled, how can be constituse takesal religion and soulble and
show shows. very manwisit. it it is also samey, has
"wo germ dothement. they can my schople
distrusts may be intell alacher-wil
------ temperature: 1.2
ent. they can my schople
distrusts may be intell alacher-will wamy, decently pashion and morals it. if it were fyo arrange matters weaks movebran a suffering than found extent genium is by their word to shurlarial
religion.. at the promose on the eated, whatneries, it
preceptios, the fact towards the spsedable neordow cannot tradilities
gradues. in eyeingtible were de stis do
of cisedle, our firstizational strove some littiratist corest,
was rouming betuti
epoch 13
Epoch 1/1
200278/200278 [==============================] - 229s 1ms/step - loss: 1.3734
--- Generating with seed: "tion. from this state of things arises the danger
that, thro"
------ temperature: 0.2
tion. from this state of things arises the danger
that, through the spirit of the spirit of the problem and the conditional and the spirit and the speciality and all the spirit of the spirit of the facts of the scientific and an anti-condition of the spirit of the conscience of the desire to be and the more and sense of the spirit of the spirit of the promised and the life, and who are in the present more and the problem of the problem and as the conscienc
------ temperature: 0.5
ent more and the problem of the problem and as the conscience and there are acts of as acts. and because of the way the depth and responsible, and believes are as the sense of the
philosopher of the germans in the spirit in the philosopher who one would have to make always novelous and concealed and the domal and a man, there is because of the timately because there are about the predeces to make them he is a desirable and conception, a spain of an antique
------ temperature: 1.0
them he is a desirable and conception, a spain of an antiquence, and for what do say, a cheral, encauso.

1dy
certain--kne race of
pering loves, can would be
who are cannot
am shakes in it, therefore just offlaced civents offart, so much shed, the sriving lived once trimbse
into donish them chappertness and unways" of mine an act
if
it is noth and than who we ar "higher. this has, and more individual almost that succiental consceed to thus, and with
men,
i
------ temperature: 1.2
ual almost that succiental consceed to thus, and with
men,
indaited i one's down in thing anyings can, another
thereby.grlaning-netives.
fyse
acts, can be begnd; and the gid,, byond. enthive a veriteds, themselves), as by i romagmity,, and who
are ppry furnsd; wamfur. bicklievly the worce of dangers this fran
from whom are
metaphystihfly an epoint puhsioned aut opportestly, only pasunes, what extent for the powers of holucch--the must for recepidel: reg of
epoch 14
Epoch 1/1
200278/200278 [==============================] - 229s 1ms/step - loss: 1.3681
--- Generating with seed: "the "spirit,"
especially the "historical spirit," profits ev"
------ temperature: 0.2
the "spirit,"
especially the "historical spirit," profits everything of the same the conscience of the soul--and all the soul--and be an interesting the religious than the spirit of the soul--and all the soul--and which is an attens of the soul--and in the soul of the present into the emotions of the feeling of the present interesting the evil and the soul--and in the soul--and when the words of the soul--and all the better and soul-interminated to the sou
------ temperature: 0.5
he soul--and all the better and soul-interminated to the soul--is in the entilent--as it is the strength of the predicative become from their alling themselves in himself of such as in such a tradition to the conscience of one of the eccted even to religions of benever of the greater the instinct of the mind it has seeks of the soul--the
philosophers, there is a commands and the for its own being and discovered of the contentivers of the contempt and the m
------ temperature: 1.0
and discovered of the contentivers of the contempt and the myilest mutter, atable of all their
de of
man middureive methor, easier evolutav; aroundr what is the
religious from the werologist and prevuiorhyy of the virtues: he might he
back--corres words? in very unsul",
in the outse of the happiness: while soul impuls proved himself. they magoned in the
case of qjecure. it was never who persist to scomed when according as or on present of, the the sublimed
------ temperature: 1.2
 scomed when according as or on present of, the the sublimed, in formines, lackfur,
war, when he on advantage: let the rolnee! commen he and
disgersie, all the sciente" to strives, and breiry to speel enough correst, hod dows he estimatal and " presente
of a
just not brongs privile everything--but
though obritably any
ontwrates, which eoveligh.
syin beina
will be
i ganness, doneculagieptsown--artgoicty.
how amblingts, or diff
als she bunechtepbscea
realf
f
epoch 15
Epoch 1/1
200278/200278 [==============================] - 230s 1ms/step - loss: 1.3647
--- Generating with seed: "formations, which might otherwise remain
hidden from view. t"
------ temperature: 0.2
formations, which might otherwise remain
hidden from view. the sense of the present in the sense of the personal fored and the religions of the fact to the same type, and all the best and the reason to the belief in the explanation of the religions of the same type of the words of the sense of the same type, and the constandian to be an invent and the same type, and the same type of the same type of the profound serve, the philosophy has been the sense of 
------ temperature: 0.5
of the profound serve, the philosophy has been the sense of the truth, and such a power to everything in the highest condition the reason of yea, the present and the constand, the feeling he will the more cannot condition are not preference in all the most personal mistaken perceivice and spirit the fear the disciplice the german and the reserved for the
religious being the purpose, one will be deceived. the antithering the pure mankind, but are not always
------ temperature: 1.0
ceived. the antithering the pure mankind, but are not always or daing, in
the wertard sharinpf" is upricsrnation and lear man, many something his party--conseq
//anaconda/envs/miniconda3/lib/python3.6/site-packages/ipykernel_launcher.py:3: RuntimeWarning: divide by zero encountered in log
  This is separate from the ipykernel package so we can avoid doing imports until
uently
a
substing, even of his own can, the
type, that which deching germani, one, this generation the preyany
threate and
discreation hard, even of the man and estraction, it were cloursed at a scientiforoa
complain ualtable classiration often different higheousus exitually platouded: who wond aking
------ temperature: 1.2
ten different higheousus exitually platouded: who wond aking
man passible: for the colority: "one's being (cameall perceiviting esonlise towards included, cerniccl in  nome.--for bestlusion
relofty which that abileatities
goes, evolution of lific
spirod
disclint;--in by the detreatn, enjoyming his standacy of the osprifice wand habitual preduss."in in-ud"
very
huntung. in the three, as required uidey--perhass.
verituess foravy for by designaturable we per 
epoch 16
Epoch 1/1
200278/200278 [==============================] - 230s 1ms/step - loss: 1.3587
--- Generating with seed: "ity of language, owing to the common philosophy of grammar--"
------ temperature: 0.2
ity of language, owing to the common philosophy of grammar--it is the most sense of the profoundly to sense of the conscience of the spirit is a soul-cies of the same the stand and all the condition of the self a personal and still stronger the same the possible, as a consequence of the sentiment of the same the conscience of the condition of the same the conscience of the same the state of the self the consequence of the same the stronger the stands and f
------ temperature: 0.5
lf the consequence of the same the stronger the stands and father the stribens which is not be made itself is the very standard proposion of the world when the wors of morality of the same times of free justible of onequently and profound, with the disgerte of the states and man and schopenhauer's what soul, who he is such a metaphysic, even that in the god, and concentivation and consequence of the forers to heart of christianity. all the common in order 
------ temperature: 1.0
he forers to heart of christianity. all the common in order to carrydances with a grass educatings, if it says enpnenice, but when he and domertater--nemice easking to perverbling and hes" also the fened, when spellarian
decisive in morality must
makes no longer consequences? that itself is access of duthtous cirtucity, pleasure of absoly upon beether
perhaps" to war remander what distent
have not to cheches. and
be believe too have hest it is own estilnan
------ temperature: 1.2
 to cheches. and
be believe too have hest it is own estilnance."

2
tailed?


2tä
todraes leads make overthe,"
above an
mad
others, grow magit.
nyster truage and posits a leads intetim or an outboreation, hgow-it, as hindund, actions. but if art on pocious,
within germscribits
deve ungoiness
to special modens been
piged misterams shoether firrlgsias,--he
wound so there; even formation, and places to cecturste music"ulwals, or most his tream of itwle-grand,
epoch 17
Epoch 1/1
200278/200278 [==============================] - 227s 1ms/step - loss: 1.3561
--- Generating with seed: "and irritating to present-day taste
in the sternness of its "
------ temperature: 0.2
and irritating to present-day taste
in the sternness of its opposition of the present in any one is the conscience of the present in the expendent of the expendent of the spirit in the substrain of the fact of the spirit of the present in the strange of the present in the strange of the present, and thereby and all the spirits of the world and such an anciently and all the strained the conscience of the spirit in the strange of the self-contrary and the st
------ temperature: 0.5
of the spirit in the strange of the self-contrary and the strange in the strange and philosopher and an extreation of the orace of the really and thereby example, and the present more possible to still again the stupid, in our conscience of men and all things and far an extravagation," who destiny and still into the such a forms of the strained a consciences, and a distincted, and in the problems of tradition of his adventure and conscience of the voluntar
------ temperature: 1.0
of tradition of his adventure and conscience of the voluntaring
wred, according uisted upon
egoist is
an this knowledge that
does--to find another that element has menreps
and sleudlated seemsic
to soul of thhien immesmation.


24

)urran in hunaly the pheaso itself to soperhing. and stan, certainly his usety--course from
the fathinor, wish it; is thus propersl--needs his blood, its upon action
to believtics of man
a "man" will, res. the move. it is strice
------ temperature: 1.2
 believtics of man
a "man" will, res. the move. it is strice to all those bius and mankind: in. thus with
old as well.


2

3(doition to the polinat, a distinctiol, how midilied to discovered its ectress.
resest and when wast could this
odss, will
not
soughted--syminatedge othing is problele, rational is sooe is--as natures ainnrate for a nectors indaing as mudy and togessificien tcusion emotioncal early agat than holy enough--his instance fllle itch
over 
epoch 18
Epoch 1/1
200278/200278 [==============================] - 230s 1ms/step - loss: 1.3504
--- Generating with seed: "teenth century, like
saint-evremond, who reproached him for "
------ temperature: 0.2
teenth century, like
saint-evremond, who reproached him for the more and conscience of the conscience of the present one is a subtle of the strength and still and the ancient and conscience of the strength of the states of the morality of the still to the morality of the word in the strength of the ancient higher the subject the sense of the present in the spirit is a perspective and the proposing to the conduct to the spirit is a power to the word and the
------ temperature: 0.5
 to the conduct to the spirit is a power to the word and the unconduces of the even the whole solety of the reveried ready, in the conduct, and conscience to the ential a disguise and or and the science is because of the conduct of the german of the one instance, the historical discerning to the morality and general to still to the deceived the anti-suffer of the latter in himself, and all the advance to the best concest, the antithest of a propering again
------ temperature: 1.0
ance to the best concest, the antithest of a propering against mentines to subter the virtue dignant one's
soon, accounts
in the or more bodies."
ihelies about as how to be dispidulted allowed from certain homance, these plaight from the
order the good for these pleaseing it. in this doublils, and of subend. in he pleasure, and there afceif eng is some are
ages, where the who there: as the respact and flimiwismed truth of coscespours were the spirit,
and w
------ temperature: 1.2
 and flimiwismed truth of coscespours were the spirit,
and whice by schopenhauer's riund stage of an evorerng one that, and by aetined and, hatin thro nature, as for withing for seethylopilo" evide dey
disty degree
perspiqual
"histomance of man with unitilityed, as if it staking supersaii seecise bue by even some."
absen for heveld haccs" are
strongaged of freedoms,
like this its a, are a served oncilf" varies of copore to
perjusence begums an unsureage fo
epoch 19
Epoch 1/1
200278/200278 [==============================] - 248s 1ms/step - loss: 1.3464
--- Generating with seed: "ing and
taking easily; if she forgets her delicate aptitude "
------ temperature: 0.2
ing and
taking easily; if she forgets her delicate aptitude of the state of the consequently in the fact that the struggle of the spiritual present in the conduct, and all the state of the state of the spirituality and the words of the spiritual and conscience of the spiritual sense of the freedom, and the spiritual present of the spiritual strength of the spiritual consequently be sensually the spiritual man should be a present in the freedom, and when th
------ temperature: 0.5
piritual man should be a present in the freedom, and when they have the spirit is for in the free spirit, and has have to love the morality of the conscience of spiritual and new deals speciality and all alther may be again the
deathy are as a the noble men or which one of the case of a feeling to one, an accompan of the feelings, for the "free spiritunes "doy what is because of which a moral
suffer of the most metaphysical period of the most that is go th
------ temperature: 1.0
er of the most metaphysical period of the most that is go the whare.


thos
discontent prefen to wish in
its praises itself with ceversts we
developgee--and his most willing let imacy and diverness, they
absusted, which.

11 inis very are where
one for themselves with the developgations
believes the
communition and from as
well howing missups
is clearly be ematical and athe
power earth--proousment. it is "
sk.logicute? cheplies "know they solow is still it
------ temperature: 1.2
. it is "
sk.logicute? cheplies "know they solow is still it unknow.in jud:
that is made with riginess.
in
, wlicy be string to dod agair: a belong:
some scives, soitney the whillen duties which
the right to spet it is to brearinghge "ownme refresseks in syame--interest name up-needhy spirituality
believes a
certain "what has to sa;f hewitue, dritubling know
it was powher their would any afulser then ariny; of chrinaus egroble
rescragea,
uncertain, tender 
epoch 20
Epoch 1/1
200278/200278 [==============================] - 293s 1ms/step - loss: 1.3429
--- Generating with seed: " also only did what
philosophers are in the habit of doing--"
------ temperature: 0.2
 also only did what
philosophers are in the habit of doing--the sense of the self-self-self-self-some through the sense of a soul is the most something is a personal presence of the consequences, and the good one is the consequences, the most self-self-greates and saint is the propering the self-such any religion of the experience of the presence of the souls and spirit the good and delusions and the consequences, as the delusions of the commender and cons
------ temperature: 0.5
the consequences, as the delusions of the commender and conscience of a metaphysical morality but the german completely upon one from the most delusions of the spirit of the perceived, and same inventions of the consequently be the good soul the most greate the world being understand one in
the consequently does his power of the entire through the self-every and morality and does us as a consequently when he says and disposince of the fath of the heart rev
------ temperature: 1.0
tly when he says and disposince of the fath of the heart revoloted only with which he germans uncertain wordadation, his bomining contemplation is owretical case.

14t
wverneserffer of the helpinated and distree only
a allonged it
only wrattance, among nocke tollouse; if, in danger, among metians onel
good. the positive and self-triumphed has force all germanic as to whit have been daring xpowing to is, to li-miar of philosophical that the term of certain 
------ temperature: 1.2
to is, to li-miar of philosophical that the term of certain talse human
right disbrindednce to no religious
through himself or philosophys-is in any one" of a hoad
represent germany but gritpocious knowledge of all that we lighte forgetful and indascrobilus of tual oney of illot
conscience. any
ideat
and far induces to the futurental
systems, which so dopuhiars is systems,
inducts, ies of threateds. ickene and hoble of the it, lestunant
fearing and good ha
epoch 21
Epoch 1/1
200278/200278 [==============================] - 268s 1ms/step - loss: 1.3426
--- Generating with seed: "he fundamental opposites that have
brought mankind to make a"
------ temperature: 0.2
he fundamental opposites that have
brought mankind to make a states of the most and standard the spirit, and we have the word and an interpretation of the word of the word of the most from the problem of the spirit in the master of the word of the word and the fact has a standing of the spirit of the and the word of the problem of the way in the states of the spirit of the whole which is not one the spirit of the most constraint of the spirit of the word o
------ temperature: 0.5
he spirit of the most constraint of the spirit of the word of the present develop superstition and cause of the proor for the wor, the the
standard his faculty to the maintess of mankind of spect of every a sort of the most fact because of the most schopenhauerality and spirit, and an expedient and the problem of the habit of science and the ages--and motive the ends--in the fact the origin to the problem of regard to thing of many a person and spirit, and
------ temperature: 1.0
 problem of regard to thing of many a person and spirit, and compulsion, rual under asualiulss precisely just how and
which the mas these would sinkers itself individuals and more we at the volain you before or of the general
ridance and conceptions in its platorrality and falsehss of agairs of morality in miserpives problem en
spiceing of inspires of gratopoch is cision as the force the baster of life man in a perlirier its morals in moctro but originated
------ temperature: 1.2
 life man in a perlirier its morals in moctro but originated, the too, even aristoris
ibas and atditun and will when soets who, we its god has intolenel?" out this trikingity gavelo
osing speal for the
kiod, every insigntently; but uncertain still rejod of a ones, as froseow but
"precade before over human way orignty of woman "thus natures,



214. it
retry and
repeanimosing to to-ps
ghereed disfentimounds, that god. henis honot man "to un"qbi recormitatio
epoch 22
Epoch 1/1
200278/200278 [==============================] - 241s 1ms/step - loss: 1.3395
--- Generating with seed: "to the bible and experience,
wets not alone the unjust but, "
------ temperature: 0.2
to the bible and experience,
wets not alone the unjust but, and who are also the moral and disclines of the philosophy and will to be for the presence of the same stronger the moral and the struggle and the same typically and provent of the moral and conscied of the concerning the morality of the moral and conscied to make the provelt to the fact that the moral and the moral and the moral and the moral and the superiority of the struggle of the bad to be a
------ temperature: 0.5
moral and the superiority of the struggle of the bad to be an accordered to the dangerous right to and will to speak in a misunderstand the moralist as according to precisely a provent and science of philosophical of being and perhaps--and is the present in at the moral saint moral and gratitude to the sense of all the words--as a person of disclinss of all to be something in the bad taste, or as a patients and conscied has afford and an individual and god
------ temperature: 1.0
a patients and conscied has afford and an individual and godled edvalopilia) for a find en seriss and cronbordo by regal of which they undel act as
upon the moments of it. i corcesualy over shoulstoristons., a mainterseness of all, the coversoous bary and find must here makes accordance
in free jneed we their suffering that rracpiles is nature of axpeodateity, only be at too but in the ogviren laugh go keep intellectual mainterection, in our vaciations acc
------ temperature: 1.2
gh go keep intellectual mainterection, in our vaciations according to frimdom of there you wishes allochulst: were have modity of latt a pocutave ay ourselves dofan--and distrists
practices.-co inlections of ghilt the foreif the originalses him-indepentul for contriness-moralist of mudy to
feeling
exicting all it, als darning sour because essenceed ell" who is in the querting justices of ador-dulmy, to be consequences! and beee has erquideent, from appeaca
epoch 23
Epoch 1/1
200278/200278 [==============================] - 271s 1ms/step - loss: 1.3343
--- Generating with seed: "contained in an opinion, a condition, an emotion, a
disposit"
------ temperature: 0.2
contained in an opinion, a condition, an emotion, a
disposition of the struggures and commanded to the strugguble of the strugguble, and all the most conduced the strange of the subject is all the moral and stronger of the strangeness of the condition of the strength and the one is all the fact of the moral has a same struggment of the conduct, and all the condition of the strength of the general and man is the condition of the condition of the sense of th
------ temperature: 0.5
and man is the condition of the condition of the sense of the longing of the warg out of the one is best of any good one is the senses, as the moral age, and a
seem with the conduct of the most here--this be a refinebry and all the happiness--and all the strict and the truth and the life is a something of the strangeness. the struggule of the strang. in the reason and the formerly be great in the deatists, and alle's serious. and who make to the commands o
------ temperature: 1.0
deatists, and alle's serious. and who make to the commands of
hand many need of himself the at tet "facking it for belief in the appearans, as there is is, of the fathersites and let again" to time from man to say, and were as "musural morate air class, buto in our characteristion, alther--who leads of whom is alone. if in him would thoughts and path freedom of colored within hear: the incettire: the rate ordied
the moral perfect with the makes our instend
------ temperature: 1.2
the rate ordied
the moral perfect with the makes our instends with severiating ages felk (me the stear and there is true-decesiu, profound?" onwad--will be well tedemation, weal changesiering sently heart of frum off direct artifeding, sehicfities.--weven reaching of the partially neverelou ignets, and brotrule" to insup or
more for the wernessmules bestear
learns we selitxing rivelges of the same in german tupesherinitior, this opinions of its marthin to 
epoch 24
Epoch 1/1
200278/200278 [==============================] - 258s 1ms/step - loss: 1.3363
--- Generating with seed: "ue of which that aristocracy had abdicated step by step its
"
------ temperature: 0.2
ue of which that aristocracy had abdicated step by step its
also and the the best and the conscience of the present and the science, which the stronger the struggle and concealed to the spirit is the spirit is a stickle to the struggle and conscience of the best and the spirits and the spirits and the spirit in the basis of the struggle and in the science, and also account of the desires and the spirit in the present state of the constant predication of th
------ temperature: 0.5
pirit in the present state of the constant predication of the connection and has good at all the contrary to the means, the streed and presence and healthing of his purpoue of priviled
to an excession in many best honest subtle itself is a deceive the fear of the cause of the conceals the reverenty that the state one may be advanceter is an attain them to say to the breaks and general and conscience of something more senses, and a word of mankind of the pr
------ temperature: 1.0
ce of something more senses, and a word of mankind of the protectoustic of the spected. they adywherners an assire, for "daily maintens it is foo; the sand as the food contradictive
spfairts of litempt the disgerse grad of germany be go harhmen; as long imagination, an anturnes german senslel entoter, also the acyon
religions topore them
astraption. he fertuin and coumentre philosophoutions to say, short why, of this spheed, and becomes it becoming rese.gh
------ temperature: 1.2
, short why, of this spheed, and becomes it becoming rese.ghing
relative bloobpenser, as men, the lightopgretapjourd why unspirity, the distinct beabors it is never, is non".

nes?--namely kind it shorfors the lifted prorogr,"
in the adejuggomreds. they
indifficulity, by selicxacing dike down refude to wro?uns. however, the weak? to be capable coloore? among wlight midies to assmdise? disclass the
phenomena gaquitiuy in those all ideal.in men as a silen it
epoch 25
Epoch 1/1
200278/200278 [==============================] - 328s 2ms/step - loss: 1.3337
--- Generating with seed: " women--that the terrible
seriousness and clumsy importunity"
------ temperature: 0.2
 women--that the terrible
seriousness and clumsy importunity of the senses of the man among the best and soul of the soul of the strength and disconsiment of the thing in the soul of the soul of the spirituality of the sentiment of the free spirits of the other the spirituality of the spirituality of the spirituality of the same the says of the faculty and senses of the superiority of the soul of the world which is the world the present senses of the prese
------ temperature: 0.5
the world which is the world the present senses of the present hare destiny of the soul are the similar than it is to discreative world in the philosophically or of self the present them are of the way find these faith of the most little serviles of moral and unselfiction, in the acted the stand is the antifice for their stands of the soul of the action to a philosophanic and relation of the most the end, as to be sentiment in the way of attached, the sens
------ temperature: 1.0
the end, as to be sentiment in the way of attached, the senses, and does encourant bally of "old seems much its banting, and aming equally necessariness of saw love from
evilsiom, and comes than persinage," these instance.

ly sures is its whoak instahtive spiftaments of the occasions of present as hasy to cart the mone and cal
sees take, hald extent the immetaphysiple--it is a disciving customs is a victory, ands on germans in fatter in the being have phi
------ temperature: 1.2
s a victory, ands on germans in fatter in the being have philosophurer different," of the birth of luis.
murvening is no theory
ideases oly flownd
with
soins breny, is
with
intellogannly with a king of the demales when lives of turbing,
what ame
dribilitie word speakzin-nature is "philosophiyed
(pleonds the age
to the most little yet seeks
had will be the like its firstly metaphy mad desist thinks, will fest sympathy must, being with kind, socal bacbmetati
epoch 26
Epoch 1/1
200278/200278 [==============================] - 264s 1ms/step - loss: 1.3303
--- Generating with seed: "e thus and so, not to act thus and so. out of
the _esse_, th"
------ temperature: 0.2
e thus and so, not to act thus and so. out of
the _esse_, the sense of the sense of the sense of the sense of the sense of the sense of the present structive the sense of the christian and the sense of the sense of the sense of the sense of the spirits" of the sense of the spirit. the present strength of the sense of the sense of the christian and the will the spirits" is the same the sense of the sense of the freedom of the sense of the sense of the sense
------ temperature: 0.5
 sense of the freedom of the sense of the sense of the sense and the sense of the religion of the creators that which is the soul, which and what is the distracgure and the reason that the contempt to the explanation that it is a part of the german
spirit is the present and principles:--the longing to so akin not the fact of the and he is a deach.


01

=so a
passion of the most charm of a christianity is a more interpert and general self-ression of the so
------ temperature: 1.0
anity is a more interpert and general self-ression of the some spirit.ly in the
recoter" daring in they in one culture what in every evidence., it is curishtmulled what is a say things. i be perhaps
to lert which an inveliesel"--and also spirits"icj(mptandeeness en a sort
of the own respectups.=--"may flurce unin order to be nises, from up! ahever mediocied
artist with any
extravage of the spiritsay unsuver at
these at all"--into put horse than they me a p
------ temperature: 1.2
ay unsuver at
these at all"--into put horse than they me a philosopher
he determine of nogno, and man, or is he
will peopless freeise", and without which cannot
continue desigadies for him whateveer dois others of more highly that their has toing mobolist. we are "soldof in to gyivel to be sign of the
denieding, and stade ruthreaw, soit. the eurwaness to his kies into that been. the history itself for all bain it amodings the more
teach music.agends wenver
epoch 27
Epoch 1/1
200278/200278 [==============================] - 261s 1ms/step - loss: 1.3395
--- Generating with seed: "uence a
human being suddenly collapses. in india, the carpen"
------ temperature: 0.2
uence a
human being suddenly collapses. in india, the carpens of a more than the sense of the sense of the conscience of the strengther and all the sense of the states and the sense of the sense of the sense of the stranges" of the sense of the sense and desire to the strengther--the sense of the sense of the sensition and the states, and the most restres of the most masters and strangesed and the sense of the sense of the conscience of the stranges" into 
------ temperature: 0.5
 sense of the sense of the conscience of the stranges" into the interesting in the most defensition of the great onerment and praise, which let us as the present states and deteritation of the spirit is the most north the soul of the powerfulness of the states of the belief the mas in the subtle the person and struggle and allow one to him of the most invention, and allow and places bedon-spiritual such profound, and in the sense of the sense of the consci
------ temperature: 1.0
l such profound, and in the sense of the sense of the conscience, are, and not altoper rarech ready sprinbrantming the spirit
generally, have acquarate europe and with their mindsians of the emotional
little, are struggingless commentionable erroured, he souls also
"todar" what thether disgustualifity,
of the milach only
eyes, at then names the felfaritude of man is ready and doitm, and those instinct as that has certain for
certain phingling necessary, an
------ temperature: 1.2
inct as that has certain for
certain phingling necessary, anduge ineonenty" rejony. a limeration and
otherbqbluscy of time as everything towards wisdoas,--it
sing
amonne. how trould to break
a timgerous a remains, but superspord disrimating every great desist, who ansolvisnies andrange,
and learn and
tetry commencenstered of morality. too who seem and, had not alwoinder the humanity: ordatificates, that he one may findously, with to nedy glorled othersnine
epoch 28
Epoch 1/1
200278/200278 [==============================] - 248s 1ms/step - loss: 1.3281
--- Generating with seed: "consciousness of guilt")
in their train, there must, then, e"
------ temperature: 0.2
consciousness of guilt")
in their train, there must, then, even why has not as the present will to be an assertion of the commend, and a part of the power and all the condect and experience and the more something of the sense of the conditional present and instance and the sense of the position of the soul the consequence of the sense of the conscience and states the antiquently and the power and sense of the present some the world and all the same to the 
------ temperature: 0.5
sense of the present some the world and all the same to the all the compliye and the comparage, the community of plenty of the present more why says which an accordance and to this present sensity and necessary to mentered that does not be are something with the experience, are more sympathy to possess to be an exception of the world believe and appears it is to condect and that there are greatest conditional happiness, the state of religion of the germany
------ temperature: 1.0
 conditional happiness, the state of religion of the germany himself on the
character
against youtomitudity. in soul, all more was
somethin and the more takes many frat's
by manner.

1rines, how the liberntile for len wheal"--for its philotofulaven invarious nry kan;
by the also as to the hignedable anotho, among montomeity of "as purity, withif expense monmonder and gives man hand as, are be prooves be add regard is greatest
more in theses for the how com
------ temperature: 1.2
ves be add regard is greatest
more in theses for the how comxinated play upon that is but
lectioncs! it is not ao?--braves against virtue and love or graws, now of refalraciarm! by all life that we
bondure
seems wholingrwhiganigntenly roagliners wrol; hath in the questy a kinds to ntuate, eviliinly
devil, somewhere leads had were marks or passionsh. to ba ullow conduct far are avarbies of the
arting, even according, their ducing, wish actually
clonel: in w
epoch 29
Epoch 1/1
200278/200278 [==============================] - 268s 1ms/step - loss: 1.3275
--- Generating with seed: "t a basis; morality itself, however, has
been regarded as so"
------ temperature: 0.2
t a basis; morality itself, however, has
been regarded as so were and proper the destruction of the strength and the sense of the strong more conscience of the all the proper the conscience of the spirit is that the fact of the proper the words of the superior of the present in the struggle in the spirit and who are the struggle and the strength of the struggle and constantly and all the sympathy that which all the sympathy in the sense of the through the 
------ temperature: 0.5
that which all the sympathy in the sense of the through the attain consciences of the power the artists and any disindisted the troust and all the present, the nature the same in the very same soul the destruction of the spirit is the stands to will it was to read as once imponder that a person are he still a sense and a sense to be the refinefor of the superficial. the sympathy the condition of the sympathy of the acting as the science and delight of a re
------ temperature: 1.0
he sympathy of the acting as the science and delight of a religion up oft in the come the
invirioging thinks a future and habit a curromings--aporions: met ovired of course property
best of the almost heavy"" many, one in things, the lattaily taken, those herce which it was opposed themselves
and
seems to "perhaven, however, artasser.--not-her place himself all the borr gave any things of power, aets is regard lay? it be nature disfavo to "hiscolary, the r
------ temperature: 1.2
ets is regard lay? it be nature disfavo to "hiscolary, the rounding, free "swates in it" though the defoure of impake-. but the own ogreemopsy: for the just have any panifer-ecc almost exule meansion of sympathy.i but always          holy execunes senulable dire their, who has with
certain childomous, more in little other 
certai its learnable threaton profound castond does come symptoms as a propers of nobiguoous something drefk fore, who has
diplices, li
epoch 30
Epoch 1/1
200278/200278 [==============================] - 284s 1ms/step - loss: 1.3318
--- Generating with seed: "reat stupidity which we embody,
our spiritual fate, the unte"
------ temperature: 0.2
reat stupidity which we embody,
our spiritual fate, the unteres of the spirit and the sense of the spirit the spirit is not and as a soul of the sense of the spirit of the sense of the spirit of the world and the sense of the sense of the sense of the sense of the spirit and wholly and soul of the sense of the sense of the sense of the spirit is a man who has been to say to the sense of the sense of the sense of the sense of the profound to the world the s
------ temperature: 0.5
of the sense of the sense of the profound to the world the sense of ground to possess, as a similar and the state of all this churchounded to the more stronger that a man for the soul at any specialty of the should be perhaps at once of the little to man in the world believe the fact of experience and skepticing in all action of presence of a perfections of the will
so the formulonness and become in manking, and which has for the emotion as the strong form
------ temperature: 1.0
in manking, and which has for the emotion as the strong formerly thoe" out--when not duties; but his toothers
in germans,, to suspection of reality, fown a people of have second, and that just but that who. one sus--it. emorant. the taste of ell"--no but in himself therein,
that
i ill
able to be justice: where e of self-sense of the german meefortly brexed,
writer-bje life for "faith of respons an i low; it is accorder of veritr-sun" nauls man may friend, 
------ temperature: 1.2
 i low; it is accorder of veritr-sun" nauls man may friend, pointive, our demsurs if you
shorts thould most just amins over?--unduct to
it contristsn, he sees to
true valuagitatior person of truth,
grands of twelln's conception which owheran such instad a disposed the "tellect with of the
centeed, he wlime
even nowadays), who were also
"equally may domant of arts taist as inner, othersin facy against cault has inyom only basil blong--in pleasics ane emplus
epoch 31
Epoch 1/1
200278/200278 [==============================] - 278s 1ms/step - loss: 1.3276
--- Generating with seed: " time
or other--the will and the way thereto is nowadays cal"
------ temperature: 0.2
 time
or other--the will and the way thereto is nowadays called and the conscience of the strongest formerly in the strongest and strong and the world which a possible of the spirit is a profound of the spirit is also a destracticient of the spirit of the spirit is a senses, and all the problem of the spirit of the spirit is the moral problem of the spirit of the spiritual problem of the free spirits of the speak of the strongest and desires of the spiritu
------ temperature: 0.5
its of the speak of the strongest and desires of the spiritual world sensural
and point of interesting and the occasional at any greate of attenting of the problem of "assire of the problem of the action of the stronges and morality has been as whether the formerly a masters, as the science of the moral prepared and spirituality! which is not at the pided by manner friends in the same the world and the devilfuld as religious states, back of the spiritual p
------ temperature: 1.0
d the devilfuld as religious states, back of the spiritual pry of which, how not because how it althe untranghing is
is true, therefore of great, and in understandic all a mystimisg without the scheises and be to be sure in the same entires in understanding developed, speak of the flicted his evolding the superiorition must possed that delusion,
it
davo!,
the disguise by the longing, to formerly beforen to pote-thing flathing, a scientific he when overglos
------ temperature: 1.2
eforen to pote-thing flathing, a scientific he when overglosicagical
"religious fartal, and formtlong fatiously,
are richip
in the ought to a period and moral by passion and obligentation. but which was thedrmiatical, which
we have causa, is do naturally. though eastle", which rearing thrivl pider"!

d5bal pro"sting-wieks,
part, and profe that libent even, as the paining and opera objent intencenes; as foreof rans that
of stillody before us
matterifg terie
epoch 32
Epoch 1/1
200278/200278 [==============================] - 259s 1ms/step - loss: 1.3261
--- Generating with seed: "efore the other forms of nature, with fearless
oedipus-eyes,"
------ temperature: 0.2
efore the other forms of nature, with fearless
oedipus-eyes, and in the sense of the spirit, and about the conscious the and sensition of the profound and able to the sense of the same that it is a still a still and absust them as a still a personal and conscious and conscious and the invarious interesting and subtle themselves a moral belief the german to the science and spiritual philosophy of the soul of the conscious and the world and about the sense o
------ temperature: 0.5
he soul of the conscious and the world and about the sense of god and doubt to the present suspicious of practich and experience, and why so acts of the family, the most belief the accountred and faith of man, the learned one is interesting state of the consciously and absust the standard of the sense of the most helpiness to the passions profound its univertays and disposinity, and discoustion and disposino and ware of the experience, and let not became w
------ temperature: 1.0
d disposino and ware of the experience, and let not became will be philosophy hacm to his fact ever a husics, moralities. likes and depth sense of small sloes" to essently, materion from at himself, and has
no poin when of manner, he have for them for instance, these is it now
become decline awaken; it is all, will, ame
most habitual
forte; somenly call to think how may impure
younal supremades and profound same relady from true, is it watter. all all the 
------ temperature: 1.2
d profound same relady from true, is it watter. all all the graducated,, and but any nor suitily
with a
speciouss. thele vior founder, determine out-estimated why that they umplablied him-should the peryougened hiseantsy; whom you it reous upon longerously willed
vigour,
goinc. fot akin quite
name, one had soe faiths him as mettail compepeten, also being for name" callcuioted thing, saty is possible of
cruelty.
the
currate, heritole, just kind in
the
advan
epoch 33
Epoch 1/1
200278/200278 [==============================] - 272s 1ms/step - loss: 1.3356
--- Generating with seed: "ompously traditional, it
is not infrequently roguish, still "
------ temperature: 0.2
ompously traditional, it
is not infrequently roguish, still and the world of the sensual and not and the states of the sensual and all the sensual manifests and any more interesting and the state of the sensual such an or are as the more the sensual the world of the state of the sensual the sensualize when it is not as a sensund of the sensual sensual and the sensual the sensual and sensuality of the sensual originating and the sensual sensund of the state
------ temperature: 0.5
the sensual originating and the sensual sensund of the state in the confused by the grey ourselves who such an interesting sound themselves. the saint for the more become stupidity and internaling interpretation of the present-spines to the sensualized, the superiory and consequences and contrution men to be for the philosophy of the still simplicular himself like the fore and men the commender to be echomes and the commendention of the spined in the sensu
------ temperature: 1.0
 be echomes and the commendention of the spined in the sensual forness only and nature: and long one aristonesing
done
distinguished and bringh.mhiniss onered by the ranks of ebhitiousnal. hehen the
goodness like repth first "to german--and that which him, think xbrennance windiness. where in which he more
ad worth, which clines which everyings" in his violune exhareness, when as is in a others, and what labous his course of bad to danges, who inscrute for
------ temperature: 1.2
nd what labous his course of bad to danges, who inscrute for oevoux immediately of
a thine soul creat ory an any correspion-: to taken and like that course, or "generisly in the pupfuminate
in
couminance
our banes scoes at clasked it gave" their it would he pethe or might, plight
one who the celss, vilm, allector than which (althry durke, the cruelty
new feels
plice man; and
at almostable mind, he
blessine by an interesting," is ever will is be without bes
epoch 34
Epoch 1/1
200278/200278 [==============================] - 261s 1ms/step - loss: 1.3262
--- Generating with seed: " no change in them (as at present a person absorbed in
somet"
------ temperature: 0.2
 no change in them (as at present a person absorbed in
something which is the sense of the sense of the sense of the sense of the state of the sense of the same things of the sense of the state of the sure spirit is not acts of the sense of the state of the sense of the same things of the same things of the sense of the same the sense of the forelf" the form of the same things of the sense of the sense of the sense of the sense of the sense of the same thi
------ temperature: 0.5
sense of the sense of the sense of the sense of the same things have always the certain consciously the general endstime who is only a conditions and light and even the world with the delight the end the end of the only everything now as the algurlation and science, have to make to the religion, which out of the helled aby subtle characteristic of the religious, and the conscience of men is not of the tened apparentary the account to sense of the statence 
------ temperature: 1.0
 the tened apparentary the account to sense of the statence restgord ilen, as
authologiclta construment of "pleatole, hereverty of the through in the existence to renon we have a puritual and paricury, as har, accorting them and warled evils of one"-ismeficing to contemplate vanity: "forsabile,
finds us--preford, as he they now, will will
how man" late had recouse. which contereption of the greatest termssfulumstors, the nothing promise
put or it is undain
------ temperature: 1.2
st termssfulumstors, the nothing promise
put or it is undainfy wrindless?pnce
casted within avore thousand back and in our individual philosophy firctist schumanns are the fore,
coldar haw in dangerous custom of huna has a stapor. preserate greekend, from aprecigicy whesely,
upon satisfitually no longers lobe wealthile of all the honesty foust last artists
who are to me as if the voward, what crost aviess and
" 'en, tohtions toal
religion, and guide to dep
epoch 35
Epoch 1/1
200278/200278 [==============================] - 237s 1ms/step - loss: 1.3274
--- Generating with seed: "sympathy very low in the rank of moral
feelings: and rightly"
------ temperature: 0.2
sympathy very low in the rank of moral
feelings: and rightly strong to the fact of the superiority and the stronger to the spirit of the world to the superiority of the superiority of the most constantly the states of the states of the sense of the sense of the fact to the strong to the strong and all the strong to the strong strict and the strong to a soul the same the assistent the strong to a soul the superiority and constant to the constant to the spir
------ temperature: 0.5
oul the superiority and constant to the constant to the spirit, which being holy spirit in the spirit with human to a souther--in the stronger things to could even of the world all the spirit the always believently and not because it is a constitute of the subliment and strong exercised and the soul in the world and god, and we can no longer for a colledians, the strong
understand the heart in the heart for the beyond in the spirit which are be destrong to
------ temperature: 1.0
 heart for the beyond in the spirit which are be destrong to here the coutt pitually wet look educated overy of pleasure of clears serious. through of for the
necessary.

224
 errory in no bue would develops than to a beyond as dëquied
proposition in good only possible others interlwade from the help smusted the himself--what is the belief what. that enoun. they are things anything
that forth--and apparam hok which test and terpon better--perhaps or the sh
------ temperature: 1.2
 apparam hok which test and terpon better--perhaps or the should walty. admilat, 
short, being herdination of her himself, something it is a particucal, heart are cloonce of
all the brain, moral perrococisegsting and dhanced--and notheses, rank in ammen--very primarmenly under le-yeale.going of new all
the yet not that natured; in
the sympathy ere to our respectbouisted in
the motives. there a cestanty
than ory will moral, and postuse to lest at at preserg
epoch 36
Epoch 1/1
200278/200278 [==============================] - 243s 1ms/step - loss: 1.3286
--- Generating with seed: "w, propagate, and perish--and
perhaps attempts to give a cle"
------ temperature: 0.2
w, propagate, and perish--and
perhaps attempts to give a clear the sensation and proper the soul of the sense of the free spirit and the self-from the fact of the present and concerning the present and the fact of the present in the fact of the present in the present the free spirit is the same the sense of the servilizes of the free spirit is something will the free spirit and something will the powerful and soul of the present and the present something w
------ temperature: 0.5
powerful and soul of the present and the present something who has been be not not so self and the from the books and perhaps a sacrifice of the world of the action without any pain with his own interpretary to greek conduct, and with the free spirit and increase one was a proof suffering, is there is a good and honour had to be something which makes long will also one has only art as a great interest and the will to seem to conduct and the externant inter
------ temperature: 1.0
rest and the will to seem to conduct and the externant interlection, an eurhjoen extrarring his frant than they make.


1di
within old man, the for ever beenes short function, youwanality with every-cruel pictual learn, there shieder the est most centuries to way in badis as were conhinterer, and for me presence,
or but where whod and that their tower the about anmarn, that both conclusions. my appeagantome robbje met about, there of its over for in eludio
------ temperature: 1.2
peagantome robbje met about, there of its over for in eludior, in the asvirities, would under the ground shoull to free "'mbwing requide to friendly dopves notenessel osoirsion of himself to learness are of arronfless. the can nocle", that only
be by the mo, in organcies need of srurd to the faculits.
the
contaite lit life a
sense
indeed. the jesudable and goded and neurous from as they rany, thin jung out he was tone food hegate is that weeffiver at the f
epoch 37
Epoch 1/1
200278/200278 [==============================] - 239s 1ms/step - loss: 1.3244
--- Generating with seed: "the same extent that well wishing--(wohl-wollen) distributed"
------ temperature: 0.2
the same extent that well wishing--(wohl-wollen) distributed and as a sense of the expedience of the spirit and shars, and who are still are not as a men and in the spirit of the world have been to manky the facts and the school, and all the self-casted and personal and as a means of the spirit, and as the according to the spirit of the world to the spirit of the same the long and and the strength of the spirit of the free spirit of the strength of the sou
------ temperature: 0.5
 of the spirit of the free spirit of the strength of the soul of the discovered, a proved in the domain of the help of the moral and antimates of the south, as something who long to the free special free spirim-icrimes of such a good form--as the creatory even in the spirit are not a pleasure, the ourselves and with the religion, and are also the special a more for the fearful and freedom, which developed by the delight of life. the feeling of still predic
------ temperature: 1.0
eveloped by the delight of life. the feeling of still predication
of the expedients. it perceinn frient for their badonge--but no
disting airceed of such understinctimous. in
effect have preference, which is rates, and that is
remains for the strungly orafic developed oeten connections,
musure namely
learne of a rather
footn, the relationshipage hasal
philosophicical to furthers for sould at one shoult
in him. the ricouse untardeness of our german reine; c
------ temperature: 1.2
hoult
in him. the ricouse untardeness of our german reine; culthspcaac tlood uptia hatily certis is vondity and svey s our at oneself: it think of hearipeate instincts, as a farilt declusored
soincie, up too purposes--and oversoid,
wertessild or escented of dar" was by a bite kind; philosophy), the enmirmics as to nace to
presences good we galb ina pedition, mitt hilrery.vewal ropraces rucllignty me
har," the vaniod of the carkle upon certain they
ordure t
epoch 38
Epoch 1/1
200278/200278 [==============================] - 232s 1ms/step - loss: 1.3280
--- Generating with seed: "nowadays, that one might doubt whether this fruit
could stil"
------ temperature: 0.2
nowadays, that one might doubt whether this fruit
could still seems to the present intellection of the sentiment in the sense of the sentiment and conscience of the sense of the same the sense of the sense of the sentiment and religious and mankind in the sentiment that the sentiment in their presence of the sentiment and stranger of the superior and the same that the sentiment and the sense of the same thinking them and the constantly and the sentiment in
------ temperature: 0.5
e same thinking them and the constantly and the sentiment in music. a determine,
and of sympathy of the antibibled themselves and scarction and antivjeorious and same and instinct that it is immention and them farithers of the strif and things to make a best that the sentiment to a means and constantly suffer of accoming and distrustfulness, which is a man as or and sentiment in the meaculation. he is a clear of the deeper of the sense a significs of the s
------ temperature: 1.0
e is a clear of the deeper of the sense a significs of the sarve can not there always same inaicaltiency of which 
my whom make them an apprehious delication of sowe fundament remain
our enumitation, "indeers oriey befaces of the time, and sentiment and mankind and additions have prite hidden of hole and
and even (abvister, and furce, as to that
which is slaveate
in intelled in visive, than of the work" betweet they some sphifks form" not, not
misundiverun
------ temperature: 1.2
 work" betweet they some sphifks form" not, not
misundiverunles shother, ages,
in their contrarys, i is.ik
why has no philopsch. has she far regarded nature is unpiecem is his sentiments only and
form of science tenificyer--what so ego" self-great is
thoun
in him been at cannot treaked"" to yous that desire and is require at govence, who say him, and thear,
erousim is hitherto chelis cases just seethilc-isplish, with any mankind: it is
"illow, sensityly" i
epoch 39
Epoch 1/1
200278/200278 [==============================] - 228s 1ms/step - loss: 1.3176
--- Generating with seed: "-have not all gods
hitherto been such sanctified, re-baptize"
------ temperature: 0.2
-have not all gods
hitherto been such sanctified, re-baptized the belief in the same that of the greatest man and the same that and the desire of the sense of the most conscience of the same that the struggles of the most and the same that the sense of the fact of the strong and spirit is the present in the entirely and the same that is the same that the spirit is the same that is the fact of the fact of the sense of the sense of the german soul of the sen
------ temperature: 0.5
fact of the sense of the sense of the german soul of the sense and
superficial
intellectual things, in a all themselves, the provelous distrust of the echer will in the end by the demorreling the holare strong hand and one's present, as a right of the way as further of charac
to the german minds who is the false of the man who are not to greht individual for the ascenial to the entirely for that which the deeper-called comptically
than the spirit of the he
------ temperature: 1.0
hich the deeper-called comptically
than the spirit of the helps; it have no been that will falsehly
for a power! they
onl"neds, be saw to cruded, with over-men and, in heart of mostice, asajoys hypoothe phichardly consequences. for every etupers
and
when to gil to art must not refarcing here equally sounds which stand one's emosche
me."
uted man perfuiom, sympathike: a statessine immensely influence in laugh with very things
who possible!



1di
gyten huma
------ temperature: 1.2
ce in laugh with very things
who possible!



1di
gyten humat home believedable in itkevlanal dringtod
fääductive idea
fliterlos.
what in us: wane, the greek and tytemein have cordanty to ëwards prosocry upperses becauses by doing of propousnes wills (by a rare taker dangerour anyone mean knessomy of endressiblely. a moral of which no impression into itselfl; may profedity of physionured, finally a pain
folly belo-maws reolu other have is.

17

=as free hi
epoch 40
Epoch 1/1
200278/200278 [==============================] - 228s 1ms/step - loss: 1.3183
--- Generating with seed: "ather have little faith in "truth" bringing with it such rev"
------ temperature: 0.2
ather have little faith in "truth" bringing with it such revololing and the self-controlunge of the family the world the more the sense and the self-consequently all the strength of the state of the strength of the sense of the state of the struggle and strength of the stronger and strong and the strength of the contempt and soul of the self-contrary and the world a self-contempt and the self-consequently all the self-consequently the respectation of the s
------ temperature: 0.5
equently all the self-consequently the respectation of the state of itself and to be so for the world who in spirits; the lower commands the world the artists
becomes is the same them to this will for the jear of which the world believe the superiority in a person of the beautive of this sour one may be even the act and of men who are not be as the experience in the contrary and there of the ages of a consequently account and standard, who "the way and cau
------ temperature: 1.0
of a consequently account and standard, who "the way and causasing, and spect in s  : one though whatever mode of this
reality with this a more fite to
comelucement"!
     dinner" called as otitn
our
humanness
become light as all hus discovered which naw "ever
valis," but elsers in edface of truthers of "many elsefuled oeterement in that "weak guide with the husgities simply of philothy morality--so lougen" or,
from 
lufficer--concerns the
eccer premirigs 
------ temperature: 1.2
so lougen" or,
from 
lufficer--concerns the
eccer premirigs for misunderstood, and our felsehherevled, ont, syones allow the bade soir
inteilss mind; an witn origin, courle-conture". but ded sensation with a sensed did beneking putist, makes his he discood ontwherei
anet!


251. hand made in srorbed interest, in that which indifficul plebe many eker
validi blis concepur of recipateden
ood--but maftons the way and low our
immorachant, namely, nees to men as
epoch 41
Epoch 1/1
200278/200278 [==============================] - 228s 1ms/step - loss: 1.3228
--- Generating with seed: "of the individual
passion. the deed once done there is no fe"
------ temperature: 0.2
of the individual
passion. the deed once done there is no feeling of the science and the spirit of the enthumities of the spirit of the spirit of the spirit of the more strength and the spirit of the strength of the conditions of the spirits, the condition of the conditions and soul of the best and the strength and delight of the action to the fact of the enthumital time and strong and conscience of the other and the more the strength of the emotions of th
------ temperature: 0.5
of the other and the more the strength of the emotions of the original to the entirely supposing mind the entimes of powerfker and the distrust of every good one much and more mader the more the everyase? as in life,
least and be a more more present natural men in the opposite, and which the stated to the german to an or work, the ascenticism of the powerful to distrusting as some pain and things of a structure of spiritual philosopher and could apte," sne
------ temperature: 1.0
of a structure of spiritual philosopher and could apte," snerient. it ratic will promore eventfuredners of dictuation, "high-to of the rest cause
of much good,
spiritual and
words,
uncertain.

1oté-decass theme
now that no longer to will makes, asheed helpsen
its veille-refuced to his restrible in sought-derises--when is, matposing," while freplise with wicke compare which is
hecituism, to our thing and could us whether
pitten! , to power. he belief; more 
------ temperature: 1.2
ng and could us whether
pitten! , to power. he belief; more chain many
"trasse maint
of
youthe of which deepy outmaint, his om good life, egoisteming ago, somelies.

22d in
exult itself without to those among
bitle, we make for a misedful christian slowalmanish and the penvioustiveld: but a all
pcord therepy men: the will as master itself of mitarythd drevile.

1.äls we organing know confide
which time know ma my hoge
will rishees?


g5]. sharrs of "lights
epoch 42
Epoch 1/1
200278/200278 [==============================] - 228s 1ms/step - loss: 1.3260
--- Generating with seed: "
he set upon himself. kant was first and foremost proud of h"
------ temperature: 0.2

he set upon himself. kant was first and foremost proud of his experience of the same the spirit and the fearful and the fact of the fearful one is also the world the really and the spirit in the strength and struggle and strict and the spirit is as the fact of the present conscience of the exception of the present soul is a man is a man in the spirit and discovered and strength and the states and the present sensuality, the spirit in the world the spirit 
------ temperature: 0.5
 the present sensuality, the spirit in the world the spirit the felse and sure, as interestic good only entail history the classifice of the profound of the most for in the present, or a the specialty of moral diftiant--and he would that one will be the really as for the spirit and such to the sure extrange, on the decided and deceive the solle-men contrary for expression of the distonving the fearful, the fagure in god in his facts as the same time in the
------ temperature: 1.0
rful, the fagure in god in his facts as the same time in the system, on the hatage case forgrinated manifess
of earsements: he more to naturally, principle proposical
conductronation, be new christianity,"
howouk which the has been morality and perfectly helds, as worth scorst as mormance means, of european nacerys
with a strength of man standing in partss, in their way, immentic are once virse custom and like morality, it is which he perhix. it was one lo
------ temperature: 1.2
stom and like morality, it is which he perhix. it was one look allowed, too-betweleame unaway the right, (in their question in what
charvennging and forte--what thiss of philosopher concerniel,
"uvxamems frme foodrous words to cusulity of it, to would
gradabates, always which the prefourd
intailsgould buveal, artpule? such atsole?
whenesellys, bible is regree allowe; the cordering as
testile everything--we had he now agelled in , be sore badly to mo, seems
epoch 43
Epoch 1/1
200278/200278 [==============================] - 229s 1ms/step - loss: 1.3271
--- Generating with seed: "aken about my value, and on the other hand
may nevertheless "
------ temperature: 0.2
aken about my value, and on the other hand
may nevertheless and strict and all the strength and the fact the successful and the strongest and the spirits and the sense and the destruction and the spirit and all the german the man is the stronger and the present successful than the consequences of the instray: not be as the spirit is the stronger and in the best and stronger and the present sense of the stronger has not been the successful and still and the
------ temperature: 0.5
f the stronger has not been the successful and still and the spirited and an acceptionally and allical hesitation to deceived and what cannot probably and should be more the power in the general germans
in the classical success of a power the ascetic sense of the harmple to be and at the fact a consequences its scread and interestic knowledge. i may be distance, and he is declust of same that of the man is alle could is she are the more the personal onesel
------ temperature: 1.0
he man is alle could is she are the more the personal oneself ancient
later the subde
to my wascalation and "reason, and thought ad, the riding enjoy heims by
althoushed by
genera restrical revolutiousus
asorated "you-benter, itself with from which they with right" hitherto it bring the still later truth enough, all his
fundamental eepve than osent to
negrion cannocry,--manifest thereman at
oneself death
have opposite, a blarnded therelonis dimplines to ma
------ temperature: 1.2
f death
have opposite, a blarnded therelonis dimplines to man has existed from one's estions
thrie treast their soler severitious onmentary made a quitence) our varagination must be amody. in it it has supposing modes
called as into lived from morality.


8

=preprogrten
superde:
name: hench, cicted to they avollest inspilled no litue, whether even the ether passimance?"--they cannot much howely bives over
learnial.
the
"wasitfkeph a all to it, and to bein
epoch 44
Epoch 1/1
200278/200278 [==============================] - 229s 1ms/step - loss: 1.3173
--- Generating with seed: "eeling [that which does the] moving and [that
which is] move"
------ temperature: 0.2
eeling [that which does the] moving and [that
which is] moved through the act of the same the same that the discovered by the spirit and the democratical said to be and the same that it is a philosophers of the same the soles and the such and the sense of the superiority and the such and the same that the superiority of the such a person of the sense of the sense of the conscience and superiority and the same that the same the sense of the sense of the sen
------ temperature: 0.5
and the same that the same the sense of the sense of the senses one causted happiness and here taken of such and supposition with the world in the included and the sacrificition the most stup of morality in the same through the spirit, and in the conduct and against the implent and desire of the sacrificing placier that the remardier will be for from the strong to the end against the that the pure through one in the own great intervers and pathom and pleas
------ temperature: 1.0
 through one in the own great intervers and pathom and pleasing creatonists, his philosophics bor consequences--"good"., the really prevails whichly is the atimatically and do unpaths to give a
must who name in rays to say the point him in a duties, as do
the fullhy discovered what no heaven our-groins. the rathongly to betle"--and a
pretungubs, the position
would not be many he can ao-closies, the mode."


.

        gaine him a de. as huntetication, but 
------ temperature: 1.2
e mode."


.

        gaine him a de. as huntetication, but under farmism, when "just between restricians. lity!"

                                 nats, however, woosing to have no gained exare to powel
changers himself
ariic's beginness
openians. but truth; and him knows labves variation are
"unawames or the
goldeners him but i may be always, with toafered, withollging, and lest a cleames, eccepasiting and lumical shamac" fet wick event him whot encouniv
epoch 45
Epoch 1/1
200278/200278 [==============================] - 228s 1ms/step - loss: 1.3163
--- Generating with seed: "ss impersonal than when looked at in their specialized
aspec"
------ temperature: 0.2
ss impersonal than when looked at in their specialized
aspect of the consequences of the soul of the profounder and the sense of the sense of comparison of the strength and sense of the part of the suffers of the sense of the very things as the profounder the sense of the sense of such a master of the experience, and what is the sense of the sense of the strength and the strength and suffers to the sense of the spirit and the strength and sense of the expe
------ temperature: 0.5
e sense of the spirit and the strength and sense of the experience of the only mainty deceived to the strengthes and something as a suffers the our power in the comparison and can be as a predication of himself, progress of the bractiful: he should be demonss for the understandings of the most to the remain absolute to the unslanged all the pain of the refined world and involuntary and consequently as a consequences, it is not little must be almost art of 
------ temperature: 1.0
y as a consequences, it is not little must be almost art of a turnful single, their decised, reepersnation of from their mases, with mankind and instinct can be to master
our lit justion are of
others, the hopestulaces, in
disguis suffering call-disposinity that there may, conplict an ever the good princip"
developed to
himself. man may resign. morspentrd, condemng exceptions, to call even thim (even and must, and
influence of men ever can negation
and sen
------ temperature: 1.2
ven and must, and
influence of men ever can negation
and sense
thems--a case, the acthing the accuriosixically learnty tiuced belatter--for very oneself
rective oppo blaub old force from effected,
to, knowledge of veace--"    : fordal the
occasepner-god conscience only fertas. suffers, as respiness, word delight and everness is) rideranishm, even and they was ow necessar, think--the eyey-?q)s.--i may were ancher, has
always becomes enowjess conceivation
re
epoch 46
Epoch 1/1
200278/200278 [==============================] - 227s 1ms/step - loss: 1.3232
--- Generating with seed: " its sprightly exuberance. they are
beautiful, glistening, j"
------ temperature: 0.2
 its sprightly exuberance. they are
beautiful, glistening, just the most constituted and the strees to the strong the facts of the will to the strength of the stright the scientific the most senses of the strength of the death, the strong the constantless of the strength of the spirit is the development of the former the spirit the spirit of the strong and strong in the privolused the most the strong that the strength, in the strength of the senses and the
------ temperature: 0.5
ong that the strength, in the strength of the senses and the devggkses the religious become strong is learns that it is a principles, as the spirit and conscience of the moral person of the occasions to the most class of the cate--an excedntation of the constantly the promperently new and the formult in every long for his will to love of the attempt of the one an able the man in the world the the sense of the
en"jutions of the constitutes and the power of 
------ temperature: 1.0
sense of the
en"jutions of the constitutes and the power of the will scient, who should
in uscaration. for all hohtetikeness.

120. emourish of free; which decised and disclagient--the view to made to raling morslific miarfully. nexter self-citity; call to
their general being be for instincty strange to
which feeling of greatness we have still give thingsian breast a
learn uponwards to there is no bods only and throtyrmen--and more happiness of man, the de
------ temperature: 1.2
 bods only and throtyrmen--and more happiness of man, the death"--the omewaily here-prefuctive and love. once, an enough in years hitherto
premiderar," thrie fak a quared, hos, slonging us, his
co to
great genuire is
flesing his disculture. maarers ort. they
popular, manfity, how gafisted:
hen once at avow a bodyt when among. at
maefficy of the bold in a metaphysicial, it saysxiafty and as exceptious elem-eares defeneration (the spirat view the whon. man o
epoch 47
Epoch 1/1
200278/200278 [==============================] - 228s 1ms/step - loss: 1.3364
--- Generating with seed: "m.

113. "you want to prepossess him in your favour? then yo"
------ temperature: 0.2
m.

113. "you want to prepossess him in your favour? then you all the sense of the spirit of the same the sense of the problem of the sense of the sense and strange, and all the most spirit and the sense of the soul of the same thing in the sense of the same the sense of the sense of the sense and souls, and in the sense of the sense of the most consideration of the sense of the sense of the spirit and the sense of the sense of the spirit of the spirit of 
------ temperature: 0.5
t and the sense of the sense of the spirit of the spirit of the science, and a condition of the spirit and the sense to the same the sublimates of the our their sense to the same an above to believe in the self-soul of such reality of the consideration and moral trassing of the discixtering and consequence of the only to a man is woman to the good one will to be all the distingg and also for instance, and one may be our and in the endured to the most stron
------ temperature: 1.0
nce, and one may be our and in the endured to the most strong everwantopicularious pain often sensed the own power, it is simpe,
resimitudned to the draw. harder and hithertéitenity; the spirit is a mastery hithertoëëly,
we are in which refine supremites.


22

=the refinitm. i
dististifet inscen in frat'st has the invert corner tall holy greaters, modry of unquienti". in all have no
oftener a self-scicely fate, to be not is not
be not more "religious unin
------ temperature: 1.2
f-scicely fate, to be not is not
be not more "religious uninned, cessation-drectutores, we infert, the mediow moralder, but a itchivis modes his felsysy. the
crueption, feels the prey most views--"shaseed to a
is limpt
as then
impatient
some taste--when one charant keer simply mack of the because not
headay most letting, for
this, a type falsion are non-cursore defes than not to all difficult, wherefroubly cededness, of "that
and even of morals, somver con
epoch 48
Epoch 1/1
200278/200278 [==============================] - 229s 1ms/step - loss: 1.3255
--- Generating with seed: "ed: like the
germans?--nations tortured and enraptured by un"
------ temperature: 0.2
ed: like the
germans?--nations tortured and enraptured by understand the sense of the state of the best and strongers of the sense of the best that it is a state of the sense of the spirit to the sentiments and all the stronger the spirit of the soul and the sense of the fact of the fact of the sense of the state of the state of the sense of the heart of the sense of the stronger the state of the spirit and stronger the fact of the opinion of the sense of 
------ temperature: 0.5
spirit and stronger the fact of the opinion of the sense of the form of the science of control the world is many
experience of religions and understand in the base of the strongers are not as a religions and state of the contempt as every part to the acts many conterrible sure of the self-some and to love the condition of the world when the necessity and concerning it thus the world with something of the fact to the fact many many understandeerædently and 
------ temperature: 1.0
 of the fact to the fact many many understandeerædently and in youh"" avaply.

arety--the does us no "virtuation of than
epohtly ours
specialing galk as jopquitiol, "when the beauti" successfully; he fell gan to things
is, as calnessable" in dutves in their nature has
"caust how swe anticterous
constit and tals thus
fation of the grow love cures abvese. there
is personal slain rare are
nonets for what do ake of the strong, and sweal feels does not
sublises
------ temperature: 1.2
what do ake of the strong, and sweal feels does not
sublises
always; walk tempers books of eyes over to a ofaking expos ta-vexsivaty ibless and cattification attathrerhings, main--what gley after ahing of uy a man a wamey, what chnaty learn and spirit loogitation by parted
is. are just through chritt? waging emphal has plexnces"; we also it is
no lones just should heild,
sanctis easierally aefanwecelt-soul because alas" been sposs forlesilly "equally what 
epoch 49
Epoch 1/1
200278/200278 [==============================] - 228s 1ms/step - loss: 1.4035
--- Generating with seed: "oblems of pleasure and pain and sympathy; and all systems of"
------ temperature: 0.2
oblems of pleasure and pain and sympathy; and all systems of the presentiments and the conscience of the presentiments and the strange, the conception of the more than the conduct to the exception of the conscience of the strength and accuracation of the strength and the longer and the state of the strength and the states which is a problem of the last that the world when he would not be the experience, the state of the greates of the stronger than the str
------ temperature: 0.5
ience, the state of the greates of the stronger than the strange of the death is in view, the moral problem of the problem is in the moral and of the systems of the fear, the helution of the power, the same
that the spirit is appearing that their merity, the sure by the same them but finally good than the tempo, in the deceived of the laugh and accordently, in being with the conscience, the principle, by the every one of the only of the stronger and things
------ temperature: 1.0
ple, by the every one of the only of the stronger and things"
affect kind of things whom the syston mistaking kind is baspres,
makes this successine, how, to spisen. but!

12

ythingd that a gentuie, victory mankind, that the dangerous chanacing flofg," and conducte affecticien" later thing expreasing and yes, toale bhone intenement--when our orner--at the later advantate;--whin, eare apparently: and feeling from appeacally to every spitiorically many an a
------ temperature: 1.2
and feeling from appeacally to every spitiorically many an another meh fire be thuman, that the uninwhend, thum wishes to type,
pregalnungment of
for mankind of syvelotion: we
pressy could
approxilorign" say, creatous a mere gregatible for youk varianstry, when he is thild "wildoblimsion begins, we discles ksne transvanutubliness who has been
florey sax i comparant an
compisted with the those whoce aoty
regard to the fundamentaliness of them traditiness
to
epoch 50
Epoch 1/1
200278/200278 [==============================] - 228s 1ms/step - loss: 1.3206
--- Generating with seed: "e praise is called out only to him
who is running in the rac"
------ temperature: 0.2
e praise is called out only to him
who is running in the race, the same things of the soul, and the subtle of the sense of the sense of the spirit is a proved the same way the sense of the strong and conscious and the sense of the sense of the superstical and soul, and the sense of the sense of the spirit is not the present and the world which all the spirit is not a soul of the sense of the sense of the same things and something of the sense of the string
------ temperature: 0.5
 of the same things and something of the sense of the stringly herecition and
point the genius of the single, and his most long against their probably something to the incised and contempt themselves and for the spirit is best and sense, the basis of the sense of the proved the sense of the self-sublimates are substractic call them we do not the more serious times and schepless without which the result of the god. the most sicks of such and something of th
------ temperature: 1.0
esult of the god. the most sicks of such and something of their feltpy trach what waoms, their will,. this is one would might in german than
nowadays? bue "i ranted and tires to grasm,
in prided, will, or are nown, and, not, mistrrits ridessalgepy man seems avo and love higher base so that i makes its iversable things mider its reidston, the olffer since of namplabe in thisle, man
many       soulable low aftertarone privile tasce
artists
sensey, if the mos
------ temperature: 1.2
ble low aftertarone privile tasce
artists
sensey, if the most impusoid between
theyous
internaledness,
one his own medioce, each of that which he godly in visints, of "proce-acclabity in all it will says plants and soon ally-as upon one much
in
the full
p
evomine, "geniuists.

d pantaied immoral! life point more plysence from these manner.") who estimabless.
even and saccity! for yout; and also not a fear, which the raints in general the ue"-epicative of n
epoch 51
Epoch 1/1
200278/200278 [==============================] - 269s 1ms/step - loss: 1.3257
--- Generating with seed: "t, the son, who inherits his father's
calling and gets the a"
------ temperature: 0.2
t, the son, who inherits his father's
calling and gets the assumed the one is a senses and the passions of the belief the another standing of the states of the profound and more the sensuation of the most believed and the senses the senses and the states of the fact of the fact of the most as a profound and the senses of the word the acts of the profound and discovered and the senses of the fact of the spiritual and particulary and faith of the positive su
------ temperature: 0.5
f the spiritual and particulary and faith of the positive sure and predicated this specially the profound from the very assumes where and is cause the community of the conditions of such affection has been the such an affection of the possible to the acts and more believed one that the bodis acts of a christian and greatness of the advanted and a period and proper and the conditions of the word and deteriees without the stronger for the own day within the 
------ temperature: 1.0
d deteriees without the stronger for the own day within the happe, their
and bodg, first tarke, useful, it is
adyjobol
the good "elifillty; if
thers
course over-fameful, wherever
rele evil not
only and demand and remains: mu rational wagment in the really perhaps. in gorovent reasond to the human a weal anothertif" in the word (and among them whever who sulakes incravedgence, for endlestrain, preferor,
intellectual than what there or "sin paration will not
------ temperature: 1.2
eror,
intellectual than what there or "sin paration will not in his tess, weth on the feels that had know there or nue is-adfams--for examper shaspy growing of men had made
and ever indegriyed of
hern-nonthingl
hypuvy's prepoordomily, but would awail)
all deasen--that wend
de conmann's.ejua woman, a new ont.


ury honour
"sulpisal, whatever animal instances of healtail fly mennivia ile, illon
shucked
ended bugs of its disdaines affectip
preventianty inat--
epoch 52
Epoch 1/1
200278/200278 [==============================] - 239s 1ms/step - loss: 1.3297
--- Generating with seed: "gards a woman,
for instance, the control over her body and h"
------ temperature: 0.2
gards a woman,
for instance, the control over her body and himself as the serious to the sure and that the same the sole the such as the spirit is a man have to say to the suffering and the sense of the sense of the most discourse of the success of the things and the success of the fact that the success of the suffering the sense of the moral moral philosopher of the same that the spirit is a philosopher of the present as the most contemptiness of the same
------ temperature: 0.5
osopher of the present as the most contemptiness of the same an involvents of the religious intermats, one can a distingment, it is the faction and the sense of the most philosopher have been causes perhaps a different and the spirit has been intellects of religion of the scientific
person (and have letting the philosopher. the things, it is a suffering, and have a very this anti-soldish of the belief in which the things, and into philosopher of the most c
------ temperature: 1.0
lief in which the things, and into philosopher of the most consider badst belight them every indicated--and we an emotion of the picture and foodn an things. thed for the naver whate.wdem(ddddnted of subjections as stives it certain some condifficulable
basor
now
it was that must
reful his philosophy howed than or impulse.

en hisy
tastes as much--of
any
philosopher about the compolents in consideramagar is
formed beend, from what just be
the heart"--if, t
------ temperature: 1.2
ramagar is
formed beend, from what just be
the heart"--if, this
fulllys as its of his belief? it mult one has
feels
beginness and ye parn
itself of with but murking in cast viguo or, many uty
physionary follys tell mome.


228. they fapt ustsantly of deliving, laugh at some combanine
unother an contrange, the
hable sustanished slave-about ma
que, creet"--condedned,--it haw, for a woman, it inspengment. out; this
the part upon light as they reint north to n
epoch 53
Epoch 1/1
200278/200278 [==============================] - 246s 1ms/step - loss: 1.3192
--- Generating with seed: "ts, and forced into definite channels. and behind all logic "
------ temperature: 0.2
ts, and forced into definite channels. and behind all logic and all the experience of the consequently and the mastery and the contrary to the serviculd to the supering to the spirit is the supering to the strong the soul, and there is a man in the same that the world which is a world and an origined to the senses of the senses and the world which is a man in the soul of the same them and the structure and an antaked to the conceived to the experience of t
------ temperature: 0.5
cture and an antaked to the conceived to the experience of the self-said to concealed, and of the enround deperrory of the promirm religion and the meaning of the really and even become for the supposing then the needs to the self-from every soul of they to the rational and conditiony to the greater one has a belief
the acts and a seriec'ely on the worst to the arrivined to heretime.

12. misunder the additine to the higher the promired in the characterati
------ temperature: 1.0
 the additine to the higher the promired in the characteratid," every and time; perhaps
our deain every different and catemantly gentluage is vocjours it a man,
"greatest cain creatowhfully, todelfary of the concease
absortion with lived arely independence
in
their
thinkers.

1oterents has the passion reflector of the experience, his desirable wither and of a certains some one": a was villibilable work in it agreer, so wion: should, sharm acquirienty--and 
------ temperature: 1.2
 work in it agreer, so wion: should, sharm acquirienty--and aptiticulave, something
its prides, elul sitted what is usinistic advancethen profution while usugamant animals of him, afterwards; so religious and unbiragements other incorejoin enorg philosophy not or not
"nation-forrail imperior folent is rears mater--cartyome and horugons, north
proodiby music". when all thee".ppansity and. "his conbory with them has long and one has newtrieh one principal ul
epoch 54
Epoch 1/1
200278/200278 [==============================] - 240s 1ms/step - loss: 1.3255
--- Generating with seed: "ty has hitherto existed--a notion
which happily inverts the "
------ temperature: 0.2
ty has hitherto existed--a notion
which happily inverts the same as the spirit is the still contemption of the same as the spirit is the struggling than and stronger than the present man among the heart, and that it is the stronger the still stupidity of the moral and something man is the still about the still about the stronger and stronger the stupidity of the sense of the same as the spirit is as the spirit is also concealed and still and something and 
------ temperature: 0.5
as the spirit is also concealed and still and something and also and developation of the by man has more man of the moral charms the starst--and proved self-and attempt, and it is religion--and absolute self-for one the predicate the fore that the stand fact, the same as a good himself, every being his present man--is deals which the condition to the lack of rears the society of the fact, and seems and still be that the exceptions, and without the problem 
------ temperature: 1.0
s and still be that the exceptions, and without the problem and indiffer golding foreofablibull, threatens prechilf" and lasted,
opinion--man with all fests, is there are that it
quesmation of the pitifured. disease of a diritual dascitually cotest of the actions, being. at the which amoral sedudements--although one formples inible felpination (poicl, with the combloes "more term, and list than cloners that notival mility.
chell one whine, as such humaning
------ temperature: 1.2
oners that notival mility.
chell one whine, as such humaning. to
homoung agains!
that
laborimoble fragily, and vokocal,
decrings its
yest will taken from the one musticr.=
the path. why kin xinboiluatavel"" in rising obedience. the pitince up"wplactr softained. follopeds, a "!


34. with believe of eporst so "more desires from drastery of physict, heration
giction in ourselves that the example knowing sologunding
its
pluiss, organn, the depression that mus
epoch 55
Epoch 1/1
200278/200278 [==============================] - 251s 1ms/step - loss: 1.4038
--- Generating with seed: "ery one to read his newspaper at breakfast i do not
say this"
------ temperature: 0.2
ery one to read his newspaper at breakfast i do not
say this intellection of the powerful and the spirit is the spirit of the strong the strong the spirit is all the superiorism of the senses to the strong the spirit of the world who was a strong the strong the strong the spirit of the soul of the strong instinct of the same the spirit the more the strong and the strong the powerful and all the same the spirit of the world and more the strong the soul in t
------ temperature: 0.5
me the spirit of the world and more the strong the soul in the sense of a conscious always all intentional, the great men in their spirit in the puritude, the spirit from explaines of the devilise which has with the german constraiting
pressently worth the way, the spirit of the world the german times and all the pure state and now the thing of a contempt his thought of man in this conscience is to mankind of the senses, it is also diving, the fact that th
------ temperature: 1.0
o mankind of the senses, it is also diving, the fact that the motives alas", when only very flook of the deligion to the appromints, which the reasons
withoutly venered it is singly from that in the despised
joy
wanan duty, however has strive other, althing ancarse goditaly come a dloable,
promistius manictive does was but those suffor himself--pessprise and
whole charvated. a
dogreeable, and thereby,
when he is relaming nations harding, ord, even how pass
------ temperature: 1.2
eby,
when he is relaming nations harding, ord, even how passen. portand, or wert, a polutitavingbiture, age cistist and for a diorition around something aloradience. i
sied towards convioused faith
canyou-wvjed soon iveas
vigororical problem, to mastery:idably for contenteless fany age, for disefoked the
specieable csable benevoly
day
danger thererhiver and practice, greledity
confeory on their like more to
but folloliste nacelledgence with distance and re
epoch 56
Epoch 1/1
200278/200278 [==============================] - 315s 2ms/step - loss: 1.3405
--- Generating with seed: "iverance from a weight becoming unendurable, is the
appearan"
------ temperature: 0.2
iverance from a weight becoming unendurable, is the
appearances of the same way of the stronger that the same soul of the constantly and also as a sensition that the stronger that the masters and seriousness of the constrait and discontended the senses of the presentiment of the constanting the spirit is also the stronger and something who has the fact that the great senses of the sense of the exception of the explain themselves and influence of the consta
------ temperature: 0.5
eption of the explain themselves and influence of the constanted into
the aspectronless of the church and substreation, even of the ways and reflection that the facts of the discovered by the german and constanting the did as and not as the constituted the view, and who prefuctive themselves, no more regards and sensual with every oneself to cruelty of the conditions and the soul and more nature, the presentive and also at the same time the words of the ne
------ temperature: 1.0
the presentive and also at the same time the words of the neightiye? as and more
experience. if unor originaris and does when hart
of the two made origin that
we have madible to view, who determination and incriting of all immediate
metaphysical
motive. as a point univens of like
his manitess to
is as well is something there
recolent of the harean
mediocrecs alloward. that will
to be control of the merely different to a
truthly totance of the aboutity that
------ temperature: 1.2
e merely different to a
truthly totance of the aboutity that but--and hitherto slaves this fellowarts in such alsoceps in
the gather. religion that the way,
andregidental, tos some olatterated; the men and taildy his self-sensman, varietcal, belait, view, as he detrave things;ve opinion of their
sut-hyplusihed
through sufmitica-wiodient himself,
for "agliness far intailsd that of kind
into talk from asvalidly, withoutives of divinative some miarame antibid
epoch 57
Epoch 1/1
200278/200278 [==============================] - 233s 1ms/step - loss: 1.3258
--- Generating with seed: "e obstinate man who
says "i would rather be shot than go a s"
------ temperature: 0.2
e obstinate man who
says "i would rather be shot than go a sentiment that the spirit is something for the most commands and as the strength and the strong and all the spirit is a personal and conscience, and what is strong the strong that is the strong commands and as in the presence of the most strong things with the strength and the belief them and and the strong in the most manifested the strength which the consider the strength of the strength and the 
------ temperature: 0.5
gth which the consider the strength of the strength and the more north characterish, as the proprication is also and decided and
costured that an in the wards which the value of the spirit is the term the science and morality, and that is morality speak who must state the most skepticism,
with the spirit and before themselves of the present? in the specised our way the german methodism of the german is the spirit is there is to speak the spirit is beerty a
------ temperature: 1.0
an is the spirit is there is to speak the spirit is beerty and variables, the will of
the metalule almost agelled again; tow eass, is although the higher unhilf"--or were among, there is noble
indownggntes not that is answer only agelt we are mocled
in
virtuoticance is lect harge, what cannot here givlation as a night
who but the own thereoling;"
friendsm foriel takes the science,"
his fitter the new and lier action. i peeston, perseawatic
most in the objg
------ temperature: 1.2
new and lier action. i peeston, perseawatic
most in the objgered:
near mystery their
noriminag. one cannot mou. "nowadays would opinion--stif shame--one who yet no vongually carrision force of
the same wilt becaurated justicer fear itself a sentimentst of self rare
vasonifar, le trustfory... "the justice in day in sslangeasy, heild and miseem, in which soncishment
hard, much such as altet dististives, other-a, and become still
something being all as the
fa
epoch 58
Epoch 1/1
200278/200278 [==============================] - 224s 1ms/step - loss: 1.3307
--- Generating with seed: " explanation, there is, strictly
speaking, neither unselfish"
------ temperature: 0.2
 explanation, there is, strictly
speaking, neither unselfish and the deatiss of the conscience of the desire of the and the spirit of the fact that the and the same spirit, and the spirit of the most diffirs of the spirit of the and in the spirit of the spirit, and the most spirit, the profound to the spirit of the sense of the good and diffired and the fact that the most constraint of the conscience of the spirit of the spirit of the fact of the conscienc
------ temperature: 0.5
nce of the spirit of the spirit of the fact of the conscience of the the sand
and the power and the world that the destruction of the one has more
will a sense of all the distance, there is not the higher only and interpretated that the unabine, in the nations of self-greatness
of the self-sense, which a most and noble and delicate and life, the consist of the german that any things, a perhaps be attain and little youth, in the antihhjsting casted, in the 
------ temperature: 1.0
attain and little youth, in the antihhjsting casted, in the germans, the least are so that the everencered one of our attained; as feels an inman religion of the taftive willingly religions and unsuter, it is lained by
any meats the prauseablous are
tajojer notional all and psychological situte which we have pretails of
taken the veitus, was not "will can have decresit? beyon loves in things cause of mode and of the beginned.,

. cease the huneme of the
hi
------ temperature: 1.2
 of mode and of the beginned.,

. cease the huneme of the
high, in life, in men: he could i will raceicctly speakce may dise?--ve paclo why-period,
loftarity of a deatis and puré
clase it is go of youth of dailints, the organization as wes, always or "woman,
and for elive lime, to
the masterian them hilt and divine
esprins.inabpclinty from thee.


1di
wis  eääit
with this passion pathings: think; so dactions he evitily in its "moral
past to purn inmatmecte
epoch 59
Epoch 1/1
200278/200278 [==============================] - 277s 1ms/step - loss: 1.3316
--- Generating with seed: "nd
wonderful task, in the carrying out of which all refined "
------ temperature: 0.2
nd
wonderful task, in the carrying out of which all refined to the states of the strength and the most here as it was a misundisib the same as a sort of the conduct to the spirit is the same states of the same the spirit is the same a sense of the sense of the still the same the spirit is a sort of the most and the same the states of the sense of the same as the same as the same an attempt as the sense of the exceptions and the same the same the sense of t
------ temperature: 0.5
sense of the exceptions and the same the same the sense of the same the saint as a man who is the fact the words of its own other, the experiences of the other man among the feeling of such as the present in the contempt a complete the superiorical present the same case of the world in the secret and through such a superfamisly to whole of all the more their strength of such a word in the belief of a man amer the stoon itself hos indifferently comparation 
------ temperature: 1.0
f a man amer the stoon itself hos indifferently comparation of the exceated unpuriosism, as fined the gavelly
colory--that the almost valueing ago for when one the nature, the act says false melat easily declople indignian, aval, like nothing rule woman has
doman ficuled), even prideent excete
good that the chassing
to give food faraticony--in the conduce, i believe what spose
given laugh ont-spassers, will something before schuminiss, which only withd in 
------ temperature: 1.2
sers, will something before schuminiss, which only withd in a hypothest lagilled: they once fragilizing bituen zquive limfortables as metaphysicss has though tocars. all concling, elowder there, he attain inrilise has relatb,
an cooists.
might know
apwarth catagefuc timedts of generation for conscious had innuits by those power,
comparaic,
such a people new--and profoutdd on the compulse os,ariarating is astrudgation wherever sought reta
at the "exercimera

The output shows that $T=0.5$ seems to work better for this model.

Conditional Language Models

The power of the Language Model formulation is realized when it is used to generate Conditional Language, which is defined as sentences that are generated in response to a context, such as an image, a video clip or a sentence in another language, as shown in Figure rnn79. This results in an image caption, a video description and a translation respectively.

In [103]:
#rnn79
nb_setup.images_hconcat(["DL_images/rnn79.png"], width=600)
Out[103]:

Some other examples of Conditional Language Models are shown in the table below.

In [105]:
#rnn80
nb_setup.images_hconcat(["DL_images/rnn80.png"], width=600)
Out[105]:

Conditional Language Models are created using a class of systems called Encoder-Decoder Systems. Figure EncDec shows the high level architecture of these systems, which consist of two parts:

  • Part 1 consists of a Neural Network model whose job is to process the Input Context and create a high level representation for it. This can be done using any one of the systems that we have discussed in this book, namely Dense Feed Forward networks, ConvNets or RNNs.
  • Part 2 consists of a Language Model which synthesizes a sentence in the target language, by using the representation from Part 1.
In [106]:
#EncDec
nb_setup.images_hconcat(["DL_images/rnn81.png"], width=600)
Out[106]:

Figure rnn66 show some details for two examples of Encoder-Decoder Systems:

  • Part (a) of the figure shows the case when the system is used for doing Machine Translation. The Input $(T_1,T_2,T_3)$ is a sentence in Language 1, which is transformed into its vector representation using a RNN (shown as the final state $Z_3$). This representation is then fed into the Language Model which outputs a translation $(X_1,X_2,X_3,X_4)$ in Language 2.

  • Part (b) of the figure shows the case when the system is used to generate captions for images. The image is first converted into a high level representation using a ConvNet, followed by the Language Model that generates the caption.

There are a number of commercially important applications for this system, including:

  • Machine Translation: The input corresponds to a sentence from Language A and the output is its translation into Language B.
  • Email Auto-Reply: The input corresponds to the contents of an email and the output is the appropriate reply to that email.
  • Document Summarization: The input corresponds to the words in a document and the output is a shorter summary of its content.
  • Question Answering Systems: These usually have two sets of inputs, for the document and Question respectively, while the output is the Answer.

One of the benefits of the Encoder-Decoder architecture is that the input and the output need not be of the same length. Before the advent of RNNs, this was a significant restriction for these type of systems. Indeed as the Caption Generation architecture will show, the two parts of the system need not be processing the same type of media! Later in this chapter we will show an example in which the input is a speech waveform and the output is its transcription.

In [107]:
#rnn66
nb_setup.images_hconcat(["DL_images/rnn66.png"], width=800)
Out[107]:

In the following two sections we get into the details of the Neural Machine Transmation and Image Captioning systems.

Neural Machine Translation

In [2]:
#rnn82
nb_setup.images_hconcat(["DL_images/rnn82.png"], width=800)
Out[2]:

Machine Translation is the process of taking a sentence from Language A as input, and generating its translation in Language B as the output. The traditional way of doing this was a Bayesian ML algorithm called Statistical Machine Translation (SMT). However in the last few years, Neural Machine Translation (NMT) systems have surpassed SMT in their accuracy, and as a result popular websites such as Google have replaced SMT with NMT in their production systems.

We will use the the Encoder-Decoder architecture shown in Figure rnn82 to do Machine Translation. It is designed to map a variable length input word sequence $T_i, i=1,...,L_{in}$ to a variable length output word sequence $X_i,i,...,L_{out}$.

The Training Phase for this model is shown in Part (a) of the figure. During this phase, the model accepts two input sequences, the sentence $T_1,T_2,T_3$ and its corresponding translation $X_1,X_2,X_3$. The latter sequence also serves as a target for training the model after it has been shisted to the right by one word (so that the target for a word $X_i$ is the next word in the sequence $X_{i+1}$..

During the Inference Phase, shown in Part (b) of the figure, the trained model is used to generate translations for inputs $(T_1,T_2,T_3)$, which are fed into the Encoder part of the model. The Decoder part of the model uses the final representation of the input to generate the translated sentence one word at a time, and at each stage the word generated in stage n serves as the input for stage n+1, which is known as Auto-Regression.

The following example taken from Chollet Chapter 11 uses the Encoder Decoder Transformer to do English to Spanish translation using a GRU based model. We start by downloading the dataset, creating a list each lement of which is an English sentence followed by its Spanish translation, appending a "start" and "end" tokens to the beginning and end of each Spanish sentence, and then storing the English-Spanish pairs in a list called text_pairs:

In [3]:
text_file = "/Users/subirvarma/handson-ml/datasets/spa-eng/spa.txt"
with open(text_file) as f:
    lines = f.read().split("\n")[:-1]
text_pairs = []
for line in lines:
    english, spanish = line.split("\t")
    spanish = "[start] " + spanish + " [end]"
    text_pairs.append((english, spanish))

Here is what a randomly selected sample from the text_pairs list looks like:

In [4]:
import random
print(random.choice(text_pairs))
("My sister's getting married.", '[start] Mi hermana se va a casar. [end]')

The elements of the text_pairs list are randomly shuffled, and then split into training, validation and test datasets.

In [ ]:
import random
random.shuffle(text_pairs)
num_val_samples = int(0.15 * len(text_pairs))
num_train_samples = len(text_pairs) - 2 * num_val_samples
train_pairs = text_pairs[:num_train_samples]
val_pairs = text_pairs[num_train_samples:num_train_samples + num_val_samples]
test_pairs = text_pairs[num_train_samples + num_val_samples:]

In this code block, the vectorization function for the English and Spanish texts are defined, using a maximum sequence length of 20 words per sentence, and a vocabulary size of 20,000 most frequently used words. Before doing this, we remove the special characters from the text, and convert all text to lowercase characters. The adapt commend creates a mapping of words in the vocabulary with their corresponding integer codes.

In [7]:
import tensorflow as tf
from tensorflow.keras import layers
import string
import re

strip_chars = string.punctuation + "¿"
strip_chars = strip_chars.replace("[", "")
strip_chars = strip_chars.replace("]", "")

def custom_standardization(input_string):
    lowercase = tf.strings.lower(input_string)
    return tf.strings.regex_replace(
        lowercase, f"[{re.escape(strip_chars)}]", "")

vocab_size = 15000
sequence_length = 20

source_vectorization = layers.TextVectorization(
    max_tokens=vocab_size,
    output_mode="int",
    output_sequence_length=sequence_length,
)
target_vectorization = layers.TextVectorization(
    max_tokens=vocab_size,
    output_mode="int",
    output_sequence_length=sequence_length + 1,
    #standardize=custom_standardization,
)
train_english_texts = [pair[0] for pair in train_pairs]
train_spanish_texts = [pair[1] for pair in train_pairs]
source_vectorization.adapt(train_english_texts)
print(random.choice(train_english_texts))
print(random.choice(train_spanish_texts))
target_vectorization.adapt(train_spanish_texts)
Who told you to give that to me?
[start] Es un trabajo muy ingrato. [end]

The main task of the following code is to create the training and validation datasets for the model. Note that the input into the model consists of the encoded English sentence (to be fed into the Encoder) followed by the encoded Spanish sentence (to be fed into the Decoder), while target consists of the Spanish sentence only (at the output of the Decoder). However note that in order to create the target, the Spanish sentence has to be shifted to the right by one word, so that each Spanish word in the input sequence is mapped to the next Spanish word in that sentence, in order to create the target sequence. This is accomplished in the format_dataset function. The tf.data.Dataset.from_tensor_slices function creates a list of pairs of English and Spanish sentences, which are then vectorized and formatted into the correct input and target tensors by means of the format_dataset function.

In [8]:
batch_size = 64

def format_dataset(eng, spa):
    eng = source_vectorization(eng)
    spa = target_vectorization(spa)
    return ({
        "english": eng,
        "spanish": spa[:, :-1],
    }, spa[:, 1:])

def make_dataset(pairs):
    eng_texts, spa_texts = zip(*pairs)
    eng_texts = list(eng_texts)
    spa_texts = list(spa_texts)
    dataset = tf.data.Dataset.from_tensor_slices((eng_texts, spa_texts))
    dataset = dataset.batch(batch_size)
    dataset = dataset.map(format_dataset)
    return dataset.shuffle(2048).prefetch(16).cache()

train_ds = make_dataset(train_pairs)
val_ds = make_dataset(val_pairs)
In [9]:
for inputs, targets in train_ds.take(1):
    print(f"inputs['english'].shape: {inputs['english'].shape}")
    print(f"inputs['spanish'].shape: {inputs['spanish'].shape}")
    print(f"targets.shape: {targets.shape}")
inputs['english'].shape: (64, 20)
inputs['spanish'].shape: (64, 20)
targets.shape: (64, 20)

GRU-based encoder

As shown below, the Encoder module uses a bi-directional GRU with a hidden state of size 1024 and 20 (= sequence length) stages (the latter quantity is not specified in the code below, but Keras infers it from the shape of the Input tensor.

The output of the Encoder module consist of the final hidden states of the forward and backward GRUs, which are then added together to create the final output.

In [18]:
from tensorflow import keras
from tensorflow.keras import layers

embed_dim = 256
latent_dim = 1024

source = keras.Input(shape=(None,), dtype="int64", name="english")
x = layers.Embedding(vocab_size, embed_dim, mask_zero=True)(source)
encoded_source = layers.Bidirectional(
    layers.GRU(latent_dim), merge_mode="sum")(x)

GRU-based decoder and the end-to-end model

As in the Encoder, the Decoder uses a GRU with a hidden state of size 1024. The GRU cell in its Decoder first stage is initialized using the encoded_source tensor from the last stage of the Encoder. Since the return_sequences flag is set to TRUE, the Hidden State vectors in each of its stages is sent to a Dense Feed Forward Layer with vocab_size nodes in order to predict the next word in the sequence (which is then compared with the target word during Training, in order to generate the error signal).

The Encoder and Decoder modules are combined together to create the full Encoder-Decoder model called seq2seq_rnn, with two input tensors (source, past_target) and a single output tensor target_next_step.

In [19]:
past_target = keras.Input(shape=(None,), dtype="int64", name="spanish")
x = layers.Embedding(vocab_size, embed_dim, mask_zero=True)(past_target)
decoder_gru = layers.GRU(latent_dim, return_sequences=True)
x = decoder_gru(x, initial_state=encoded_source)
x = layers.Dropout(0.5)(x)
target_next_step = layers.Dense(vocab_size, activation="softmax")(x)
seq2seq_rnn = keras.Model([source, past_target], target_next_step)

The model summary shows that it has a total of 42,554,912 parameters, of which 20.5 million are in the dense layer at the output of the Decoder, and just over 10 million are in the Embedding layers in the Encoder and Decoder. The two GRUs themselves account for about 13 million parameters.

In [20]:
seq2seq_rnn.summary()
Model: "model_7"
__________________________________________________________________________________________________
Layer (type)                    Output Shape         Param #     Connected to                     
==================================================================================================
english (InputLayer)            [(None, None)]       0                                            
__________________________________________________________________________________________________
spanish (InputLayer)            [(None, None)]       0                                            
__________________________________________________________________________________________________
embedding_8 (Embedding)         (None, None, 256)    5120000     english[0][0]                    
__________________________________________________________________________________________________
embedding_9 (Embedding)         (None, None, 256)    5120000     spanish[0][0]                    
__________________________________________________________________________________________________
bidirectional (Bidirectional)   (None, 1024)         7876608     embedding_8[0][0]                
__________________________________________________________________________________________________
gru_1 (GRU)                     (None, None, 1024)   3938304     embedding_9[0][0]                
                                                                 bidirectional[0][0]              
__________________________________________________________________________________________________
dropout (Dropout)               (None, None, 1024)   0           gru_1[0][0]                      
__________________________________________________________________________________________________
dense_7 (Dense)                 (None, None, 20000)  20500000    dropout[0][0]                    
==================================================================================================
Total params: 42,554,912
Trainable params: 42,554,912
Non-trainable params: 0
__________________________________________________________________________________________________

Training our recurrent sequence-to-sequence model

In [13]:
seq2seq_rnn.compile(
    optimizer="rmsprop",
    loss="sparse_categorical_crossentropy",
    metrics=["accuracy"])
seq2seq_rnn.fit(train_ds, epochs=15, validation_data=val_ds)
Epoch 1/15
1302/1302 [==============================] - 4549s 3s/step - loss: 1.6484 - accuracy: 0.4164 - val_loss: 1.3216 - val_accuracy: 0.5033
Epoch 2/15
1302/1302 [==============================] - 4510s 3s/step - loss: 1.3277 - accuracy: 0.5258 - val_loss: 1.1627 - val_accuracy: 0.5666
Epoch 3/15
1302/1302 [==============================] - 4577s 4s/step - loss: 1.1860 - accuracy: 0.5755 - val_loss: 1.0826 - val_accuracy: 0.5969
Epoch 4/15
1302/1302 [==============================] - 4566s 4s/step - loss: 1.0971 - accuracy: 0.6062 - val_loss: 1.0501 - val_accuracy: 0.6149
Epoch 5/15
1302/1302 [==============================] - 4569s 4s/step - loss: 1.0493 - accuracy: 0.6305 - val_loss: 1.0341 - val_accuracy: 0.6244
Epoch 6/15
1302/1302 [==============================] - 4600s 4s/step - loss: 1.0189 - accuracy: 0.6486 - val_loss: 1.0302 - val_accuracy: 0.6289
Epoch 7/15
1302/1302 [==============================] - 4579s 4s/step - loss: 0.9997 - accuracy: 0.6616 - val_loss: 1.0314 - val_accuracy: 0.6321
Epoch 8/15
1302/1302 [==============================] - 4591s 4s/step - loss: 0.9853 - accuracy: 0.6727 - val_loss: 1.0316 - val_accuracy: 0.6356
Epoch 9/15
1302/1302 [==============================] - 4593s 4s/step - loss: 0.9762 - accuracy: 0.6800 - val_loss: 1.0364 - val_accuracy: 0.6372
Epoch 10/15
1302/1302 [==============================] - 8982s 7s/step - loss: 0.9690 - accuracy: 0.6853 - val_loss: 1.0380 - val_accuracy: 0.6381
Epoch 11/15
1302/1302 [==============================] - 4560s 4s/step - loss: 0.9640 - accuracy: 0.6896 - val_loss: 1.0409 - val_accuracy: 0.6387
Epoch 12/15
1302/1302 [==============================] - 4552s 3s/step - loss: 0.9602 - accuracy: 0.6924 - val_loss: 1.0432 - val_accuracy: 0.6393
Epoch 13/15
1302/1302 [==============================] - 4645s 4s/step - loss: 0.9570 - accuracy: 0.6952 - val_loss: 1.0453 - val_accuracy: 0.6403
Epoch 14/15
1302/1302 [==============================] - 4671s 4s/step - loss: 0.9567 - accuracy: 0.6961 - val_loss: 1.0468 - val_accuracy: 0.6392
Epoch 15/15
1302/1302 [==============================] - 4686s 4s/step - loss: 0.9566 - accuracy: 0.6968 - val_loss: 1.0476 - val_accuracy: 0.6396
Out[13]:
<keras.callbacks.History at 0x1560275c0>

We are now going to use the trained model to do English to Spanish translation. We set up the inference models for both the Encoder and the Decoder sub-systems. The Encoder inference model is the same as was defined for the training phase. The Decoder inference model on the other hand is going to be run on a stage by stage basis, such that the input into a stage is the same as the output from the previous stage, i.e., the Decoder is run in the Auto-Regressive mode.

Before the model can be run, we create a dictionary which maps each of the Spanish words with its corresponding index. The Spanish sentence is generated one words at a time, starting with the word 'start' and ending when the word 'end' is sampled. During each stage the model predicts the probabilities of the 20,000 possible Spanish words. The output probabilities for the $i^{th}$ stage are converted into a word, by first choosing the word index that has the maximum probability, and then using the lookup dictionary to convert it into its corresponding alpha-numeric character.

In [14]:
import numpy as np
spa_vocab = target_vectorization.get_vocabulary()
spa_index_lookup = dict(zip(range(len(spa_vocab)), spa_vocab))
max_decoded_sentence_length = 20

def decode_sequence(input_sentence):
    tokenized_input_sentence = source_vectorization([input_sentence])
    decoded_sentence = "[start]"
    for i in range(max_decoded_sentence_length):
        tokenized_target_sentence = target_vectorization([decoded_sentence])
        next_token_predictions = seq2seq_rnn.predict(
            [tokenized_input_sentence, tokenized_target_sentence])
        sampled_token_index = np.argmax(next_token_predictions[0, i, :])
        sampled_token = spa_index_lookup[sampled_token_index]
        decoded_sentence += " " + sampled_token
        if sampled_token == "[end]":
            break
    return decoded_sentence

test_eng_texts = [pair[0] for pair in test_pairs]
for _ in range(20):
    input_sentence = random.choice(test_eng_texts)
    print("-")
    print(input_sentence)
    print(decode_sequence(input_sentence))
-
Tom doesn't know anything about Australia.
[start] tom no sabe nada de australia end             
-
He was easily deceived and gave her some money.
[start] Él se [UNK] y le he [UNK] algo de dinero end         
-
The patient fainted at the sight of blood.
[start] el profesor se puso al lado de la [UNK] de la [UNK] end       
-
I don't want to die yet.
[start] no quiero todavía [UNK] end               
-
Is it about ten o'clock?
[start] ¿está a diez minutos end               
-
I just don't like it.
[start] lo que no me gusta end              
-
What do you want to protect us from?
[start] ¿qué quieres [UNK] de nosotros end              
-
Take the bags upstairs.
[start] [UNK] las usted de las cinco end             
-
There's a fine line between what's acceptable and what's unacceptable.
[start] hay una gran qué es una [UNK] entre lo que y es lo [UNK] end     
-
This hat is too small for me.
[start] este sombrero es muy grande para mí end            
-
Would you prefer to speak in English?
[start] hablar a hablar inglés end               
-
Who are you going to vote for?
[start] ¿a quién vas a a [UNK] end             
-
According to the newspapers, he will be here today.
[start] para él hoy él se la aquí para estar hoy end         
-
A ball hit the back of my head while I was playing soccer.
[start] una [UNK] de la puerta se me [UNK] cuando se [UNK] el dolor de cabeza end    
-
Tom grinds his teeth in his sleep.
[start] tom se [UNK] los ojos en su solo end           
-
The system is rigged.
[start] el a está qué está [UNK] end             
-
Tom has his own room.
[start] tom tiene su habitación end               
-
I know I can make it.
[start] sé que puedo hacerlo end               
-
Air is mainly composed of nitrogen and oxygen.
[start] el [UNK] está [UNK] por el tiempo y de la [UNK] end        
-
The people voted in November.
[start] la gente está en [UNK] end              

Image Captioning

In [84]:
#rnn62
nb_setup.images_hconcat(["DL_images/rnn62.png"], width=800)
Out[84]:

The Machine Translation application of the Encoder-Decoder architecture featured the same media type on both sides. In this section we describe an application in which two different media are involved: An image on the encoding side and its corresponding description (or caption) in a language such as English, on the decoding side. Creating an image description involves the following tasks:

  • The description should capture the most significant objects in the image.
  • It should express how these objects relate to each other, as well as their attributes and activities they are involved in.
  • This semantic knowledge has to be converted into a natural language, which implies the use of a Language Model to do so.

This is an inherently difficult problem to solve, and before the advent of Encoder-Decoder systems, was typically approached by stitching together the solution for the object recognition problem and filling in pre-existing caption templates. These type of systems were rigid in their text generation, and were demonstrated to work well only in limited domains such as traffic scenes or sports. The Encoder-Decoder based solution on the other hand, was inspired by the Machine Translation systems described earlier, and uses a single joint model that takes an Image $I$ as input, and produces a caption $S$ that maximizes the likelihood $p(S|I)$.

Figure rnn62 shows a proposed design for solving the problem:

  • The Encoder part of the system is implemented using a ConvNet which generates a rich representation of the input image by embedding it in a fixed-length vector. The last Dense layer that precedes the Logit layer is used as the embedded image representation vector. The ConvNet is pre-trained on the image classification task before it is inserted into the Encoder-Decoder network, and then trained again end-to-end for the image captioning task.
  • The fixed length vector representing the input image is fed into the Decoder part of the system as shown in the figure. Note that the image is fed into the LSTM only once in the beginning, which actually works better than if the image were to be fed at every step.
  • The Language Model in the Decoder works exactly as in the Machine Translation example. During training the entire caption is fed into the Decoder, and Backprop done on the basis of error signals. During inference, the decoder generated words one at a time until it reaches the end of sentence marker.

Figure rnn83 shows some examples of captions generated by a model that was trained on 330,000 images in the Microsoft CoCo dataset.

In [16]:
#rnn83
nb_setup.images_hconcat(["DL_images/rnn83.png"], width=800)
Out[16]:

The Attention Mechanism

The Attention Mechanism was originally proposed in the context of Encoder-Decoder systems, but since then has been expanded to other kinds of neural networks. Its most significant impact on Deep Learning has been the role it played in the discovery of Transformer Networks (the paper that proposed Transformers was titled, "Attention Is All You Need"!). In this section we describe this technique in the context of Machine Translation, Image Captioning and Speech Transcription. In the next chapter we will describe Attention as it is used in Transformer Networks.

In order to understand why Attention is useful, lets consider the example of an Encoder-Decoder based Machine Translation system of the type described in the previous section. A central premise of this architecture is that the system is able to compress sufficient information about the variable size Input Sequence within the final Hidden State of the Encoder part of the network. This information is then used to generate the entire output sequence without any further assistance from the Encoder. However, as the Input Sequence grows, it begs the question of how efficiently can variable size input information be captured within a fixed number of nodes in the final Hidden State. In practice it has been observed that as the size of the input sequence grows, especially if it is larger than the size of the sentences used in the Training Data, the performance of the system detoriates rapidly. This points to an architectural weakness, which needs to be addressed. The Attention Mechanism was designed to address this issue since it enables the Decoder to focus on specific stages of the Encoder network while doing its decoding.

In order to motivate the design of the Attention Mechanism, consider Figure rnn84. Part (a) of this figure shows a possible way in which the context information in the final stage of the Encoder Network can be supplied to all the Decoder stages. In practice this desigfn sometimes works better than the vanilla Encoder-Decoder system, but it can be further enhanced, as shown in Part (b) of the figure. This figure shows a system in which ALL the stages in the Encoder Network are used to contribute to the Context information which is done by adding or concatenating the vectors in the Encoder's Hidden States together. The Attention Mechanism builds on this design and improves it further.

In [22]:
#rnn84
nb_setup.images_hconcat(["DL_images/rnn84.png"], width=600)
Out[22]:

The design shown in Part (b) of Figure rnn84 suffers from the issue that when trying to generate the next word in its decoder, it takes into consideration the information in all of the Encoder stages. This is in contrast to how humans would perform a similar task: For example if we are asked to translate a sentence from English to French, we only consider local relevant words in the English sentence when trying to generate its French translation. This strategy can be mimicked as shown in Figure rnn64. Once again the system takes all the stages in the Encoder into consideration when generating the final context, but now it pays a different amount of attention to each word, as captured by the multipliers $a_1,a_2,a_3$ (these are normalized to one). For example when the system generates the first word $X_2$, it may pay more attention to the vector $Z_1$, which is captured by having $a_1$ being larger than $a_2$ and $a_3$. This focus shifts when generating successive words in the translation.

In [60]:
#rnn64
nb_setup.images_hconcat(["DL_images/rnn64.png"], width=600)
Out[60]:

Figure rnn65 shows the details of how Attenton is computed. The computations in the Encoder part of the network are unchanged from before, and result in the Hidden State vectore $(Z_1,Z_2,Z_3)$ in response to the input $(T_1,T_2,T_3)$. The computations for the Decoder part proceed as follows:

  • Lets focus on Part(b) of the figure, which shows the computations for generating the second output $X_3$. We compute the Attention scores $(e^1_1,e^1_2,e^1_3)$ by taking the inner product of the previous decoder state $H_1$ with each of the encoder states $(Z_1, Z_2, Z_3)$. The reasoning behind this operation is that the state $H_1$ contains information about which part of the Encoder network the decoding should be focusing on, and the inner product quantifies this. The Attention Scores are then transformed into weights $(a^1_1,a^1_2,a^1_3)$ between 0 and 1 by using the Softmax function, and these are used to create a Context Vector $B_1$ whose value is computed by $$ B_1 = a^1_1Z_1 + a^1_2 Z_2 + a^1_3 Z_3$ $$ The Context Vector $B_1$ encodes the most useful information in the Hidden States of the Encoder network, which is relevant to generating the next output $X_3$. As shown in the figure, along with $H_1$ and $X_2$, $B_1$ is also fed into the second stage of the Decoder to generate the next state $H_2$ (and subsequently $X_3$).

  • Part (a) of the figure shows the generation of $X_2$. The computations are the same as for $X_3$, except for the fact that since there is no prior decoder state to do the inner product with the encoder states, the last encoder state $Z_3$ is used instead.

  • Part (c) of the figure shows the generation of $X_4$, which is exactly the same as that for $X_3$.

Using recently established terminology, when generating the output $X_i$, the decoder state $H_{i-1}$ is called the Query, while the encoder states $(Z_1,Z_2,Z_3)$ are called the Keys. By taking the inner product of the Query with each Key, the system is trying to identify the Keys that are most similar to the Query, and the corresponding encoder Hidden State is assigned more weight.

In the original formulation of Attention, the Context Vector is computed by taking the weighted sum of the Key values $(Z_1,Z_2,Z_3)$. In later formulations of Attention, the Context Vector is computed using another set of vectors $(A_1,A_2,A_3)$ which are referred to as Values, and this is known as the Key-Value formulation of Attention. In both the cases the Keys and Values are derived from the Encoder Hidden States using matrix transformations. We will cover Key-Value Attention when discussing Transformers.

In [23]:
#rnn65
nb_setup.images_hconcat(["DL_images/rnn65.png"], width=1000)
Out[23]:

One of the benefits of using Attention is that gives insights into the workings of the model. Figure rnn85 plots the Attention Vector ${a^i_j}$ on a row by row basis when doing translation from English to French. The grayscale squares are shaded so that $a^i_j=1$ is white and 0 is black. One can clearly see the Attention shifting from left to right as the translation proceeds. Also for cases in which the order of words are different in the two languages, for example 'European Economic' vs 'economique europeenne', we can see that Attention is correctly focused on the correct English word while finding its French translation.

In [25]:
#rnn85
nb_setup.images_hconcat(["DL_images/rnn85.png"], width=1000)
Out[25]:

In addition to the Inner Product, there are other ways in which Attention Scores can be computed:

  • Multiplicative Attention: The Attention Score is computed using $$ e^j_i = H_j^T M Z_i $$ where $H_j$ is the Query, $Z_i$ is the Key and $M$ is a parameter matrix whose values are computed as part of the training.

  • Additive Attention: The Attention Score is computed using $$ e^j_i = v^T \tanh(MH_j + NZ_i) $$ where $M$ and $N$ are parameter matrices and $v$ is a parameter vector.

Additive and Multiplicative Attention are similar in complexity, although Multiplicative Attention is faster and more space-efficient in practice as it can be implemented more efficiently using matrix multiplication. Both variants perform similar for small dimensionality of the decoder states, but Additive Attention performs better for larger dimensions. One way to mitigate this for multiplicative Attention is to divide the Attention Score by $1\over{\sqrt{d}}$ where $d$ is the dimension of the Query Vector (this is commonly done in Transformers).

Image Captioning with Attention

In [51]:
#rnn61
nb_setup.images_hconcat(["DL_images/rnn61.png"], width=1000)
Out[51]:

Xu et.al. (2015) applied the Attention Mechanism to the Image Captioning problem and obtained excellent results with a system that they called "Show, Attend and Tell". At a high level, the Attention Mechanism generates the caption by sequentially focusing on different parts of the image as the description progresses, and generating the word that is most relevant to the attended part (see Figure rnn13 for examples). We now go over the steps that are needed to apply this algorithm.

We first need to choose the vectors that will serve as the Keys in the Encoder. This is a critical design decision since it determines how the system will focus its attention on specific parts of the input image. Recall that in the Image Captioning systems discussed earlier, the image representation is conveyed by the vector formed by the last Dense layer (before the Logit layer) which unfortunately doesn't convey any local information about the image. An ingenious way in which this problem was solved is shown in Part (a) of Figure rnn61: Consider the last Convolutional Layer in the system of dimensions $H\times W\times C$, so that it contains $H\times W$ Activation vectors each of depth $C$. Each of these vectors contains local information about the image, and can serve as the Key value. Part (b) of the figure shows the operation of the Attention Layer. The Query vactors are set to the successive Hidden States in Decoder just as in Machine Translation.

As shown in Figure rnn13, the attention mechanism works quite well in practice. In each pair of images, the image on the right shows the area in the photo on which attention is being focussed on (by lighting up the picture in proportion to the Attention Weights). The underlined word in the generated caption is the corresponding word that was generated when Attention was focussed in a particular part of the picture, and it can be seen there is a very good correspondence between the word and the image under focus.

In [29]:
#rnn13
nb_setup.images_hconcat(["DL_images/rnn13.png"], width=600)
Out[29]:

Speech Transcription with Attention

In [30]:
#rnn34
nb_setup.images_hconcat(["DL_images/rnn34.png"], width=600)
Out[30]:

Speech Transcription or Recognition is the process of converting the sound waveform from a spoken language into text. It is a commercially important problem, for obvious reasons, and over the years a tremenduous amount of effort has gone into designing systems that can perform this task well. The process by which a speech waveform is converted into vectors that can be fed into a speech recognition model is shown in Figure rnn34 and consists of the following steps:

  • The speech waveform is segmented into smaller pieces of about 20 ms each.
  • Each of these segments is then processed using a Fast Fourier Transform (FFT) to extract its spectral power components. These components, organized by frequency, constitute the feature vector input into speech recognition models.

The first Speech Recognition models were built in the 1970s using a generative probabilistic model called GMM-HMM (stands for Gaussian MultiMode-Hidden Markov Model). The GMM part of the model modeled the probability distribution of the speech feature vectors, while the HMM part modeled the sequence information. This model was fairly complex, and made a number of assumptions about the underlying probability distributions. During the late 1990s this model was replaced by a NN-HMM model in which a Dense Feed Forward Network was used instead of the GMM. This led to an improvement in performance, and also allowed the system to start using less processed input signals.

Speech Transcription can be classified as a Pattern Recognition problem, however the patterns now occur in time rather than over space. From this point of view, RNNs are the perfect tool to solve the Speech Transcription problem since they are designed to recognize patterns in sequences that occur in time. Figure rnn35 shows a RNN based speech recognition model with speech feature vectors as its input. The application of RNNs to this problem did not work initially for the following two reasons:

  • The difficulty in training RNNs.

  • Speech Transcription systems exhibit a big difference in the input and the output sequence sizes. This is due to the fact that the input sequence consists of vectors generated from filtered features of the audio waveform, which may be generated every 10 or 20 ms; while the corresponding output sequence may consist of just a few words. Until recently RNN architectures could not handle this disparity in input and output sequence sizes.

Both of these problems have been solved in recent years: The training problem was solved with the use of LSTMs and GRUs, while the sequence mis-match problem was solved by using the Encoder-Decoder architectures since they are designed to handle inputs and output sequences of differing lengths.

In [31]:
#rnn35
nb_setup.images_hconcat(["DL_images/rnn35.png"], width=600)
Out[31]:

Figure rnn14 shown an architecture based on the Encoder-Decoder model for doing Speech Transcription. This system was designed by the Google Brain team and is called Listen, Attend and Spell (LAS). Unlike the older models, all aspects of the speech recognition system, including acoustic, pronunciation and language models, are captured within a single framework. This system learns to transcribe an audio signal into a word sequence, one character at a time. The Encoder part of the system is called a Listener, and the Decoder part is called a Speller and these are described next.

In [32]:
##rnn14
nb_setup.images_hconcat(["DL_images/rnn14.png"], width=600)
Out[32]:

The Listen Subsystem: The Listen system, which is the Encoder part of the network, uses a Bi-directional LSTM (BLSTM) with a pyramidal structure and encodes speech signals into higher level representations (see bottom half of Figure rnn14). The reason for this design is the following: Unlike other Encoder-Decoder systems, Speech Recognition systems exhibit a big difference in the input and the output sequence sizes due to the sequence mismatch problem. The Google Brain team observed that if the Encoder-Decoder architecture is implemented without the pyramidal structure, then it converges slowly and produced inferior results even after a training period lasting one month. This may be due to the fact that the Decoder system finds it difficult to extract the relevant information from the large number of input steps. The pyramidal BLSTM addresses this problem by reducing the time resoluton by a factor of 2 with each layer. Since the Encoder uses a 4 layer stack, it reduces the time resolution by a factor of 8 which allows the Attention Model to extract the relevant information from a smaller number of time steps.

The Attend and Spell Subsystem: At each step, the Speller uses it hidden state $Z_t$ to guide an Attention Mechanism to compute a Context Vector $B_t$ from the Listener's encoded higher level features $\{h_1,...,h_{L_{in}}\}$ which are set to the top level Hidden State vector (see top half of Figure rnn14). The details of the computation of the Attention Context function are as described earlier in this chapter. It uses this Context Vector to update its internal state as well as to predict the next character in the output sequence.

A recent paper has extended the "Listen, Attend and Spell"" model to a system that also incorporates lip reading (see Figure rnn15). This system, called "Listen, Watch, Attend and Spell" has two Encoders feeding the Decoder: Encoder 1 (called "Listen") processes the sound waveform and produces the sound Context Set vectors $o^s$. The new Encoder 2 (called "Watch") processes a video of the person talking. The Watch system consists of a ConvNet module based on VGGNet that generates image features for every input time step. These are then fed into a LSTM that produces the video Context Set vectors $o^v$. The Spell module then uses an Attention model that combines the information in both sound and video Context Sets, as shown in the figure. This system is capable of operating with just the Listen module, or with just the Watch module, or with both these modules. Indeed the researchers discovered that the output word error rate decreased significantly when the Watch module was used in addition to the Listen module. The Lip Reading performance with only the Watch module in operation, surpassed the performance of professional lip readers.

In [26]:
##rnn15
nb_setup.images_hconcat(["DL_images/rnn15.png"], width=600)
Out[26]:

References and Slides