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

Add Selfcheckgpt evaluation to tasks #1080

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
change selfcheck to task.py
  • Loading branch information
PingNie1 committed Dec 16, 2023
commit be538e84bfd2fc8ff03a03213bca94fa54b29654
10 changes: 5 additions & 5 deletions lm_eval/tasks/selfcheckgpt/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ def process_results(self, doc, results):
passage = response_temperature_0,
sampled_passages = other_responses,
)
return {"avg": selfcheckgpt_scores["doc_level"]["avg_neg_logprob"],
"max": selfcheckgpt_scores["doc_level"]["avg_max_neg_logprob"]}
return {'avg-selfcheckgpt': selfcheckgpt_scores['doc_level']['avg_neg_logprob'],
'max-selfcheckgpt': selfcheckgpt_scores['doc_level']['avg_max_neg_logprob']}

elif self.selfcheckgpt_type == 'SelfCheckBERTScore':
selfcheckgpt_scores = self.selfcheckgpt.predict(
Expand All @@ -126,20 +126,20 @@ def process_results(self, doc, results):
selfcheckgpt_scores_avg = sum(selfcheckgpt_scores) / len(selfcheckgpt_scores) if len(selfcheckgpt_scores) > 0 else 0
selfcheckgpt_scores_max = max(selfcheckgpt_scores)

return {'avg': selfcheckgpt_scores_avg, 'max': selfcheckgpt_scores_max}
return {'avg-selfcheckgpt': selfcheckgpt_scores_avg, 'max-selfcheckgpt': selfcheckgpt_scores_max}

def aggregation(self):
"""
:returns: {str: [float] -> float}
A dictionary where keys are the names of submetrics and values are
functions that aggregate a list of metrics
"""
return {k: mean for k in ["avg", "max"]}
return {k: mean for k in ["avg-selfcheckgpt", "max-selfcheckgpt"]}

def higher_is_better(self):
"""
:returns: {str: bool}
A dictionary where keys are the names of submetrics and values are
whether a higher value of the submetric is better
"""
return {k: False for k in ["avg", "max"]}
return {k: False for k in ["avg-selfcheckgpt", "max-selfcheckgpt"]}