title: BaseCollectiveExecutor::StartAbort Out of range: End of sequence
body: <p>I'm new to python so I was following a tutorial for a chatbot (which, judging by the amount of errors I had to deal with and how many other people appeared to struggle with it on this site, wasn't the greatest.). It used tflearn and (after a lot of troubleshooting) worked perfectly at first but I wanted to update tensorflow and everything to the most recent versions so with some more help from here I switched it to keras. After a whole lot more troubleshooting it worked but there were warnings between the input and the output. I managed to get rid of one of the warnings with tf logging set verbosity but the other won't go away. </p>
  
  <p>2020-03-23 09:43:55.050983: W tensorflow/core/common_runtime/base_collective_executor.cc:217] BaseCollectiveExecutor::StartAbort Out of range: End of sequence
           [[{{node IteratorGetNext}}]]</p>
  
  <p>my code</p>
  
  <pre><code>import nltk
  from nltk.stem.lancaster import LancasterStemmer
  stemmer = LancasterStemmer()
  
  import numpy
  import tensorflow
  tensorflow.compat.v1.logging.set_verbosity(tensorflow.compat.v1.logging.ERROR)
  import tensorflow.keras
  import random
  import json
  import pickle
  
  with open("C:\\Users\\School\\Documents\\python\\AI\\VIVA.json") as file:
      data = json.load(file)
  
  words = []
  labels = []
  docs_x = []
  docs_y = []
  
  for intent in data["intents"]:
      for pattern in intent["patterns"]:
          wrds = nltk.word_tokenize(pattern)
          words.extend(wrds)
          docs_x.append(wrds)
          docs_y.append(intent["tag"])
  
          if intent["tag"] not in labels:
              labels.append(intent["tag"])
  
  words = [stemmer.stem(w.lower()) for w in words if w != "?"]
  words = sorted(list(set(words)))
  labels = sorted(labels)
  
  training = []
  output = []
  
  out_empty = [0 for _ in range(len(labels))]
  
  for x, doc in enumerate(docs_x):
      bag = []
  
      wrds = [stemmer.stem(w) for w in doc]
  
      for w in words:
          if w in wrds:
              bag.append(1)
          else:
              bag.append(0)
      output_row = out_empty[:]
      output_row[labels.index(docs_y[x])] = 1
  
      training.append(bag)
      output.append(output_row)
  
  training = numpy.array(training)
  output = numpy.array(output)
  
  model = tensorflow.keras.Sequential([
      tensorflow.keras.layers.Dense(8, input_shape=(len(training[0]),)),
      tensorflow.keras.layers.Dense(8),
      tensorflow.keras.layers.Dense(len(output[0]), activation="softmax"),
  ])
  
  model.compile(optimizer="adam", loss="categorical_crossentropy", metrics=["accuracy"])
  model.fit(training, output, epochs=150, batch_size=None)
  
  def bag_of_words(s, words):
      bag = [0 for _ in range(len(words))]
  
      s_words = nltk.word_tokenize(s)
      s_words = [stemmer.stem(word.lower()) for word in s_words]
  
      for se in s_words:
          for i, w in enumerate(words):
              if w == se:
                  bag[i] = 1
  
      return numpy.array(bag)
  
  def chat():
      print("Ready! Type quit to leave.")
      while True:
          inp = input("&gt;&gt;&gt;")
          if inp.lower() == "quit":
              break
  
          results = model.predict([[bag_of_words(inp, words)]])
          results_index = numpy.argmax(results)
          tag = labels[results_index]
  
          for tg in data["intents"]:
              if tg['tag'] == tag:
                  responses = tg['responses']
  
          print(random.choice(responses))
  
  chat()
  </code></pre>
  
  <p>the json is a dictionary in this format</p>
  
  <pre><code>{"intents": [
          {"tag": "greeting",
           "patterns": ["hi", "hey", "is anyone there?", "hello", "good day", "whats up", "sup", "Viv", "VIVA"],
           "responses": ["Hello!", "Hi!", "Hey!"],
           "context_set": ""
         }
    ]
  }
  </code></pre>
  
  <p>I know there are lots of answers for this error on here but none of the solutions work with what I'm doing. I've tried everything I've seen but as I'm not using tf.data or anything nothing's working. Sorry if I've done anything wrong with formatting or anything I just made this account to ask this question cause I'm a really desperate hs student and it's taking up a lot of my time when I should really be doing classes.</p>