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

Problem on Loading MatchZoo Rankers #39

Open
albertoueda opened this issue Apr 10, 2021 · 5 comments
Open

Problem on Loading MatchZoo Rankers #39

albertoueda opened this issue Apr 10, 2021 · 5 comments

Comments

@albertoueda
Copy link

Perhaps it is a MatchZoo issue.

Code:

import pyterrier as pt
if not pt.started(): 
    pt.init(tqdm='notebook')
import onir_pt

Log:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-6-dabbde9562ae> in <module>
      5     pt.init(tqdm='notebook')
      6 
----> 7 import onir_pt

/users/tr.aueda/anaconda3/envs/onir/lib/python3.7/site-packages/onir_pt/__init__.py in <module>
     21 
     22 import pyterrier
---> 23 import onir
     24 
     25 _logger = onir.log.easy()

/users/tr.aueda/anaconda3/envs/onir/lib/python3.7/site-packages/onir/__init__.py in <module>
     21 logger = log.Logger('onir')
     22 
---> 23 from onir import util, injector, metrics, datasets, interfaces, rankers, config, trainers, predictors, vocab, pipelines

/users/tr.aueda/anaconda3/envs/onir/lib/python3.7/site-packages/onir/rankers/__init__.py in <module>
      7 from onir.rankers import base, conv_knrm, drmm, duetl, knrm, matchpyramid, pacrr, trivial
      8 from onir.rankers import vanilla_transformer, cedr_drmm, cedr_knrm, cedr_pacrr, epic
----> 9 from onir.rankers import matchzoo

/users/tr.aueda/anaconda3/envs/onir/lib/python3.7/site-packages/onir/rankers/matchzoo.py in <module>
      5 if matchzoo.is_available:
      6     rankers.register('mz_knrm')(matchzoo.generate_mz_ranker(matchzoo.mz.models.KNRM))
----> 7     rankers.register('mz_conv_knrm')(matchzoo.generate_mz_ranker(matchzoo.mz.models.ConvKNRM))
      8     # This one doesn't seem to train properly...
      9     # rankers.register('mz_drmmtks')(generate_mz_ranker(matchzoo.mz.models.DRMMTKS))

/users/tr.aueda/anaconda3/envs/onir/lib/python3.7/site-packages/onir/interfaces/matchzoo.py in generate_mz_ranker(MatchZooModel)
     44 
     45     """
---> 46     default_config = generate_default_config(MatchZooModel)
     47 
     48     class MatchZooBaseRanker(rankers.Ranker):

/users/tr.aueda/anaconda3/envs/onir/lib/python3.7/site-packages/onir/interfaces/matchzoo.py in generate_default_config(MatchZooModel)
    119     """
    120     default_config = rankers.Ranker.default_config()
--> 121     default_params = MatchZooModel.get_default_params()
    122     for param in default_params.keys():
    123         if param not in _CONFIG_IGNORED_PARAMS:

TypeError: get_default_params() missing 1 required positional argument: 'cls'
@albertoueda
Copy link
Author

Problem solved! Found the recommended command at matchzoo.py:
pip install matchzoo-py==1.0

Previously I had tried to update via:
pip install --upgrade git+https://github.com/NTMC-Community/MatchZoo.git'
, but it did not solve the problem.

Not sure if it was related, but I had a previous version of matchzoo (2.2.0) installed, not matchzoo-py. Perhaps we need an entry in requirements.txt?

@seanmacavaney
Copy link
Contributor

Sounds good- thanks!

Just to be clear-- matchzoo-py==1.0 worked, correct?

@albertoueda
Copy link
Author

albertoueda commented Apr 10, 2021

Just to be clear-- matchzoo-py==1.0 worked, correct?

Yes!

@seanmacavaney
Copy link
Contributor

I think rather than adding it to the requirements.txt (which would mean it's required for all installations of OpenNIR), I'll add a check in matchzoo.py to see that it's a supported version (using matchzoo.__version__) & print a message if it's not. Does this sound okay?

@albertoueda
Copy link
Author

It sounds great :)

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

2 participants