Entity Mention Linker #2083
Annotations
10 errors and 1 warning
test
The runner has received a shutdown signal. This can happen when the runner service is stopped, or a manually started runner is canceled.
|
test:
flair/data.py#L1
Black format check
--- /home/runner/work/flair/flair/flair/data.py 2024-01-29 15:25:12.114138+00:00
+++ /home/runner/work/flair/flair/flair/data.py 2024-01-29 15:27:29.502981+00:00
@@ -1042,16 +1042,14 @@
def get_span(self, start: int, stop: int):
span_slice = slice(start, stop)
return self[span_slice]
@typing.overload
- def __getitem__(self, idx: int) -> Token:
- ...
+ def __getitem__(self, idx: int) -> Token: ...
@typing.overload
- def __getitem__(self, s: slice) -> Span:
- ...
+ def __getitem__(self, s: slice) -> Span: ...
def __getitem__(self, subscript):
if isinstance(subscript, slice):
return Span(self.tokens[subscript])
else:
|
test:
flair/file_utils.py#L1
Black format check
--- /home/runner/work/flair/flair/flair/file_utils.py 2024-01-29 15:25:12.118138+00:00
+++ /home/runner/work/flair/flair/flair/file_utils.py 2024-01-29 15:27:37.083475+00:00
@@ -1,6 +1,7 @@
"""Utilities for working with the local dataset cache. Copied from AllenNLP."""
+
import base64
import functools
import io
import logging
import mmap
|
test:
flair/models/entity_linker_model.py#L1
Black format check
--- /home/runner/work/flair/flair/flair/models/entity_linker_model.py 2024-01-29 15:25:12.118138+00:00
+++ /home/runner/work/flair/flair/flair/models/entity_linker_model.py 2024-01-29 15:27:38.105155+00:00
@@ -106,13 +106,13 @@
**classifierargs: The arguments propagated to :meth:`flair.nn.DefaultClassifier.__init__`
"""
super().__init__(
embeddings=embeddings,
label_dictionary=label_dictionary,
- final_embedding_size=embeddings.embedding_length * 2
- if pooling_operation == "first_last"
- else embeddings.embedding_length,
+ final_embedding_size=(
+ embeddings.embedding_length * 2 if pooling_operation == "first_last" else embeddings.embedding_length
+ ),
**classifierargs,
)
self.pooling_operation = pooling_operation
self._label_type = label_type
|
test:
flair/models/entity_mention_linking.py#L1
Black format check
--- /home/runner/work/flair/flair/flair/models/entity_mention_linking.py 2024-01-29 15:25:12.118138+00:00
+++ /home/runner/work/flair/flair/flair/models/entity_mention_linking.py 2024-01-29 15:27:38.775480+00:00
@@ -441,13 +441,15 @@
}
@classmethod
def _from_state(cls, state_dict: Dict[str, Any]) -> "EntityPreprocessor":
return cls(
- preprocessor=None
- if state_dict["preprocessor"] is None
- else EntityPreprocessor._from_state(state_dict["preprocessor"]),
+ preprocessor=(
+ None
+ if state_dict["preprocessor"] is None
+ else EntityPreprocessor._from_state(state_dict["preprocessor"])
+ ),
)
class CandidateSearchIndex(ABC):
"""Base class for a candidate generator.
@@ -901,13 +903,15 @@
# Preprocess entity mentions
for entity in entities_mentions:
data_points.append(entity.data_point)
mentions.append(
- self.preprocessor.process_mention(entity.data_point.text, sentence)
- if self.preprocessor is not None
- else entity.data_point.text,
+ (
+ self.preprocessor.process_mention(entity.data_point.text, sentence)
+ if self.preprocessor is not None
+ else entity.data_point.text
+ ),
)
# Retrieve top-k concept / entity candidates
for i in range(0, len(mentions), batch_size):
candidates = self.candidate_generator.search(entity_mentions=mentions[i : i + batch_size], top_k=top_k)
|
test:
flair/models/entity_mention_linking.py#L345
ruff
pytest_ruff.RuffError: flair/models/entity_mention_linking.py:1161:24: C401 Unnecessary generator (rewrite as a `set` comprehension)
|
1159 | spans = sentence.get_spans(gold_label_type)
1160 | for span in spans:
1161 | exps = set(exp.value for exp in span.get_labels(gold_label_type) if exp.value not in exclude_labels)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C401
1162 |
1163 | predictions = set(pred.value for pred in span.get_labels("predicted"))
|
= help: Rewrite as a `set` comprehension
flair/models/entity_mention_linking.py:1163:31: C401 Unnecessary generator (rewrite as a `set` comprehension)
|
1161 | exps = set(exp.value for exp in span.get_labels(gold_label_type) if exp.value not in exclude_labels)
1162 |
1163 | predictions = set(pred.value for pred in span.get_labels("predicted"))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C401
1164 | total += 1
1165 | if exps & predictions:
|
= help: Rewrite as a `set` comprehension
|
test:
flair/nn/distance/euclidean.py#L1
Black format check
--- /home/runner/work/flair/flair/flair/nn/distance/euclidean.py 2024-01-29 15:25:12.122138+00:00
+++ /home/runner/work/flair/flair/flair/nn/distance/euclidean.py 2024-01-29 15:27:44.259064+00:00
@@ -14,11 +14,10 @@
It was published under MIT License:
https://github.com/asappresearch/dynamic-classification/blob/master/LICENSE.md
Source: https://github.com/asappresearch/dynamic-classification/blob/55beb5a48406c187674bea40487c011e8fa45aab/distance/euclidean.py
"""
-
import torch
from torch import Tensor, nn
|
test:
flair/nn/model.py#L1
Black format check
--- /home/runner/work/flair/flair/flair/nn/model.py 2024-01-29 15:25:12.122138+00:00
+++ /home/runner/work/flair/flair/flair/nn/model.py 2024-01-29 15:27:45.300179+00:00
@@ -699,13 +699,15 @@
device=flair.device,
)
else:
return torch.tensor(
[
- self.label_dictionary.get_idx_for_item(label[0])
- if len(label) > 0
- else self.label_dictionary.get_idx_for_item("O")
+ (
+ self.label_dictionary.get_idx_for_item(label[0])
+ if len(label) > 0
+ else self.label_dictionary.get_idx_for_item("O")
+ )
for label in labels
],
dtype=torch.long,
device=flair.device,
)
|
test:
tests/embeddings/test_transformer_word_embeddings.py#L149
TestTransformerWordEmbeddings.test_layoutlm_embeddings[False]
OSError: Unable to load weights from pytorch checkpoint file for './cache/transformers/hub/models--microsoft--layoutlm-base-uncased/snapshots/8290fe08a848303616911d513e66ec192840ffbd/pytorch_model.bin' at './cache/transformers/hub/models--microsoft--layoutlm-base-uncased/snapshots/8290fe08a848303616911d513e66ec192840ffbd/pytorch_model.bin'. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.
|
test
The operation was canceled.
|
test
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v3, actions/setup-python@v4, actions/cache@v3. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
|