sassoftware / python-dlpy

The SAS Deep Learning Python (DLPy) package provides the high-level Python APIs to deep learning methods in SAS Visual Data Mining and Machine Learning. It allows users to build deep learning models using friendly Keras-like APIs.
Apache License 2.0
224 stars 131 forks source link

Error Importing Keras h5 model #378

Closed MsJellyKing closed 1 year ago

MsJellyKing commented 2 years ago

Hi,

I am trying to import a Keras cnn model and receiving the below error.

code : model1,use_gpu = dlpy.Model.from_keras_model(conn=sess, keras_model=keras_test, output_model_table='converted_keras_model' )

Error: ImportError: cannot import name 'preprocess_weights_for_loading' from 'keras.engine.saving' (/opt/conda/lib/python3.8/site-packages/keras/engine/saving.py)

dlpy version 1.2 keras version 2.6

Could this be a version compatibility issue?

Thanks

dxq77dxq commented 2 years ago

It could be. Would you please try the dev version of dlpy? (git clone and add sys.path instead of pip install)

MsJellyKing commented 2 years ago

I have cloned the dev version and reran the code. I now get a different error. Please see below: error1

dxq77dxq commented 2 years ago

This error message is from Keras, not DLPy. The function get_config() returns a Python dict that contains the configuration of the layer. Looks like something went wrong with the layer itself.