~/anaconda3/envs/tf2.5/lib/python3.9/site-packages/autokeras/engine/tuner.py in _build_and_fit_model(self, trial, fit_args, fit_kwargs)
97
98 model = self.hypermodel.build(trial.hyperparameters)
---> 99 self.adapt(model, fitkwargs["x"])
100
101 , history = utils.fit_with_adaptive_batch_size(
~/anaconda3/envs/tf2.5/lib/python3.9/site-packages/autokeras/engine/tuner.py in adapt(model, dataset)
130 while layer is not None:
131 if isinstance(layer, preprocessing.PreprocessingLayer):
--> 132 layer.adapt(temp_x)
133 temp_x = temp_x.map(layer)
134 layer = get_output_layer(layer.output)
~/anaconda3/envs/tf2.5/lib/python3.9/site-packages/keras/engine/base_preprocessing_layer.py in adapt(self, data, batch_size, steps)
234 self.compile() # Compile with defaults.
235 if self.built:
--> 236 self.reset_state()
237 data_handler = data_adapter.DataHandler(
238 data,
~/anaconda3/envs/tf2.5/lib/python3.9/site-packages/keras/engine/base_preprocessing_layer.py in _reset_state_wrapper(self)
254 def _reset_state_wrapper(self):
255 """Calls reset_state and sets adapted to False."""
--> 256 self._reset_state_impl()
257 self._is_adapted = False
258
~/anaconda3/envs/tf2.5/lib/python3.9/site-packages/keras/engine/base_preprocessing_layer.py in reset_state(self)
82 def reset_state(self): # pylint: disable=method-hidden
83 """Resets the statistics of the preprocessing layer."""
---> 84 raise NotImplementedError
85
86 @doc_controls.do_not_generate_docs
NotImplementedError:
Bug Reproduction
Data used by the code:
Image RGB Facial dataset
Expected Behavior
Setup Details
Include the details about the versions of:
OS : linux ubuntu 20.04
Python: 3.9
autokeras: master
keras-tuner: 1.0.3
scikit-learn: 0.24.2
numpy: 1.19
pandas: 1.3.2
tensorflow: 2.6
The error occurs when calling fit(..).
The same code does not produce errors in google colab.
Bug Description
INFO:tensorflow:Reloading Oracle from existing project ./image_classifier/oracle.json
Search: Running Trial #1
Hyperparameter |Value |Best Value So Far image_block_1/b...|vanilla |?
image_block_1/n...|True |?
image_block_1/a...|False |?
image_block_1/c...|3 |?
image_block_1/c...|1 |?
image_block_1/c...|2 |?
image_block_1/c...|True |?
image_block_1/c...|False |?
image_block_1/c...|0.25 |?
image_block_1/c...|32 |?
image_block1/c...|64 |?
classification...|flatten |?
classification_...|0.5 |?
optimizer |adam |?
learning_rate |0.001 |?
NotImplementedError Traceback (most recent call last) /tmp/ipykernel_50881/2280568104.py in
1 clf = ak.ImageClassifier( max_trials=4)
----> 2 clf.fit(img_train_array, train_labels, epochs=100)
3
4
5 # Predict with the best model.
~/anaconda3/envs/tf2.5/lib/python3.9/site-packages/autokeras/tasks/image.py in fit(self, x, y, epochs, callbacks, validation_split, validation_data, **kwargs) 157 keras.Model.fit. 158 """ --> 159 super().fit( 160 x=x, 161 y=y,
~/anaconda3/envs/tf2.5/lib/python3.9/site-packages/autokeras/auto_model.py in fit(self, x, y, batch_size, epochs, callbacks, validation_split, validation_data, verbose, **kwargs) 276 ) 277 --> 278 self.tuner.search( 279 x=dataset, 280 epochs=epochs,
~/anaconda3/envs/tf2.5/lib/python3.9/site-packages/autokeras/engine/tuner.py in search(self, epochs, callbacks, validation_split, verbose, fit_kwargs) 186 self.oracle.update_space(hp) 187 --> 188 super().search( 189 epochs=epochs, callbacks=new_callbacks, verbose=verbose, fit_kwargs 190 )
~/anaconda3/envs/tf2.5/lib/python3.9/site-packages/keras_tuner/engine/base_tuner.py in search(self, *fit_args, *fit_kwargs) 142 143 self.on_trial_begin(trial) --> 144 self.run_trial(trial, fit_args, **fit_kwargs) 145 self.on_trial_end(trial) 146 self.on_search_end()
~/anaconda3/envs/tf2.5/lib/python3.9/site-packages/keras_tuner/engine/tuner.py in run_trial(self, trial, *fit_args, **fit_kwargs) 179 copied_fit_kwargs["callbacks"] = callbacks 180 --> 181 self._build_and_fit_model(trial, fit_args, copied_fit_kwargs) 182 183 def save_model(self, trial_id, model, step=0):
~/anaconda3/envs/tf2.5/lib/python3.9/site-packages/autokeras/engine/tuner.py in _build_and_fit_model(self, trial, fit_args, fit_kwargs) 97 98 model = self.hypermodel.build(trial.hyperparameters) ---> 99 self.adapt(model, fitkwargs["x"]) 100 101 , history = utils.fit_with_adaptive_batch_size(
~/anaconda3/envs/tf2.5/lib/python3.9/site-packages/autokeras/engine/tuner.py in adapt(model, dataset) 130 while layer is not None: 131 if isinstance(layer, preprocessing.PreprocessingLayer): --> 132 layer.adapt(temp_x) 133 temp_x = temp_x.map(layer) 134 layer = get_output_layer(layer.output)
~/anaconda3/envs/tf2.5/lib/python3.9/site-packages/keras/engine/base_preprocessing_layer.py in adapt(self, data, batch_size, steps) 234 self.compile() # Compile with defaults. 235 if self.built: --> 236 self.reset_state() 237 data_handler = data_adapter.DataHandler( 238 data,
~/anaconda3/envs/tf2.5/lib/python3.9/site-packages/keras/engine/base_preprocessing_layer.py in _reset_state_wrapper(self) 254 def _reset_state_wrapper(self): 255 """Calls
reset_state
and setsadapted
toFalse
.""" --> 256 self._reset_state_impl() 257 self._is_adapted = False 258~/anaconda3/envs/tf2.5/lib/python3.9/site-packages/keras/engine/base_preprocessing_layer.py in reset_state(self) 82 def reset_state(self): # pylint: disable=method-hidden 83 """Resets the statistics of the preprocessing layer.""" ---> 84 raise NotImplementedError 85 86 @doc_controls.do_not_generate_docs
NotImplementedError:
Bug Reproduction
Data used by the code: Image RGB Facial dataset
Expected Behavior
Setup Details
Include the details about the versions of:
The error occurs when calling fit(..). The same code does not produce errors in google colab.