NTMC-Community / MatchZoo

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

Matchzoo ImportError: cannot import name 'Loss' from 'keras.losses' #794

Closed alinvain closed 4 years ago

alinvain commented 4 years ago

When following DSSM quick 60s start, and importing "import matchzoo as mz", get the following error:

Traceback (most recent call last): File "", line 1, in File "/Users/user/git_repo/MatchZoo/matchzoo/init.py", line 28, in from . import losses File "/Users/user/git_repo/MatchZoo/matchzoo/losses/init.py", line 1, in from .rank_cross_entropy_loss import RankCrossEntropyLoss File "/Users/user/git_repo/MatchZoo/matchzoo/losses/rank_cross_entropy_loss.py", line 6, in from keras.losses import Loss ImportError: cannot import name 'Loss' from 'keras.losses' (//anaconda3/envs/matchzoo/lib/python3.7/site-packages/keras/losses.py)

Probably, due to Keras version (mine is 2.2.4) and I can't install 2.3.0, since It's now available for MacOS yet . My MacOS version is 10.14.5.

Is it possible to install previous version of MatchZoo so that it uses older keras?

uduse commented 4 years ago

The current version of matchzoo is not compatible with your keras version. You may use matchzoo version 2.1 instead.