NTMC-Community / MatchZoo

Facilitating the design, comparison and sharing of deep text matching models.
Apache License 2.0
3.82k stars 898 forks source link

Bug/enhancement #850

Open jerrycearley opened 2 years ago

jerrycearley commented 2 years ago

Describe the bug

MatchZoo breaks when run in google colab beacause of deprocated dependencies in keras

To Reproduce

Attempt to import match zoo in google colab:

!pip3 install matchzoo

import tensorflow from tensorflow import keras import matchzoo as mz import nltk import pandas as pd

Describe your attempts

Attempted to run matchzoo in google colab Fixed dependecy issues

You should also provide code snippets you tried as a workaround, StackOverflow solution that you have walked through, or your best guess of the cause that you can't locate (e.g. cosmic radiation).

Context

Nine FIles Needed edit: attention layer.py

from keras.engine import Layer

from keras.layers import Layer # Changed from previous line to fix tensorflow toolchain

data_generator.py import tensorflow # Added to fix toolchain issues

import keras

from tensorflow import keras # Changed from previous line

decating_dropout_layer.py

from keras.engine import Layer

from keras.layers import Layer # Changed from previous line to fix tensorflow toolchain

dynamic_pooling_layer.py

from keras.engine import Layer

from keras.layers import Layer # Changed from previous line to fix tensorflow toolchain

matching_layer.py

from keras.engine import Layer

from keras.layers import Layer # Changed from previous line to fix tensorflow toolchain

matching_tensor_layer.py

from keras.engine import Layer

from keras.layers import Layer # Changed from previous line to fix tensorflow toolchain

multi_perspective_layer.py

from keras.engine import Layer

from keras.layers import Layer # Changed from previous line to fix tensorflow toolchain

semantic_composite_layer.py

from keras.engine import Layer

from keras.layers import Layer # Changed from previous line to fix tensorflow toolchain

spatial_gru.py

from keras.engine import Layer

from keras.layers import Layer # Changed from previous line to fix tensorflow toolchain

Additional Information

I clone the repo and will push this update as a contribution to the code base

tschomacker commented 2 years ago

Hello, I have stumbled over the same bug. As it seems there will be no future main-version of this library where the bug is fixed. #844 describes almost the same problem and lead to an update in a dev-branch and an interesting discussion. Edit: I was able to install the dev-version via !pip install git+https://github.com/NTMC-Community/MatchZoo.git@2.3-dev in kaggle

Nowina commented 2 years ago

Hello, I had the same issue. Solution provided by @tschomacker works great, but when running tutorial notebook conv_knrm.ipynb I get this error: image

When using method model.fit_generator() without callbacks the tutorial works undisturbed. Same thing happens in other tutorials.