Failed to find data adapter that can handle input: <class 'numpy.ndarray'>, (<class 'list'> containing values of types {"<class 'int'>"})
Solution 1
I was facing the same issue. Turns out it was a in the form of a list. I had to convert the fields into a numpy array like:
training_padded = np.array(training_padded)
training_labels = np.array(training_labels)
testing_padded = np.array(testing_padded)
testing_labels = np.array(testing_labels)
thats it!
Solution 2
https://pythonprogramming.net/convolutional-neural-network-deep-learning-python-tensorflow-keras/
I tried following code and worked for me:
IMG_SIZE = 50
X = np.array(X).reshape(-1, IMG_SIZE, IMG_SIZE, 1)
y = np.array(y)
history = model.fit(X, y, batch_size=32, epochs=40, validation_split=0.1)
Solution 3
So this is happening the the newer version of tensorflow I'm not sure from where but I was on version 2.0.0 and this same thing happened
I'm assuming that you are only converting the X array into a numpy array But rather try converting 'X' as well as 'y' to numpy array using the dtype as np.uint8
That should resolve the problem
Solution 4
In my case the problem was only in y. it was a list. in that case i had to change
y = np.array(y)
Solution 5
VIKI already said a good answer. I am adding more information. It used to crash colab host for me as well, before I added the np.array() wrappers.
# Need to call np.array() around pandas dataframes.
# This crashes the colab host from TF attempting a 32GB memory alloc when np.array() wrappers are not used around pandas dataframes.
# Wrapping also cures warning about "Failed to find data adapter that can handle input"
history = model.fit(x=np.array(tr_X), y=np.array(tr_Y), epochs=3, validation_data=(np.array(va_X), np.array(va_Y)), batch_size=batch_size, steps_per_epoch=spe, validation_freq=5)
Crashing host due to out of memory problem has something to do with this:
![Admin](/assets/logo_square_200-5d0d61d6853298bd2a4fe063103715b4daf2819fc21225efa21dfb93e61952ea.png)
Admin
Updated on June 16, 2021Comments
-
Admin about 3 years
history = model.fit(X, y, batch_size=32, epochs=40, validation_split=0.1)
the line problem was this
Showing error:
ValueError: Failed to find data adapter that can handle input: <class 'numpy.ndarray'>, (<class 'list'> containing values of types {"<class 'int'>"})