keras-team / autokeras

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

海哥,结构化数据无法读取模型。StructuredDataClassifier predict do not work #924

Closed thefreeman007 closed 4 years ago

thefreeman007 commented 4 years ago

Bug Description

/home/zy/anaconda3/envs/tf2/bin/python3.6 /home/zy/PycharmProjects/dl_exchange/auto_ml_kaers.py {'dot': '/usr/bin/dot', 'twopi': '/usr/bin/twopi', 'neato': '/usr/bin/neato', 'circo': '/usr/bin/circo', 'fdp': '/usr/bin/fdp', 'sfdp': '/usr/bin/sfdp'} Using TensorFlow backend. <class 'numpy.ndarray'> <class 'numpy.ndarray'> Traceback (most recent call last): File "/home/zy/PycharmProjects/dl_exchange/auto_ml_kaers.py", line 87, in clf.predict(x=x_test,batch_size=999) File "/home/zy/anaconda3/envs/tf2/lib/python3.6/site-packages/autokeras/task.py", line 542, in predict **kwargs) File "/home/zy/anaconda3/envs/tf2/lib/python3.6/site-packages/autokeras/auto_model.py", line 285, in predict preprocess_graph, model = self.tuner.get_best_model() File "/home/zy/anaconda3/envs/tf2/lib/python3.6/site-packages/autokeras/tuner.py", line 111, in get_best_model preprocess_graph, keras_graph, model = self.get_best_models()[0] File "/home/zy/anaconda3/envs/tf2/lib/python3.6/site-packages/kerastuner/engine/tuner.py", line 231, in get_best_models return super(Tuner, self).get_best_models(num_models) File "/home/zy/anaconda3/envs/tf2/lib/python3.6/site-packages/kerastuner/engine/base_tuner.py", line 238, in get_best_models models = [self.load_model(trial) for trial in best_trials] File "/home/zy/anaconda3/envs/tf2/lib/python3.6/site-packages/kerastuner/engine/base_tuner.py", line 238, in models = [self.load_model(trial) for trial in best_trials] File "/home/zy/anaconda3/envs/tf2/lib/python3.6/site-packages/autokeras/tuner.py", line 93, in load_model preprocess_graph, keras_graph = self.hyper_graph.build_graphs( AttributeError: 'NoneType' object has no attribute 'build_graphs' <autokeras.task.StructuredDataClassifier object at 0x7ff818300518>

my_code: clf=ak.StructuredDataClassifier(max_trials=16,name='autokeras',overwrite=False,directory='ak/auto-kears1') clf.predict(x=x_test,batch_size=999) The model has been trained. It was found that it could not be loaded when it was loaded again for prediction. In addition, the model does not know why GPU utilization is very low, only about 3%. 模型已经训练完了,再次加载进行预测的时候发现无法加载。另外模型不知道为何gpu利用率非常低,只有百分之3左右。

A clear and concise description of what the bug is. -->

Reproducing Steps

Steps to reproduce the behavior:

Expected Behavior

Setup Details

Include the details about the versions of:

Additional context

model=clf.export_model() save_model(model,model_save_path) model = load_mode('xxx,h5') is not work too. 使用keras加载保存的模型也无法保存。 如有需要提供更多的信息,可以联系我qq402868327 -->

haifeng-jin commented 4 years ago

@anavanab99 This is mainly because of some of the custom layers we added to the model. Another issue is some preprocessors are not exported. We are addressing this now. will update a version support everything to be exported to Keras model. Will update the tutorial too.

Thanks

stale[bot] commented 4 years ago

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.