Comments (6)
They might have changed something in the way REL is supposed to be used. I'll have a look at it!
from elevant.
I tested the REL linker on the included MSNBC benchmark with: python3 link_benchmark_entities.py test -l rel -b msnbc
within the docker container and had no issues. Maybe you installed a different REL version than the one specified in the requirements? pip list | grep radboud-el
should yield Version 0.0.1.
If that is not the issue, can you try to run the exact same command I used?
from elevant.
Sorry for the delay getting back to you.
Looks like the right version:
pip list | grep radboud-el
radboud-el 0.0.1
Running the exact same command that you did gives the same result:
python3 link_benchmark_entities.py test -l rel -b msnbc
2023-11-16 09:48:19 [INFO]: Loading config file configs/rel.config.json for linker rel.
2023-11-16 09:48:19 [INFO]: Initializing linker rel with config parameters {'linker_name': 'REL', 'wiki_version': 'wiki_2014', 'ner_model': 'ner-fast', 'use_api': False, 'api_url': 'https://rel.cs.ru.nl/api', 'experiment_description': 'Using the Wiki 2014 version and Flair for NER.'} ...
2023-11-16 09:48:22 [INFO]: Loading Wikipedia to Wikidata database from ./data/wikidata_mappings/wikipedia_name_to_qid.db ...
2023-11-16 09:48:25 [INFO]: -> 9279408 Wikipedia-Wikidata mappings loaded.
2023-11-16 09:48:25 [INFO]: Loading redirects database from ./data/wikipedia_mappings/redirects.db ...
2023-11-16 09:48:29 [INFO]: -> 10914101 redirects loaded.
2023-11-16 09:48:29,767 loading file /Users/alan/.flair/models/en-ner-fast-conll03-v0.4.pt
Traceback (most recent call last):
File "/Users/alan/repos/agolo/elevant/link_benchmark_entities.py", line 164, in <module>
main(cmdl_args)
File "/Users/alan/repos/agolo/elevant/link_benchmark_entities.py", line 40, in main
linking_system = LinkingSystem(args.linker_name,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alan/repos/agolo/elevant/src/linkers/linking_system.py", line 43, in __init__
self._initialize_linker(linker_name, prediction_file, prediction_format)
File "/Users/alan/repos/agolo/elevant/src/linkers/linking_system.py", line 174, in _initialize_linker
self.linker = RelLinker(self.entity_db, self.linker_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alan/repos/agolo/elevant/src/linkers/rel_linker.py", line 80, in __init__
self.ner_tagger = load_flair_ner(ner_model)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alan/repos/agolo/elevant/venv/lib/python3.11/site-packages/REL/ner/flair_wrapper.py", line 12, in load_flair_ner
return SequenceTagger.load(fetch_model(path_or_url, cache_root))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alan/repos/agolo/elevant/venv/lib/python3.11/site-packages/REL/utils.py", line 18, in fetch_model
return get_from_cache(path_or_url, cache_dir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alan/repos/agolo/elevant/venv/lib/python3.11/site-packages/flair/file_utils.py", line 215, in get_from_cache
response = requests.head(url, headers={"User-Agent": "Flair"}, allow_redirects=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alan/repos/agolo/elevant/venv/lib/python3.11/site-packages/requests/api.py", line 100, in head
return request("head", url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alan/repos/agolo/elevant/venv/lib/python3.11/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alan/repos/agolo/elevant/venv/lib/python3.11/site-packages/requests/sessions.py", line 575, in request
prep = self.prepare_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alan/repos/agolo/elevant/venv/lib/python3.11/site-packages/requests/sessions.py", line 486, in prepare_request
p.prepare(
File "/Users/alan/repos/agolo/elevant/venv/lib/python3.11/site-packages/requests/models.py", line 368, in prepare
self.prepare_url(url, params)
File "/Users/alan/repos/agolo/elevant/venv/lib/python3.11/site-packages/requests/models.py", line 439, in prepare_url
raise MissingSchema(
requests.exceptions.MissingSchema: Invalid URL 'ner-fast': No scheme supplied. Perhaps you meant https://ner-fast?
from elevant.
I have spent most of the morning trying to get the docker container built with no luck. It seems to need a lot of work before it can be used on a mac. After a few fixes I finally end up with a compilation error from grpcio which, based on issues on their repo, they have no intention of fixing.
I went back through the steps in the Dockerfile, running them manually in my own python env, and got issues with protobuf (see below). These were resolved by following the instructions here: https://stackoverflow.com/a/72494013
python3 link_benchmark_entities.py test -l rel -b msnbc
2023-11-16 12:08:32 [INFO]: Loading config file configs/rel.config.json for linker rel.
2023-11-16 12:08:32 [INFO]: Initializing linker rel with config parameters {'linker_name': 'REL', 'wiki_version': 'wiki_2014', 'ner_model': 'ner-fast', 'use_api': False, 'api_url': 'https://rel.cs.ru.nl/api', 'experiment_description': 'Using the Wiki 2014 version and Flair for NER.'} ...
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.11/site-packages/transformers/utils/import_utils.py", line 1086, in _get_module
return importlib.import_module("." + module_name, self.__name__)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/opt/homebrew/lib/python3.11/site-packages/transformers/trainer_utils.py", line 47, in <module>
import tensorflow as tf
File "/opt/homebrew/lib/python3.11/site-packages/tensorflow/__init__.py", line 38, in <module>
from tensorflow.python.tools import module_util as _module_util
File "/opt/homebrew/lib/python3.11/site-packages/tensorflow/python/__init__.py", line 37, in <module>
from tensorflow.python.eager import context
File "/opt/homebrew/lib/python3.11/site-packages/tensorflow/python/eager/context.py", line 29, in <module>
from tensorflow.core.framework import function_pb2
File "/opt/homebrew/lib/python3.11/site-packages/tensorflow/core/framework/function_pb2.py", line 5, in <module>
from google.protobuf.internal import builder as _builder
ImportError: cannot import name 'builder' from 'google.protobuf.internal' (/opt/homebrew/lib/python3.11/site-packages/google/protobuf/internal/__init__.py)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/alan/repos/agolo/elevant/link_benchmark_entities.py", line 164, in <module>
main(cmdl_args)
File "/Users/alan/repos/agolo/elevant/link_benchmark_entities.py", line 40, in main
linking_system = LinkingSystem(args.linker_name,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alan/repos/agolo/elevant/src/linkers/linking_system.py", line 43, in __init__
self._initialize_linker(linker_name, prediction_file, prediction_format)
File "/Users/alan/repos/agolo/elevant/src/linkers/linking_system.py", line 171, in _initialize_linker
from src.linkers.rel_linker import RelLinker
File "/Users/alan/repos/agolo/elevant/src/linkers/rel_linker.py", line 15, in <module>
from REL.mention_detection import MentionDetection
File "/opt/homebrew/lib/python3.11/site-packages/REL/mention_detection.py", line 1, in <module>
from flair.data import Sentence
File "/opt/homebrew/lib/python3.11/site-packages/flair/__init__.py", line 6, in <module>
from transformers import set_seed as hf_set_seed
File "<frozen importlib._bootstrap>", line 1229, in _handle_fromlist
File "/opt/homebrew/lib/python3.11/site-packages/transformers/utils/import_utils.py", line 1076, in __getattr__
module = self._get_module(self._class_to_module[name])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/transformers/utils/import_utils.py", line 1088, in _get_module
raise RuntimeError(
RuntimeError: Failed to import transformers.trainer_utils because of the following error (look up to see its traceback):
cannot import name 'builder' from 'google.protobuf.internal' (/opt/homebrew/lib/python3.11/site-packages/google/protobuf/internal/__init__.py)
from elevant.
But the original REL problem still exists, right?
I think the best course of action would be to try if the minimal example from RELs GitHub README works:
https://github.com/informagi/REL#using-rel-as-a-python-package
This should not be the case (it's also just calling tagger_ner = load_flair_ner("ner-fast")
, much like the code in ELEVANT here.
The base_url
in your case should be <data_directory>/linker_files/rel/
.
If that does not work, then it's probably best to open an issue in the REL repository.
One additional note: I assume the problem is, that for some reason when you're executing the code, load_flair_ner
ends up in this line:
https://github.com/informagi/REL/blob/03cc369ad4b5f834b531446cd91ef2b614ca5d87/src/REL/ner/flair_wrapper.py#L12
because the try
statement fails. Would be interesting to know, what the exception is with which it fails.
from elevant.
Closing this, since I assume this is solved or a problem with REL.
Feel free to reopen this if necessary.
from elevant.
Related Issues (14)
- Error while running evaluate_linking_results.py on new results file HOT 2
- Experiment working, but some parsing errors in the document display in GUI HOT 2
- Accidental experiment title cannot be expunged HOT 3
- GENRE using deprecated numpy attribute HOT 5
- Spacy model version issues? HOT 2
- Marking coref mentions in benchmark dataset HOT 4
- Article results not being displayed HOT 2
- Candidate set HOT 1
- Any plan of adding popular EL benchmarks HOT 3
- Error installing neuralcoref during docker build: Variables cannot be declared with 'cpdef'. Use 'cdef' instead. HOT 3
- Dependency conflict between radboud-el and xrenner HOT 4
- make download_all: alias_to_qids.db: truncated gzip input HOT 2
- Benchmark conversion from NIF format producing incorrect results HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elevant.