title: Python: Problem fitting the word2vec embeddings into Keras Sequential Model
body: <p>I have a very simple Sequential Model:</p>
  <pre><code>embedding_size = 100
  
  model = keras.Sequential([
      keras.layers.Flatten(input_shape=(embedding_size,)),
      keras.layers.Dense(200, activation='relu'), 
      keras.layers.Dense(50, activation='relu'),
      keras.layers.Dense(4, activation='softmax')
  ])
  adam=keras.optimizers.Adam(learning_rate=0.001)
  model.compile(optimizer=adam,
                loss=[&quot;categorical_crossentropy&quot;],
                metrics=['accuracy'])
  
  model.summary()
  </code></pre>
  <p><a href="https://i.stack.imgur.com/dLXTv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dLXTv.png" alt="Model" /></a></p>
  <p>For input I have word2vec encoded vectors of size 1x100 for each sentence.</p>
  <p>Sample input is like this:</p>
  <p><a href="https://i.stack.imgur.com/odXAb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/odXAb.png" alt="Input" /></a></p>
  <p>This means, sentence 0 has the above mentioned vector. Corpus length is 9600 hence train_x is a list of size 9600.</p>
  <p>train_y is a simple hot_encoded labels class as shown below:</p>
  <p><a href="https://i.stack.imgur.com/oJr2N.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oJr2N.png" alt="Labels" /></a></p>
  <p>Problem occurs when I try to fit:</p>
  <pre><code>model.fit(train_x, 
            train_y, 
            epochs= 10, 
            batch_size= 50, 
            verbose=1, 
            shuffle=True,
            validation_data=(val_x, val_y))
  </code></pre>
  <p>Exception:</p>
  <p>ValueError: Failed to find data adapter that can handle input: (&lt;class 'list'&gt; containing values of types {&quot;&lt;class 'NoneType'&gt;&quot;, &quot;&lt;class 'numpy.ndarray'&gt;&quot;}), &lt;class 'numpy.ndarray'&gt;</p>
  <p>Complete stack trace is:</p>
  <pre><code>---------------------------------------------------------------------------
  ValueError                                Traceback (most recent call last)
  /Users/raffaysajjad/Library/CloudStorage/OneDrive-Personal/MS Computer Science/Semester 4 (Spring 2022)/CS 5316 - Natural Language Processing/Assignments/Assignment 3/Assignment_3_20030001.ipynb Cell 33' in &lt;module&gt;
  ----&gt; 1 model.fit(train_x, 
        2           train_y, 
        3           epochs= 10, 
        4           batch_size= 50, 
        5           verbose=1, 
        6           shuffle=True,
        7           validation_data=(val_x, val_y))
  
  File /usr/local/lib/python3.9/site-packages/keras/utils/traceback_utils.py:67, in filter_traceback.&lt;locals&gt;.error_handler(*args, **kwargs)
       65 except Exception as e:  # pylint: disable=broad-except
       66   filtered_tb = _process_traceback_frames(e.__traceback__)
  ---&gt; 67   raise e.with_traceback(filtered_tb) from None
       68 finally:
       69   del filtered_tb
  
  File /usr/local/lib/python3.9/site-packages/keras/engine/data_adapter.py:984, in select_data_adapter(x, y)
      981 adapter_cls = [cls for cls in ALL_ADAPTER_CLS if cls.can_handle(x, y)]
      982 if not adapter_cls:
      983   # TODO(scottzhu): This should be a less implementation-specific error.
  --&gt; 984   raise ValueError(
      985       &quot;Failed to find data adapter that can handle &quot;
      986       &quot;input: {}, {}&quot;.format(
      987           _type_name(x), _type_name(y)))
      988 elif len(adapter_cls) &gt; 1:
      989   raise RuntimeError(
      990       &quot;Data adapters should be mutually exclusive for &quot;
      991       &quot;handling inputs. Found multiple adapters {} to handle &quot;
      992       &quot;input: {}, {}&quot;.format(
      993           adapter_cls, _type_name(x), _type_name(y)))
  </code></pre>
  <p>I'm unable to figure out why it is rejecting the values of type ndarray. Can someone please point out how I should pass these values to model.fit correctly?</p>