Skip to content

Commit

Permalink
Remove use_hhem, pytorch is hard to install in cpu-only linux aarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
rogeriochaves committed Jan 6, 2025
1 parent 6162a07 commit 8fed473
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 394 deletions.
13 changes: 2 additions & 11 deletions evaluators/ragas/langevals_ragas/faithfulness.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
prepare_llm,
)
from pydantic import Field
from ragas.metrics import Faithfulness, FaithfulnesswithHHEM
from ragas.metrics import Faithfulness
from langchain_core.prompt_values import StringPromptValue


Expand All @@ -37,10 +37,6 @@ class RagasFaithfulnessResult(EvaluationResult):


class RagasFaithfulnessSettings(RagasSettings):
use_hhem: bool = Field(
default=False,
description="Whether to use Vectara's HHEM-2.1-Open for faithfulness scoring.",
)
autodetect_dont_know: bool = Field(
default=True,
description="Whether to autodetect 'I don't know' in the output to avoid failing the evaluation.",
Expand All @@ -63,11 +59,6 @@ class RagasFaithfulnessEvaluator(
docs_url = "https://docs.ragas.io/en/stable/concepts/metrics/available_metrics/faithfulness/"
is_guardrail = False

@classmethod
def preload(cls):
cls.faithfulnessHHEM = FaithfulnesswithHHEM()
super().preload()

def evaluate(self, entry: RagasFaithfulnessEntry) -> SingleEvaluationResult:
llm, _ = prepare_llm(self, self.settings)

Expand All @@ -81,7 +72,7 @@ def evaluate(self, entry: RagasFaithfulnessEntry) -> SingleEvaluationResult:
if skip:
return skip

scorer = self.faithfulnessHHEM if self.settings.use_hhem else Faithfulness()
scorer = Faithfulness()
scorer.llm = llm

_original_create_statements = scorer._create_statements
Expand Down
Loading

0 comments on commit 8fed473

Please sign in to comment.