diff --git a/flair/embeddings/image.py b/flair/embeddings/image.py index 6a14a0e009..faf3a78b17 100644 --- a/flair/embeddings/image.py +++ b/flair/embeddings/image.py @@ -73,7 +73,7 @@ class PrecomputedImageEmbeddings(ImageEmbeddings): def __init__(self, url2tensor_dict, name) -> None: self.url2tensor_dict = url2tensor_dict self.name = name - self.__embedding_length = len(list(self.url2tensor_dict.values())[0]) + self.__embedding_length = len(next(iter(self.url2tensor_dict.values()))) self.static_embeddings = True super().__init__() diff --git a/flair/models/multitask_model.py b/flair/models/multitask_model.py index 98cda7b4a9..d7fb262da7 100644 --- a/flair/models/multitask_model.py +++ b/flair/models/multitask_model.py @@ -116,7 +116,7 @@ def split_batch_to_task_ids(sentences: Union[List[Sentence], Sentence], all_task batch_to_task_mapping[multitask_id.value] = [sentence_id] return batch_to_task_mapping - def evaluate( + def evaluate( # type: ignore[override] self, data_points, gold_label_type: str, diff --git a/flair/trainers/trainer.py b/flair/trainers/trainer.py index 9f992763c5..2968775678 100644 --- a/flair/trainers/trainer.py +++ b/flair/trainers/trainer.py @@ -454,7 +454,7 @@ def train_custom( if inspect.isclass(sampler): sampler = sampler() # set dataset to sample from - sampler.set_dataset(train_data) + sampler.set_dataset(train_data) # type: ignore[union-attr] shuffle = False # this field stores the names of all dynamic embeddings in the model (determined after first forward pass) diff --git a/tests/test_datasets.py b/tests/test_datasets.py index 91a1742f85..de365d023d 100644 --- a/tests/test_datasets.py +++ b/tests/test_datasets.py @@ -748,7 +748,7 @@ def test_masakhane_corpus(tasks_base_path): "bam": {"train": 4462, "dev": 638, "test": 1274}, "bbj": {"train": 3384, "dev": 483, "test": 966}, "ewe": {"train": 3505, "dev": 501, "test": 1001}, - "fon": {"train": 4343, "dev": 621, "test": 1240}, + "fon": {"train": 4343, "dev": 623, "test": 1240}, "hau": {"train": 5716, "dev": 816, "test": 1633}, "ibo": {"train": 7634, "dev": 1090, "test": 2181}, "kin": {"train": 7825, "dev": 1118, "test": 2235},