Skip to content

make gensim optional #2288

make gensim optional

make gensim optional #2288

Triggered via pull request July 13, 2024 15:19
Status Failure
Total duration 38m 3s
Artifacts

ci.yml

on: pull_request
Fit to window
Zoom out
Zoom in

Annotations

4 errors and 1 warning
test: flair/class_utils.py#L1
Black format check --- /home/runner/work/flair/flair/flair/class_utils.py 2024-07-13 15:19:13.040537+00:00 +++ /home/runner/work/flair/flair/flair/class_utils.py 2024-07-13 15:21:24.724802+00:00 @@ -20,20 +20,20 @@ return sub_cls raise ValueError(f"Could not find any class with name '{cls_name}'") @overload -def lazy_import(group: str, module: str, first_symbol: None) -> ModuleType: - ... +def lazy_import(group: str, module: str, first_symbol: None) -> ModuleType: ... @overload -def lazy_import(group: str, module: str, first_symbol: str, *symbols: str) -> List[Any]: - ... +def lazy_import(group: str, module: str, first_symbol: str, *symbols: str) -> List[Any]: ... -def lazy_import(group: str, module: str, first_symbol: Optional[str] = None, *symbols: str) -> Union[List[Any], ModuleType]: +def lazy_import( + group: str, module: str, first_symbol: Optional[str] = None, *symbols: str +) -> Union[List[Any], ModuleType]: try: imported_module = importlib.import_module(module) except ImportError: raise ImportError( f"Could not import {module}. Please install the optional '{group}' dependency. Via 'pip install flair[{group}]'"
test: flair/embeddings/token.py#L1
Black format check --- /home/runner/work/flair/flair/flair/embeddings/token.py 2024-07-13 15:19:13.044537+00:00 +++ /home/runner/work/flair/flair/flair/embeddings/token.py 2024-07-13 15:21:32.308720+00:00 @@ -1398,11 +1398,13 @@ self.spm.Load(str(model_file_path)) vectors = np.zeros((self.spm.vocab_size() + 1, dim)) if name is not None: self.name = name else: - raise ValueError("When only providing a SentencePieceProcessor, you need to specify a name for the BytePairEmbeddings") + raise ValueError( + "When only providing a SentencePieceProcessor, you need to specify a name for the BytePairEmbeddings" + ) else: if not language and model_file_path is None: raise ValueError("Need to specify model_file_path if no language is give in BytePairEmbeddings") (BPEmb,) = lazy_import("word-embeddings", "bpemb", "BPEmb")
test: flair/embeddings/token.py#L341
ruff pytest_ruff.RuffError: flair/embeddings/token.py:1:1: I001 [*] Import block is un-sorted or un-formatted | 1 | / import hashlib 2 | | import logging 3 | | import re 4 | | import tempfile 5 | | from collections import Counter 6 | | from pathlib import Path 7 | | from typing import Any, Dict, List, Optional, Union, Tuple 8 | | 9 | | import numpy as np 10 | | import torch 11 | | from deprecated.sphinx import deprecated 12 | | from sentencepiece import SentencePieceProcessor 13 | | from torch import nn 14 | | 15 | | import flair 16 | | from flair.class_utils import lazy_import 17 | | from flair.data import Corpus, Dictionary, Sentence, _iter_dataset 18 | | from flair.embeddings.base import TokenEmbeddings, load_embeddings, register_embeddings 19 | | from flair.embeddings.transformer import ( 20 | | TransformerEmbeddings, 21 | | TransformerOnnxWordEmbeddings, 22 | | ) 23 | | from flair.file_utils import cached_path, extract_single_zip_file, instance_lru_cache 24 | | 25 | | log = logging.getLogger("flair") | |_^ I001 | = help: Organize imports flair/embeddings/token.py:7:54: F401 [*] `typing.Tuple` imported but unused | 5 | from collections import Counter 6 | from pathlib import Path 7 | from typing import Any, Dict, List, Optional, Union, Tuple | ^^^^^ F401 8 | 9 | import numpy as np | = help: Remove unused import: `typing.Tuple`
test
Process completed with exit code 1.
test
The following actions uses Node.js version which is deprecated and will be forced to run on node20: actions/checkout@v3, actions/setup-python@v4, actions/cache@v3. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/