Skip to content

Sequential model input layer convert #129

@yanwang271

Description

@yanwang271

Hi Avanti,

I was trying to apply DeepLIFT to a sequential model. When using "kc.convert_model_from_saved_files" function, it gave error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "deeplift/deeplift/conversion/kerasapi_conversion.py", line 388, in convert_model_from_saved_files
    +" weights file which has layer names "+str(model_weights.keys()))
AssertionError: Layer conv1d_3_input is in the layer names but not in the  weights file which has layer names <KeysViewHDF5 ['conv1d', 'conv1d_1', 'conv1d_2', 'conv1d_3', 'dense', 'dense_1', 'dropout', 'dropout_1', 'flatten', 'max_pooling1d', 'max_pooling1d_1']>

The conv1d_3_input is the input layer, which should not have weights. Could you help me with it?

If it helps, below is part of the model config:

{'name': 'sequential', 'layers': [{'class_name': 'InputLayer', 'config': {'batch_input_shape': [None, 500, 4], 'dtype': 'float32', 'sparse': False, 'ragged': False, 'name': 'conv1d_3_input'}}, {'class_name': 'Conv1D', 'config': {'name': 'conv1d_3', 'trainable': True, 'batch_input_shape': [None, 500, 4], 'dtype': 'float32', 'filters': 32, 'kernel_size': [12], 'strides': [1], 'padding': 'valid', 'data_format': 'channels_last', 'dilation_rate': [1], 'groups': 1, 'activation': 'relu', 'use_bias': True, 'kernel_initializer': {'class_name': 'GlorotUniform', 'config': {'seed': None}}, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'kernel_regularizer': None, 'bias_regularizer': None, 'activity_regularizer': None, 'kernel_constraint': None, 'bias_constraint': None}}, {'class_name': 'Conv1D', 'config': {'name': 'conv1d_2', 'trainable': True, 'dtype': 'float32', 'filters': 32, 'kernel_size': [12], 'strides': [1], 'padding': 'valid', 'data_format': 'channels_last', 'dilation_rate': [1], 'groups': 1, 'activation': 'relu', 'use_bias': True, 'kernel_initializer': {'class_name': 'GlorotUniform', 'config': {'seed': None}}, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'kernel_regularizer': None, 'bias_regularizer': None, 'activity_regularizer': None, 'kernel_constraint': None, 'bias_constraint': None}}, ...

Thanks!
Yan

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions