Entity Mention Linker #2060
Triggered via pull request
December 24, 2023 13:37
Status
Failure
Total duration
18m 27s
Artifacts
–
Annotations
8 errors
test:
flair/__init__.py#L1
mypy-status
mypy exited with status 1.
|
test:
flair/models/__init__.py#L341
ruff
pytest_ruff.RuffError: flair/models/__init__.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | / from .clustering import ClusteringModel
2 | | from .entity_mention_linking import EntityMentionLinker
3 | | from .entity_linker_model import SpanClassifier
4 | | from .language_model import LanguageModel
5 | | from .lemmatizer_model import Lemmatizer
6 | | from .multitask_model import MultitaskModel
7 | | from .pairwise_classification_model import TextPairClassifier
8 | | from .pairwise_regression_model import TextPairRegressor
9 | | from .regexp_tagger import RegexpTagger
10 | | from .relation_classifier_model import RelationClassifier
11 | | from .relation_extractor_model import RelationExtractor
12 | | from .sequence_tagger_model import SequenceTagger
13 | | from .tars_model import FewshotClassifier, TARSClassifier, TARSTagger
14 | | from .text_classification_model import TextClassifier
15 | | from .text_regression_model import TextRegressor
16 | | from .word_tagger_model import TokenClassifier, WordTagger
17 | |
18 | | __all__ = [
| |_^ I001
19 | "EntityMentionLinker",
20 | "SpanClassifier",
|
= help: Organize imports
|
test:
flair/models/entity_mention_linking.py#L341
ruff
pytest_ruff.RuffError: flair/models/entity_mention_linking.py:831:9: D200 One-line docstring should fit on one line
|
829 | dataset_name: Optional[str] = None,
830 | ) -> "EntityMentionLinker":
831 | """Loads a model for biomedical named entity normalization.
| _________^
832 | |
833 | | """
| |___________^ D200
834 | if not isinstance(model_name_or_path, str):
835 | raise ValueError(f"String matching model name has to be an string (and not {type(model_name_or_path)}")
|
= help: Reformat to one line
|
test:
flair/models/entity_mention_linking.py#L1
flair/models/entity_mention_linking.py
672: error: List comprehension has incompatible type List[Embeddings[Any]]; expected List[DocumentEmbeddings] [misc]
|
test:
flair/models/entity_mention_linking.py#L1
Black format check
--- /home/runner/work/flair/flair/flair/models/entity_mention_linking.py 2023-12-24 13:37:14.924253+00:00
+++ /home/runner/work/flair/flair/flair/models/entity_mention_linking.py 2023-12-24 13:40:03.664110+00:00
@@ -90,11 +90,10 @@
MODEL_NAME_TO_DICTIONARY = {
"dmis-lab/biosyn-sapbert-bc5cdr-disease": "ctd-disease",
"dmis-lab/biosyn-sapbert-ncbi-disease": "ctd-disease",
"dmis-lab/biosyn-sapbert-bc5cdr-chemical": "ctd-chemical",
"dmis-lab/biosyn-sapbert-bc2gn": "ncbi-gene",
-
"dmis-lab/biosyn-biobert-bc5cdr-disease": "ctd-chemical",
"dmis-lab/biosyn-biobert-ncbi-disease": "ctd-disease",
"dmis-lab/biosyn-biobert-bc5cdr-chemical": "ctd-chemical",
"dmis-lab/biosyn-biobert-bc2gn": "ncbi-gene",
}
@@ -788,11 +787,10 @@
if model_name in hf_model_map:
model_name = hf_model_map[model_name]
return hf_download(model_name)
-
@classmethod
def _init_model_with_state_dict(cls, state: Dict[str, Any], **kwargs) -> "EntityMentionLinker":
candidate_generator = CandidateSearchIndex._from_state(state["candidate_search_index"])
preprocessor = EntityPreprocessor._from_state(state["entity_preprocessor"])
entity_label_type = state["entity_label_type"]
@@ -826,13 +824,11 @@
sparse_weight: float = DEFAULT_SPARSE_WEIGHT,
entity_type: Optional[str] = None,
dictionary: Optional[EntityLinkingDictionary] = None,
dataset_name: Optional[str] = None,
) -> "EntityMentionLinker":
- """Loads a model for biomedical named entity normalization.
-
- """
+ """Loads a model for biomedical named entity normalization."""
if not isinstance(model_name_or_path, str):
raise ValueError(f"String matching model name has to be an string (and not {type(model_name_or_path)}")
model_name_or_path = cast(str, model_name_or_path)
if dictionary is None:
|
test:
flair/models/sequence_tagger_model.py#L341
ruff
pytest_ruff.RuffError: flair/models/sequence_tagger_model.py:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | / import logging
2 | | import tempfile
3 | | from pathlib import Path
4 | | from typing import Any, Dict, List, Optional, Tuple, Union, cast
5 | | from urllib.error import HTTPError
6 | |
7 | | import torch
8 | | import torch.nn
9 | | import torch.nn.functional as F
10 | | from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
11 | | from tqdm import tqdm
12 | |
13 | | import flair.nn
14 | | from flair.data import Dictionary, Label, Sentence, Span, get_spans_from_bio
15 | | from flair.datasets import DataLoader, FlairDatapointDataset
16 | | from flair.embeddings import TokenEmbeddings
17 | | from flair.file_utils import cached_path, unzip_file, hf_download
18 | | from flair.models.sequence_tagger_utils.crf import CRF
19 | | from flair.models.sequence_tagger_utils.viterbi import ViterbiDecoder, ViterbiLoss
20 | | from flair.training_utils import store_embeddings
21 | |
22 | | log = logging.getLogger("flair")
| |_^ I001
|
= help: Organize imports
flair/models/sequence_tagger_model.py:5:26: F401 [*] `urllib.error.HTTPError` imported but unused
|
3 | from pathlib import Path
4 | from typing import Any, Dict, List, Optional, Tuple, Union, cast
5 | from urllib.error import HTTPError
| ^^^^^^^^^ F401
6 |
7 | import torch
|
= help: Remove unused import: `urllib.error.HTTPError`
flair/models/sequence_tagger_model.py:767:9: F841 Local variable `get_from_model_hub` is assigned to but never used
|
765 | cache_dir = Path("models")
766 |
767 | get_from_model_hub = False
| ^^^^^^^^^^^^^^^^^^ F841
768 |
769 | # check if model name is a valid local file
|
= help: Remove assignment to unused variable `get_from_model_hub`
|
test:
tests/test_biomedical_entity_linking.py#L58
test_biomedical_entity_linking[False]
OSError: [Errno 39] Directory not empty: 'cache/flair/models/bio-genes'
|
test
Process completed with exit code 1.
|