OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

I do not understand how to solve this error message

  • Thread starter Thread starter KNine
  • Start date Start date
K

KNine

Guest
Code:
import random
import numpy as np
import tensorflow as tf
from keras import layers
from keras import models
from keras import optimizers

filepath = tf.keras.utils.get_file('shakespeare.txt',
                                   'https://storage.googleapis.com/download.tensorflow.org/data/shakespeare.txt')

text = open(filepath, 'rb').read().decode(encoding='utf-8').lower()

text = text[300000:800000]

characters = sorted(set(text))

char_to_index = dict((c, i) for i, c in enumerate(characters))  
index_to_char = dict((i, c) for i, c in enumerate(characters))  

SEQ_LENGTH = 40 
STEP_SIZE = 3  

sentences = []
next_characters = []

for i in range(0, len(text) - SEQ_LENGTH, STEP_SIZE):
    sentences.append(text[i: i + SEQ_LENGTH])
    next_characters.append(text[i: i + SEQ_LENGTH])

x = np.zeros((len(sentences), SEQ_LENGTH, len(characters)), dtype=np.bool_)
y = np.zeros((len(sentences), len(characters)), dtype=np.bool_)

for i, sentence in enumerate(sentences):
    for t, character in enumerate(sentence):
        x[i, t, char_to_index[character]] = 1
    y[i, char_to_index[next_characters[i]]] = 1

model = models.Sequential()
model.add(layers.LSTM(128, input_shape=(SEQ_LENGTH, len(characters))))  
model.add(layers.Dense(len(characters)))
model.add(layers.Activation('softmax'))

model.compile(loss='categorical_crossentropy', optimizer=optimizers.RMSprop(lr=0.01))

model.fit(x, y, batch_size=256, epochs=4)

model.save('textgenerator.model')

When I am running this code, it is giving me the fallowing error: "Process finished with exit code 132 (interrupted by signal 4: SIGILL)." I was fallowing the tutorial by NeuralNine:

What neural Nine got
<pre><code>import random
import numpy as np
import tensorflow as tf
from keras import layers
from keras import models
from keras import optimizers

filepath = tf.keras.utils.get_file('shakespeare.txt',
'https://storage.googleapis.com/download.tensorflow.org/data/shakespeare.txt')

text = open(filepath, 'rb').read().decode(encoding='utf-8').lower()

text = text[300000:800000]

characters = sorted(set(text))

char_to_index = dict((c, i) for i, c in enumerate(characters))
index_to_char = dict((i, c) for i, c in enumerate(characters))

SEQ_LENGTH = 40
STEP_SIZE = 3

sentences = []
next_characters = []

for i in range(0, len(text) - SEQ_LENGTH, STEP_SIZE):
sentences.append(text[i: i + SEQ_LENGTH])
next_characters.append(text[i: i + SEQ_LENGTH])

x = np.zeros((len(sentences), SEQ_LENGTH, len(characters)), dtype=np.bool_)
y = np.zeros((len(sentences), len(characters)), dtype=np.bool_)

for i, sentence in enumerate(sentences):
for t, character in enumerate(sentence):
x[i, t, char_to_index[character]] = 1
y[i, char_to_index[next_characters]] = 1

model = models.Sequential()
model.add(layers.LSTM(128, input_shape=(SEQ_LENGTH, len(characters))))
model.add(layers.Dense(len(characters)))
model.add(layers.Activation('softmax'))

model.compile(loss='categorical_crossentropy', optimizer=optimizers.RMSprop(lr=0.01))

model.fit(x, y, batch_size=256, epochs=4)

model.save('textgenerator.model')
</code></pre>
<p>When I am running this code, it is giving me the fallowing error: "Process finished with exit code 132 (interrupted by signal 4: SIGILL)."
I was fallowing the tutorial by NeuralNine: <a href="
" rel="nofollow noreferrer">
</a></p>
<p><a href="https://i.sstatic.net/j6J5yVFd.png" rel="nofollow noreferrer">What neural Nine got</a></p>
 
Top