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

feat(gptscore): add gptscore support #5

Merged
merged 7 commits into from
Oct 25, 2023
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
72 changes: 63 additions & 9 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ tensorflow = {version = "^2.14.0", platform = "linux"}
tensorflow-macos = {version = "^2.14.0", platform = "darwin"}
elemeta = "1.0.7"
torch = ">=2.0.0, !=2.0.1, !=2.1.0"
openai = "^0.28.1"
huggingface-hub = "^0.18.0"
llama-cpp-python = "^0.2.11"
en-core-web-sm = {url = "https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.7.0/en_core_web_sm-3.7.0-py3-none-any.whl"}
fr-core-news-sm = {url = "https://github.com/explosion/spacy-models/releases/download/fr_core_news_sm-3.7.0/fr_core_news_sm-3.7.0-py3-none-any.whl"}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ class BERTScore:
def __init__(self, lan="en", model_type=None):
"""
BERTScore computes a similarity score for each token in the candidate sentence with each
token in the reference sentence. The final score is the average of the similarity scores of
all tokens in the candidate sentence.
token in the reference sentence.
The final score is the average of the similarity scores of all tokens in the candidate sentence.

Args:
lan (str, optional): language to use. Defaults to "en", It may also be "fr". Depending
Expand Down Expand Up @@ -51,8 +51,9 @@ def compute(self, references, predictions, **kwargs):
class MAUVE:
def __init__(self, featurize_model_name="gpt2"):
"""
MAUVE score computes the difference between the candidate sentence distribution and the
reference sentence distribution. The bigger the MAUVE score, the better.
MAUVE score computes the difference between the candidate sentence distribution
and the reference sentence distribution.
The bigger the MAUVE score, the better.
"""
self.metric = load("mauve")
self.featurize_model_name = featurize_model_name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
AutoTokenizer,
)

from saga_llm_evaluation_ml.model.helpers.embedding_metrics import BERTScore
from saga_llm_evaluation_ml.model.helpers.utils import (
from saga_llm_evaluation_ml.helpers.embedding_metrics import BERTScore
from saga_llm_evaluation_ml.helpers.utils import (
INVALID_QUESTION,
NO_ANS,
filter_questions,
Expand Down
Loading
Loading