TextClassifier example - AttributeError: 'tuple' object has no attribute 'shape'
See original GitHub issueHi,
when trying the IMDB Movie Reviews text classification example I receive the following error message when executing
clf.fit(x_train, y_train)
AttributeError: in user code: C:\Users\Sascha\.conda\envs\keras4\lib\site-packages\tensorflow\python\keras\engine\training.py:803 train_function *\n return step_function(self, iterator)\n C:\Users\Sascha\.conda\envs\keras4\lib\site-packages\tensorflow\python\keras\engine\training.py:793 step_function **\n outputs = model.distribute_strategy.run(run_step, args=(data,))\n C:\Users\Sascha\.conda\envs\keras4\lib\site-packages\tensorflow\python\distribute\distribute_lib.py:964 run\n return self._extended.call_for_each_replica(fn, args=args, kwargs=kwargs)\n C:\Users\Sascha\.conda\envs\keras4\lib\site-packages\tensorflow\python\distribute\distribute_lib.py:2315 call_for_each_replica\n return self._call_for_each_replica(fn, args, kwargs)\n C:\Users\Sascha\.conda\envs\keras4\lib\site-packages\tensorflow\python\distribute\distribute_lib.py:2674 _call_for_each_replica\n return fn(*args, **kwargs)\n C:\Users\Sascha\.conda\envs\keras4\lib\site-packages\tensorflow\python\keras\engine\training.py:786 run_step **\n outputs = model.train_step(data)\n C:\Users\Sascha\.conda\envs\keras4\lib\site-packages\tensorflow\python\keras\engine\training.py:756 train_step\n self.compiled_metrics.update_state(y, y_pred, sample_weight)\n C:\Users\Sascha\.conda\envs\keras4\lib\site-packages\tensorflow\python\keras\engine\compile_utils.py:389 update_state\n self._build(y_pred, y_true)\n C:\Users\Sascha\.conda\envs\keras4\lib\site-packages\tensorflow\python\keras\engine\compile_utils.py:320 _build\n self._metrics, y_true, y_pred)\n C:\Users\Sascha\.conda\envs\keras4\lib\site-packages\tensorflow\python\util\nest.py:1131 map_structure_up_to\n **kwargs)\n C:\Users\Sascha\.conda\envs\keras4\lib\site-packages\tensorflow\python\util\nest.py:1227 map_structure_with_tuple_paths_up_to\n *flat_value_lists)]\n C:\Users\Sascha\.conda\envs\keras4\lib\site-packages\tensorflow\python\util\nest.py:1226 <listcomp>\n results = [func(*args, **kwargs) for args in zip(flat_path_list,\n C:\Users\Sascha\.conda\envs\keras4\lib\site-packages\tensorflow\python\util\nest.py:1129 <lambda>\n lambda _, *values: func(*values), # Discards the path arg.\n C:\Users\Sascha\.conda\envs\keras4\lib\site-packages\tensorflow\python\keras\engine\compile_utils.py:419 _get_metric_objects\n return [self._get_metric_object(m, y_t, y_p) for m in metrics]\n C:\Users\Sascha\.conda\envs\keras4\lib\site-packages\tensorflow\python\keras\engine\compile_utils.py:419 <listcomp>\n return [self._get_metric_object(m, y_t, y_p) for m in metrics]\n C:\Users\Sascha\.conda\envs\keras4\lib\site-packages\tensorflow\python\keras\engine\compile_utils.py:440 _get_metric_object\n y_t_rank = len(y_t.shape.as_list()) AttributeError: ‘tuple’ object has no attribute ‘shape’\n"
I’m using the current tf-nightly 2.3.0.dev20200519 and the current autokeras 1.0.3 on Github. I receive the same error message with tf 2.2 and autokeras 1.0.2, and tf-nightly and autokeras 1.0.2.
I also tried tf 2.1.0 with autokeras 1.0.2, the fit works but then I cannot export/print the best model:
Error in py_call_impl(callable, dots$args, dots$keywords) : AttributeError: ‘TrackableWeightHandler’ object has no attribute ‘shape’
When using tf 2.1.0 with autokeras 1.0.3 I get:
ImportError: cannot import name ‘index_lookup’
upon import of autokeras.
I’m running Python 3.6 on Windows in an isolated conda environment.
Other packages: numpy 1.18.4 pandas 1.0.3 keras-tuner 1.0.1 scikit-learn 0.23.1
Appreciate suggestions on how to get this to run.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (2 by maintainers)
Top GitHub Comments
I get the same question when I run the example of MNIST!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.