From 033398f6aeb4aa88c3ed7506e393fdbab9f6a507 Mon Sep 17 00:00:00 2001 From: Benedikt Fuchs Date: Fri, 6 Oct 2023 22:29:13 +0200 Subject: [PATCH 1/8] add ci to delete old workflow runs --- .github/workflows/ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 62eddad8a..750f32a9e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,14 @@ on: branches: [master] jobs: + steps: + - name: Delete workflow runs + uses: MajorScruffy/delete-old-workflow-runs@v0.2.0 + with: + repository: flairNLP/flair + older-than-seconds: 21600000 # 8 months -> 8 * 30 * 25 * 60 * 60 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} test: runs-on: ubuntu-latest env: From b690fc83d6117e378a3cb375ba75cc20088d2668 Mon Sep 17 00:00:00 2001 From: Benedikt Fuchs Date: Fri, 6 Oct 2023 22:33:51 +0200 Subject: [PATCH 2/8] add ci to delete old workflow runs --- .github/workflows/ci.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 750f32a9e..a7d38779b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,14 +5,16 @@ on: branches: [master] jobs: - steps: - - name: Delete workflow runs - uses: MajorScruffy/delete-old-workflow-runs@v0.2.0 - with: - repository: flairNLP/flair - older-than-seconds: 21600000 # 8 months -> 8 * 30 * 25 * 60 * 60 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + delete: + runs-on: ubuntu-latest + steps: + - name: Delete workflow runs + uses: MajorScruffy/delete-old-workflow-runs@v0.2.0 + with: + repository: flairNLP/flair + older-than-seconds: 21600000 # 8 months -> 8 * 30 * 25 * 60 * 60 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} test: runs-on: ubuntu-latest env: From a81e1e62c9d0c5a5161b9e8caf3cc77494e5630a Mon Sep 17 00:00:00 2001 From: Benedikt Fuchs Date: Fri, 6 Oct 2023 22:56:17 +0200 Subject: [PATCH 3/8] cleanup disk space on github action --- .github/workflows/ci.yml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a7d38779b..4eb8880a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,16 +5,6 @@ on: branches: [master] jobs: - delete: - runs-on: ubuntu-latest - steps: - - name: Delete workflow runs - uses: MajorScruffy/delete-old-workflow-runs@v0.2.0 - with: - repository: flairNLP/flair - older-than-seconds: 21600000 # 8 months -> 8 * 30 * 25 * 60 * 60 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} test: runs-on: ubuntu-latest env: @@ -27,6 +17,11 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.8 + - name: Cleanup Disk Space + - run: | + sudo swapoff -a + sudo rm -f /swapfile + sudo apt clean - name: Install Flair dependencies run: pip install -e . - name: Install unittest dependencies From b5076bb1fff49342524221c58513ed340a37494b Mon Sep 17 00:00:00 2001 From: Benedikt Fuchs Date: Fri, 6 Oct 2023 22:57:18 +0200 Subject: [PATCH 4/8] cleanup disk space on github action --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4eb8880a5..9e5dd862e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: with: python-version: 3.8 - name: Cleanup Disk Space - - run: | + run: | sudo swapoff -a sudo rm -f /swapfile sudo apt clean From 9e6ff65850a4e58344d25604110764ca7861be41 Mon Sep 17 00:00:00 2001 From: Benedikt Fuchs Date: Mon, 9 Oct 2023 12:51:21 +0200 Subject: [PATCH 5/8] use torch cpu on cicd --- .github/workflows/ci.yml | 7 ++----- .github/workflows/publish-docs.yml | 2 ++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e5dd862e..ce30e78f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,11 +17,8 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.8 - - name: Cleanup Disk Space - run: | - sudo swapoff -a - sudo rm -f /swapfile - sudo apt clean + - name: Install Torch cpu + run: pip install torch --index-url https://download.pytorch.org/whl/cpu - name: Install Flair dependencies run: pip install -e . - name: Install unittest dependencies diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 5c83adc85..24a424adb 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -18,6 +18,8 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ env.python-version }} + - name: Install Torch cpu + run: pip install torch --index-url https://download.pytorch.org/whl/cpu - name: Install Flair dependencies run: pip install -e . - name: Install unittest dependencies From 247c5ab1196f12004147d5f51f75343bbcf915d0 Mon Sep 17 00:00:00 2001 From: Benedikt Fuchs Date: Mon, 9 Oct 2023 13:12:07 +0200 Subject: [PATCH 6/8] fix issue condition --- .github/workflows/issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index 772773c25..403e16c56 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -3,7 +3,7 @@ on: issue_comment jobs: issue_commented: name: Issue comment - if: ${{ !github.event.issue.pull_request && github.event.issue.author == github.even.issue_comment.author }} + if: ${{ github.event.issue.pull_request && github.event.issue.author == github.even.issue_comment.author }} runs-on: ubuntu-latest steps: - uses: actions-ecosystem/action-remove-labels@v1 From 682dad835433e9ba87c65a5e49e7eb76cd21e4dc Mon Sep 17 00:00:00 2001 From: Benedikt Fuchs Date: Mon, 9 Oct 2023 13:34:13 +0200 Subject: [PATCH 7/8] remove pass statements --- flair/datasets/base.py | 1 - flair/datasets/biomedical.py | 1 - flair/embeddings/document.py | 1 - flair/embeddings/image.py | 1 - flair/embeddings/legacy.py | 1 - 5 files changed, 5 deletions(-) diff --git a/flair/datasets/base.py b/flair/datasets/base.py index ca6ead406..2ba0aabab 100644 --- a/flair/datasets/base.py +++ b/flair/datasets/base.py @@ -156,7 +156,6 @@ def __init__( log.warning('ATTENTION! The library "pymongo" is not installed!') log.warning('To use MongoDataset, please first install with "pip install pymongo"') log.warning("-" * 100) - pass self.in_memory = in_memory self.tokenizer = tokenizer diff --git a/flair/datasets/biomedical.py b/flair/datasets/biomedical.py index 2ce701d51..b0289c098 100644 --- a/flair/datasets/biomedical.py +++ b/flair/datasets/biomedical.py @@ -132,7 +132,6 @@ def filter_and_map_entities( new_entities.append(new_entity) else: logging.debug(f"Skip entity type {entity.type}") - pass mapped_entities_per_document[id] = new_entities return InternalBioNerDataset(documents=dataset.documents, entities_per_document=mapped_entities_per_document) diff --git a/flair/embeddings/document.py b/flair/embeddings/document.py index 8779d418e..c1e73442e 100644 --- a/flair/embeddings/document.py +++ b/flair/embeddings/document.py @@ -556,7 +556,6 @@ def __init__( log.warning('ATTENTION! The library "sentence-transformers" is not installed!') log.warning('To use Sentence Transformers, please first install with "pip install sentence-transformers"') log.warning("-" * 100) - pass self.model_name = model self.model = SentenceTransformer( diff --git a/flair/embeddings/image.py b/flair/embeddings/image.py index faf3a78b1..ae4d68fa4 100644 --- a/flair/embeddings/image.py +++ b/flair/embeddings/image.py @@ -104,7 +104,6 @@ def __init__(self, name, pretrained=True, transforms=None) -> None: log.warning('ATTENTION! The library "torchvision" is not installed!') log.warning('To use convnets pretraned on ImageNet, please first install with "pip install torchvision"') log.warning("-" * 100) - pass model_info = { "resnet50": (torchvision.models.resnet50, lambda x: list(x)[:-1], 2048), diff --git a/flair/embeddings/legacy.py b/flair/embeddings/legacy.py index 6096fa758..b2658e2d2 100644 --- a/flair/embeddings/legacy.py +++ b/flair/embeddings/legacy.py @@ -40,7 +40,6 @@ def __init__( log.warning('ATTENTION! The library "allennlp" is not installed!') log.warning('To use ELMoEmbeddings, please first install with "pip install allennlp==0.9.0"') log.warning("-" * 100) - pass assert embedding_mode in ["all", "top", "average"] From 40b700a3fbab42fa16012221bc58a6f40dbe9fac Mon Sep 17 00:00:00 2001 From: Benedikt Fuchs Date: Mon, 9 Oct 2023 14:40:07 +0200 Subject: [PATCH 8/8] reduce ci log size --- .github/workflows/ci.yml | 2 +- flair/embeddings/image.py | 2 +- flair/optim.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce30e78f3..9d9741401 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,4 +33,4 @@ jobs: - name: Run tests run: | python -c 'import flair' - pytest --runintegration --durations=0 -vv + pytest --runintegration -vv diff --git a/flair/embeddings/image.py b/flair/embeddings/image.py index ae4d68fa4..df6d1fadd 100644 --- a/flair/embeddings/image.py +++ b/flair/embeddings/image.py @@ -31,7 +31,7 @@ def embedding_type(self) -> str: def to_params(self) -> Dict[str, Any]: # legacy pickle-like saving for image embeddings, as implementation details are not obvious - return self.__getstate__() # type: ignore[operator] + return self.__getstate__() @classmethod def from_params(cls, params: Dict[str, Any]) -> "Embeddings": diff --git a/flair/optim.py b/flair/optim.py index c41e1b54c..4c2f88052 100644 --- a/flair/optim.py +++ b/flair/optim.py @@ -3,7 +3,7 @@ import torch from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR, ReduceLROnPlateau, _LRScheduler -from torch.optim.optimizer import required # type: ignore[attr-defined] +from torch.optim.optimizer import required log = logging.getLogger("flair")