Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NLP Course - Week 3 Exercise #73

Open
kermoonshahii opened this issue Mar 29, 2020 · 1 comment
Open

NLP Course - Week 3 Exercise #73

kermoonshahii opened this issue Mar 29, 2020 · 1 comment

Comments

@kermoonshahii
Copy link

I run this code with tf=='2.2.0-rc1' and the code raises value error.
Would you help me to solve this, please ?
ValueError Traceback (most recent call last)
in ()
11
12 num_epochs = 50
---> 13 history = model.fit(training_sequences, training_labels, epochs=num_epochs, validation_data=(test_sequences, test_labels), verbose=2)
14
15 print("Training Complete")

3 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py in _method_wrapper(self, *args, **kwargs)
63 def _method_wrapper(self, *args, **kwargs):
64 if not self._in_multi_worker_mode(): # pylint: disable=protected-access
---> 65 return method(self, *args, **kwargs)
66
67 # Running inside run_distribute_coordinator already.

/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_batch_size, validation_freq, max_queue_size, workers, use_multiprocessing, **kwargs)
748 workers=workers,
749 use_multiprocessing=use_multiprocessing,
--> 750 model=self)
751
752 # Container that configures and calls tf.keras.Callbacks.

/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/data_adapter.py in init(self, x, y, sample_weight, batch_size, steps_per_epoch, initial_epoch, epochs, shuffle, class_weight, max_queue_size, workers, use_multiprocessing, model)
1094 self._insufficient_data = False
1095
-> 1096 adapter_cls = select_data_adapter(x, y)
1097 self._adapter = adapter_cls(
1098 x,

/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/data_adapter.py in select_data_adapter(x, y)
958 "Failed to find data adapter that can handle "
959 "input: {}, {}".format(
--> 960 _type_name(x), _type_name(y)))
961 elif len(adapter_cls) > 1:
962 raise RuntimeError(

ValueError: Failed to find data adapter that can handle input: <class 'numpy.ndarray'>, (<class 'list'> containing values of types {"<class 'int'>"})

@H-rim
Copy link

H-rim commented May 26, 2020

I had same issue, and solved it by adding some code before 'model.fit()'
training_sequences, test_sequences = np.array(training_sequences), np.array(test_sequences) training_labels, test_labels = np.array(training_labels), np.array(test_labels)

refer to this link: https://stackoverflow.com/questions/58682026/failed-to-find-data-adapter-that-can-handle-input-class-numpy-ndarray-cl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants