deepsegment icon indicating copy to clipboard operation
deepsegment copied to clipboard

Error with Keras 2.4.2 and 2.4.3

Open adrien-jacquot opened this issue 5 years ago • 8 comments

Hello!

I got an "automatic" update of Keras from 2.3.1 to 2.4.3 (I'm using pipenv, and Keras was set to "*" in the Pipfile). My code won't run anymore with Keras 2.4.3, I'm getting the error below at runtime. No issue with 2.3.1 though.

(I don't mind using Keras 2.3.1 so not really a blocking issue, just thought you'd wanted to know.)

Traceback (most recent call last): File "xxx/main.py", line 23, in <module> segmenter = DeepSegment('fr') m = K.slice(states[3], [0, t], [-1, 2]) AttributeError: module 'keras.backend' has no attribute 'slice' I also have an error with Keras 2.4.2: Exception occured: in user code: /xxx/lib/python3.8/site-packages/tensorflow/python/keras/utils/tf_utils.py:140 get_reachable_from_inputs raise TypeError('Expected Operation, Variable, or Tensor, got ' + str(x)) TypeError: Expected Operation, Variable, or Tensor, got 0

adrien-jacquot avatar Jun 25 '20 12:06 adrien-jacquot

What is your tensorflow version?

bedapudi6788 avatar Jun 25 '20 13:06 bedapudi6788

2.2.0

adrien-jacquot avatar Jun 25 '20 13:06 adrien-jacquot

Thanks, I will look into this.

bedapudi6788 avatar Jun 26 '20 04:06 bedapudi6788

I am facing the same issue. As far as I understand the issue is with the keras compatibility of the tensorflow backend.

I am using the following versions - keras==2.4.3 tensorflow==2.3.0

Can you please help with versions you used with the build. Maybe changing to the same will resolve the issue.

skt7 avatar Aug 16 '20 12:08 skt7

@skt7 I generally use with tf==1.14 and keras==2.2.4. It should work with tf 2.2 and keras 2.3 too as mentioned by the original poster on this issue.

bedapudi6788 avatar Aug 17 '20 06:08 bedapudi6788

Thanks @bedapudi6788, it worked with - keras==2.3.1 tensorflow==2.2.0

Also for tensorflow 1, it works fine with the versions - keras==2.2.4 tensorflow==1.14.0

Few Suggestions -

  • I think the original issue is with regards to compatibility issues with keras and tensorflow and not with deepsegment. You can redirect to the same and maybe close this issue.
  • You can mention the supported versions in the readme to avoid future conflicts for new users.

skt7 avatar Aug 17 '20 09:08 skt7

Updated the readme to reflect these requirements. @skt7 Thank you for the suggestion.

bedapudi6788 avatar Aug 18 '20 07:08 bedapudi6788

I tried using DeepSegment In Colab ,but it showing error at line "segmenter = DeepSegment('en')" with error stating ; "module 'tensorflow.python.framework.ops' has no attribute '_TensorLike'"

shantanubinra avatar Apr 30 '21 03:04 shantanubinra