Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ci improvement #3

Merged
merged 3 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,19 @@ jobs:
key: venv-${{ hashFiles('poetry.lock') }}

- name: Install the project dependencies
run: poetry install
run: poetry install --all-extras

- name: Check formatting with black
run: poetry run black .

- name: Run type checker
run: poetry run mypy --follow-imports=skip --check-untyped-defs .

- name: Run ruff linter
run: poetry run ruff check .

- name: Run pylint linter
run: poetry run pylint knowledge_verificator/

- name: Run the automated test
run: poetry run pytest -v
8 changes: 3 additions & 5 deletions knowledge_verificator/nli.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"""Natural Language Inference module with pre-trained RoBERTa-Large."""

from enum import Enum
import operator
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
import warnings
import logging
from transformers import AutoTokenizer, AutoModelForSequenceClassification # type: ignore
import torch


class Relation(Enum):
Expand Down Expand Up @@ -78,12 +77,11 @@ def infer(

entailment = round(predicted_probability[0], precision)
neutral = round(predicted_probability[1], precision)
contradiction = round(1. - entailment - neutral, precision)

return {
Relation.ENTAILMENT : entailment,
Relation.NEUTRAL : neutral,
Relation.CONTRADICTION : contradiction,
Relation.CONTRADICTION : round(1. - entailment - neutral, precision)
}

def infer_relation(
Expand Down
Loading
Loading