Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tensorflow Data Adapter Error: ValueError: Failed to find data adapter that can handle input

While running a sentdex tutorial script of a cryptocurrency RNN, link here

YouTube Tutorial: Cryptocurrency-predicting RNN Model,

but have encountered an error when attempting to train the model. My tensorflow version is 2.0.0 and I'm running python 3.6. When attempting to train the model I receive the following error:

File "C:\python36-64\lib\site-packages\tensorflow_core\python\keras\engine\training.py", line 734, in fit     use_multiprocessing=use_multiprocessing)  File "C:\python36-64\lib\site-packages\tensorflow_core\python\keras\engine\training_v2.py", line 224, in fit     distribution_strategy=strategy)  File "C:\python36-64\lib\site-packages\tensorflow_core\python\keras\engine\training_v2.py", line 497, in _process_training_inputs     adapter_cls = data_adapter.select_data_adapter(x, y)  File "C:\python36-64\lib\site-packages\tensorflow_core\python\keras\engine\data_adapter.py", line 628, in select_data_adapter     _type_name(x), _type_name(y)))  ValueError: Failed to find data adapter that can handle input: <class 'numpy.ndarray'>, (<class 'list'> containing values of types {"<class 'numpy.float64'>"}) 

Any advice would be greatly appreciated!

like image 566
Jonathan E Avatar asked Sep 10 '19 15:09

Jonathan E


2 Answers

Have you checked whether your training/testing data and training/testing labels are all numpy arrays? It might be that you're mixing numpy arrays with lists.

like image 115
Forran Avatar answered Sep 20 '22 18:09

Forran


You can avoid this error by converting your labels to arrays before calling model.fit():

train_x = np.asarray(train_x) train_y = np.asarray(train_y) validation_x = np.asarray(validation_x) validation_y = np.asarray(validation_y) 
like image 30
Rameez Ahmad Dar Avatar answered Sep 22 '22 18:09

Rameez Ahmad Dar