Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work with Keras==2.2.5 and tensorflow==1.14.0 #115

Open
nkrot opened this issue Sep 2, 2019 · 3 comments
Open

Does not work with Keras==2.2.5 and tensorflow==1.14.0 #115

nkrot opened this issue Sep 2, 2019 · 3 comments

Comments

@nkrot
Copy link

nkrot commented Sep 2, 2019

Hi,

This issue is related to and has the same origin as #113.

Training does not run, I managed to make it run by downgrading the versions of Keras and tensorflow as described in the linked version.

System information

  • Linux Ubuntu 18.04:
  • Keras v. 2.2.5
  • tensorflow v. 1.14.0
  • Python version: 3.6.8
  • anago v.1.0.8 (installed with pip install)

Logs

    model.fit(x_train, y_train, epochs=30)
  File "venv/lib/python3.6/site-packages/anago/wrapper.py", line 80, in fit
    model, loss = model.build()
  File "/venv/lib/python3.6/site-packages/anago/models.py", line 115, in build
    pred = crf(z)
  File "venv/lib/python3.6/site-packages/keras/engine/base_layer.py", line 451, in __call__
    output = self.call(inputs, **kwargs)
  File "venv/lib/python3.6/site-packages/anago/layers.py", line 215, in call
    test_output = self.viterbi_decoding(X, mask)
  File "venv/lib/python3.6/site-packages/anago/layers.py", line 484, in viterbi_decoding
    argmin_tables = self.recursion(input_energy, mask, return_logZ=False)
  File "venv/lib/python3.6/site-packages/anago/layers.py", line 445, in recursion
    mask2 = K.cast(K.concatenate([mask, K.zeros_like(mask[:, :1])], axis=1), K.floatx())
  File "venv/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 2176, in concatenate
    return tf.concat([to_dense(x) for x in tensors], axis)
  File "venv/lib/python3.6/site-packages/tensorflow/python/util/dispatch.py", line 180, in wrapper
    return target(*args, **kwargs)
  File "venv/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1299, in concat
    return gen_array_ops.concat_v2(values=values, axis=axis, name=name)
  File "venv/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 1256, in concat_v2
    "ConcatV2", values=values, axis=axis, name=name)
  File "venv/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 499, in _apply_op_helper
    raise TypeError("%s that don't all match." % prefix)
TypeError: Tensors in list passed to 'values' of 'ConcatV2' Op have types [bool, float32] that don't all match.
@nipunsadvilkar
Copy link

nipunsadvilkar commented Sep 4, 2019

Try out keras==2.2.4

@nkrot
Copy link
Author

nkrot commented Sep 4, 2019

@nipunsadvilkar , i managed to run the tool by downgrading the versions of keras, tensorflow and seqeval. I mentioned this in my post. The reason for filing the issue is to make the developer(s) aware of incompatibility with higher versions of said libraries.

@bedapudi6788
Copy link

For anyone looking for a way to make this library compatible with newer versions of keras and tf, replace the layers.py with https://github.com/bedapudi6788/seqtag-keras/blob/no_elmo/seqtag_keras/layers.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants