ClimbsRocks / auto_ml

[UNMAINTAINED] Automated machine learning for analytics & production
http://auto-ml.readthedocs.io
MIT License
1.64k stars 311 forks source link

Loading deep learning model has an error #412

Open aojue1109 opened 5 years ago

aojue1109 commented 5 years ago

Executing code loading deep learning model has the following error

from auto_ml.utils_models import load_ml_model trained_ml_pipeline = load_ml_model("auto_ml_saved_pipeline.dill") trained_ml_pipeline.predict(data)

An error occurred:

Traceback (most recent call last): File "/root/situ/automl/ctest.py", line 48, in trained_ml_pipeline = load_ml_model("auto_ml_saved_pipeline.dill") File "/root/anaconda3/envs/automl/lib/python3.6/site-packages/auto_ml/utils_models.py", line 629, in load_ml_model pipeline_step.model = insert_deep_learning_model(pipeline_step, file_name) File "/root/anaconda3/envs/automl/lib/python3.6/site-packages/auto_ml/utils_models.py", line 594, in insert_deep_learning_model model = keras_load_model(keras_file_name) TypeError: 'NoneType' object is not callable

jameshgrn commented 5 years ago

I am also having this issue, making it very hard to run different datasets

sbertech commented 5 years ago

The problem is that the initialization of keras is done in utils_models.get_model_from_name(). Which, in turn, is called only from a couple places in Predictor. The workaround for this bug is to call the method directly before loading the model:

from auto_ml import utils_models
     ...
utils_models.get_model_from_name ('DeepLearningRegressor')
model = utils_models.load_ml_model (file_name)