Skip to content

Commit

Permalink
Merge pull request #69 from kundajelab/keras2.4-fix
Browse files Browse the repository at this point in the history
Keras 2.2.3 saved file API breaking fix
  • Loading branch information
AvantiShri authored Dec 12, 2018
2 parents 5cc76a8 + a37530c commit 9cbe05b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ matrix:
- python: 2.7
env: KERAS_BACKEND=tensorflow TF_VERSION=1.10.1 KERAS_VERSION=2.2
- python: 3.6
env: KERAS_BACKEND=tensorflow TF_VERSION=1.10.1 KERAS_VERSION=2.2
env: KERAS_BACKEND=tensorflow TF_VERSION=1.10.1 KERAS_VERSION=2.2.4

notifications:
email: true
Expand Down
2 changes: 1 addition & 1 deletion deeplift.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: deeplift
Version: 0.6.8.0
Version: 0.6.8.1
Summary: DeepLIFT (Deep Learning Important FeaTures)
Home-page: https://github.com/kundajelab/deeplift
License: UNKNOWN
Expand Down
2 changes: 1 addition & 1 deletion deeplift/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.6.6.2'
__version__ = '0.6.8.1'
12 changes: 10 additions & 2 deletions deeplift/conversion/kerasapi_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ def convert_model_from_saved_files(
model_weights=model_weights['model_weights']

if (model_class_name=="Sequential"):
if (isinstance(model_config, list)==False): #keras 2.2.3 API change
model_config = model_config["layers"]
layer_configs = model_config
model_conversion_function = convert_sequential_model
elif (model_class_name=="Model"):
Expand Down Expand Up @@ -386,7 +388,10 @@ def convert_model_from_saved_files(
elif (layer_config["class_name"]=="Sequential"):
insert_weights_into_nested_model_config(
nested_model_weights=nested_model_weights,
nested_model_layer_config=layer_config["config"])
nested_model_layer_config=
(layer_config["config"] if
isinstance(layer_config["config"], list)
else layer_config["config"]["layers"]))
else:
layer_weights = [np.array(model_weights[layer_name][x]) for x in
model_weights[layer_name].attrs["weight_names"]]
Expand All @@ -406,7 +411,10 @@ def insert_weights_into_nested_model_config(nested_model_weights,
elif (layer_config["class_name"]=="Sequential"):
insert_weights_into_nested_model_config(
nested_model_weights=nested_model_weights,
nested_model_layer_config=layer_config["config"])
nested_model_layer_config=
(layer_config["config"]
if isinstance(layer_config["config"],list)
else layer_config["config"]["layers"]))
else:
layer_name = layer_config["config"]["name"]
layer_weights = [np.array(nested_model_weights[x]) for x in
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Implements the methods in "Learning Important Features Through Propagating Activation Differences" by Shrikumar, Greenside & Kundaje, as well as other commonly-used methods such as gradients, guided backprop and integrated gradients. See https://github.com/kundajelab/deeplift for documentation and FAQ.
""",
url='https://github.com/kundajelab/deeplift',
version='0.6.8.0',
version='0.6.8.1',
packages=['deeplift',
'deeplift.layers', 'deeplift.visualization',
'deeplift.conversion'],
Expand Down

0 comments on commit 9cbe05b

Please sign in to comment.