ad-freiburg / elevant

Entity linking evaluation and analysis tool
https://elevant.cs.uni-freiburg.de/
Apache License 2.0
19 stars 1 forks source link

GENRE using deprecated numpy attribute #13

Closed agolo-alan-hogue closed 11 months ago

agolo-alan-hogue commented 11 months ago

Hello,

I got GENRE set up from your repo, but when I try to run it, I get this:

root@dec09fef21fa:/GENRE# python3 main.py --yago -i agolo-110823.benchmark.jsonl  -o out.jsonl --split_iter --mention_trie data/mention_trie.pkl  --mention_to_candidates_dict data/mention_to_candidates_dict.pkl
Traceback (most recent call last):
  File "main.py", line 3, in <module>
    from model import Model
  File "/GENRE/model.py", line 6, in <module>
    from genre.fairseq_model import GENRE
  File "/GENRE/genre/fairseq_model.py", line 14, in <module>
    from fairseq import search, utils
  File "/GENRE/fairseq/fairseq/utils.py", line 20, in <module>
    from fairseq.modules.multihead_attention import MultiheadAttention
  File "/GENRE/fairseq/fairseq/modules/__init__.py", line 10, in <module>
    from .character_token_embedder import CharacterTokenEmbedder
  File "/GENRE/fairseq/fairseq/modules/character_token_embedder.py", line 11, in <module>
    from fairseq.data import Dictionary
  File "/GENRE/fairseq/fairseq/data/__init__.py", line 23, in <module>
    from .indexed_dataset import (
  File "/GENRE/fairseq/fairseq/data/indexed_dataset.py", line 112, in <module>
    6: np.float,
  File "/usr/local/lib/python3.8/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
agolo-alan-hogue commented 11 months ago

Hi!

More fun with GENRE!

I manually replaced np.float with just float, which happens only in fairseq.

That gives another error. I'll paste that one below. So I went to the normal GENRE repo and found this note regarding fairseq here:

fairseq>=0.10 (optional for training GENRE) NOTE: fairseq is going though changing without backward compatibility. Install fairseq from source and use [this](https://github.com/nicola-decao/fairseq/tree/fixing_prefix_allowed_tokens_fn) commit for reproducibilty. See https://github.com/pytorch/fairseq/pull/3276 for the current PR that should fix fairseq/master.

So it sounds to me like if you were to pull or rebase this PR maybe this would fix these problems?

Thanks for your help!

Latest error:

root@3e9ee535d1b0:/GENRE# python3 main.py --yago -i example_article.jsonl  -o out.jsonl --split_iter --mention_trie data/mention_trie.pkl  --mention_to_candidates_dict data/mention_to_candidates_dict.pkl
Traceback (most recent call last):
  File "main.py", line 3, in <module>
    from model import Model
  File "/GENRE/model.py", line 6, in <module>
    from genre.fairseq_model import GENRE
  File "/GENRE/genre/fairseq_model.py", line 15, in <module>
    from fairseq.models.bart import BARTHubInterface, BARTModel
  File "/GENRE/fairseq/fairseq/models/__init__.py", line 208, in <module>
    module = importlib.import_module("fairseq.models." + model_name)
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/GENRE/fairseq/fairseq/models/wav2vec/__init__.py", line 6, in <module>
    from .wav2vec import *  # noqa
  File "/GENRE/fairseq/fairseq/models/wav2vec/wav2vec.py", line 25, in <module>
    from fairseq.tasks import FairseqTask
  File "/GENRE/fairseq/fairseq/tasks/__init__.py", line 15, in <module>
    from .fairseq_task import FairseqTask, LegacyFairseqTask  # noqa
  File "/GENRE/fairseq/fairseq/tasks/fairseq_task.py", line 13, in <module>
    from fairseq import metrics, search, tokenizer, utils
ImportError: cannot import name 'metrics' from 'fairseq' (unknown location)
flackbash commented 11 months ago

You set up GENRE from here, right? https://github.com/ad-freiburg/GENRE

If so, then could you please post the same issue in that repository? It was maintained by my colleague and I myself had nothing to do with setting it up and sadly don't know much about it.

agolo-alan-hogue commented 11 months ago

There is no "Issues" tab in that repo, which I think means it is not turned on by the maintainer, so I thought that might mean they should be reported here. Do you think you could ask the maintainer to turn them on?

flackbash commented 11 months ago

Oh I see, I didn't notice. I'll ask him about it!

flackbash commented 11 months ago

It is now possible to open issues in the GENRE repository :)