keras-team / autokeras

AutoML library for deep learning
http://autokeras.com/
Apache License 2.0
9.13k stars 1.4k forks source link

Autokeras1.0 task api error TypeError: __init__() got an unexpected keyword argument 'seed' #861

Closed jacklu2016 closed 4 years ago

jacklu2016 commented 4 years ago

Bug Description

i have installed autokeras1.0 from git at 12/20/2019, when i running the code bellow, i got errors

this is the code:

import autokeras as ak
from keras.datasets import mnist
from sklearn import exceptions
from sklearn.metrics import confusion_matrix

(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train = x_train.reshape(x_train.shape + (1,))
x_test = x_test.reshape(x_test.shape + (1,))

clf = ak.ImageClassifier(max_trials=100)
clf.fit(x_train, y_train,validation_split=0.2)
y = clf.predict(x_test, y_test)

erros

Traceback (most recent call last):
  File "D:/work/python_project/autokeras_test/autokerasv1.py", line 13, in <module>
    clf.fit(x_train, y_train,validation_split=0.2)
  File "D:\work\python_project\autokeras_test\venv\lib\site-packages\autokeras\task.py", line 116, in fit
    **kwargs)
  File "D:\work\python_project\autokeras_test\venv\lib\site-packages\autokeras\auto_model.py", line 199, in fit
    **kwargs)
  File "D:\work\python_project\autokeras_test\venv\lib\site-packages\autokeras\tuner.py", line 138, in search
    super().search(callbacks=new_callbacks, **fit_kwargs)
  File "D:\work\python_project\autokeras_test\venv\lib\site-packages\kerastuner\engine\base_tuner.py", line 122, in search
    self.run_trial(trial, *fit_args, **fit_kwargs)
  File "D:\work\python_project\autokeras_test\venv\lib\site-packages\autokeras\tuner.py", line 53, in run_trial
    trial.hyperparameters)
  File "D:\work\python_project\autokeras_test\venv\lib\site-packages\autokeras\hypermodel\graph.py", line 460, in build_graphs
    plain_graph = self.hyper_build(hp)
  File "D:\work\python_project\autokeras_test\venv\lib\site-packages\autokeras\hypermodel\graph.py", line 480, in hyper_build
    outputs = old_block.build(hp, inputs=inputs)
  File "D:\work\python_project\autokeras_test\venv\lib\site-packages\autokeras\hypermodel\base.py", line 117, in _build_wrapper
    return self._build(hp, *args, **kwargs)
  File "D:\work\python_project\autokeras_test\venv\lib\site-packages\autokeras\hypermodel\hyperblock.py", line 62, in build
    seed=self.seed)(output_node)
  File "D:\work\python_project\autokeras_test\venv\lib\site-packages\autokeras\hypermodel\preprocessor.py", line 577, in __init__
    super().__init__(**kwargs)
  File "D:\work\python_project\autokeras_test\venv\lib\site-packages\autokeras\hypermodel\base.py", line 100, in __init__
    super().__init__(**kwargs)
TypeError: __init__() got an unexpected keyword argument 'seed'

Setup Details

Include the details about the versions of:

haifeng-jin commented 4 years ago

This issue is fixed in autokeras 1.0.0b0. If not, please reopen the issue. Thanks.

abhinit commented 4 years ago

I am facing the same issue when I am trying to compile the following code:

import tensorflow as tf
config = tf.compat.v1.ConfigProto()
config.gpu_options.allow_growth = True
tf.compat.v1.keras.backend.set_session(tf.compat.v1.Session(config=config))

from tensorflow.keras.datasets import mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
print(x_train.shape) # (60000, 28, 28)
print(y_train.shape) # (60000,)
print(y_train[:3]) # array([7, 2, 1], dtype=uint8)

import autokeras as ak

clf = ak.ImageClassifier(max_trials=10) # It tries 10 different models.
clf.fit(x_train, y_train)
predicted_y = clf.predict(x_test)
print(clf.evaluate(x_test, y_test))

The trace is as follows:

Traceback (most recent call last):
  File "demo.py", line 17, in <module>
    clf.fit(x_train, y_train)
  File "/home/abhinit/anaconda3/envs/keras/lib/python3.7/site-packages/autokeras/task.py", line 116, in fit
    **kwargs)
  File "/home/abhinit/anaconda3/envs/keras/lib/python3.7/site-packages/autokeras/auto_model.py", line 199, in fit
    **kwargs)
  File "/home/abhinit/anaconda3/envs/keras/lib/python3.7/site-packages/autokeras/tuner.py", line 138, in search
    super().search(callbacks=new_callbacks, **fit_kwargs)
  File "/home/abhinit/anaconda3/envs/keras/lib/python3.7/site-packages/kerastuner/engine/base_tuner.py", line 122, in search
    self.run_trial(trial, *fit_args, **fit_kwargs)
  File "/home/abhinit/anaconda3/envs/keras/lib/python3.7/site-packages/autokeras/tuner.py", line 53, in run_trial
    trial.hyperparameters)
  File "/home/abhinit/anaconda3/envs/keras/lib/python3.7/site-packages/autokeras/hypermodel/graph.py", line 460, in build_graphs
    plain_graph = self.hyper_build(hp)
  File "/home/abhinit/anaconda3/envs/keras/lib/python3.7/site-packages/autokeras/hypermodel/graph.py", line 480, in hyper_build
    outputs = old_block.build(hp, inputs=inputs)
  File "/home/abhinit/anaconda3/envs/keras/lib/python3.7/site-packages/autokeras/hypermodel/base.py", line 117, in _build_wrapper
    return self._build(hp, *args, **kwargs)
  File "/home/abhinit/anaconda3/envs/keras/lib/python3.7/site-packages/autokeras/hypermodel/hyperblock.py", line 62, in build
    seed=self.seed)(output_node)
  File "/home/abhinit/anaconda3/envs/keras/lib/python3.7/site-packages/autokeras/hypermodel/preprocessor.py", line 577, in __init__
    super().__init__(**kwargs)
  File "/home/abhinit/anaconda3/envs/keras/lib/python3.7/site-packages/autokeras/hypermodel/base.py", line 100, in __init__
    super().__init__(**kwargs)
TypeError: __init__() got an unexpected keyword argument 'seed'

My setup is as follows:

sustef94 commented 4 years ago

same issue, is it fixed in 1.0.0b.0?

abhinit commented 4 years ago

same issue, is it fixed in 1.0.0b.0?

It is merged in the current version in the repo