mirror of
https://github.com/open-compass/opencompass.git
synced 2025-05-30 16:03:24 +08:00
[Update] Safe SmolInstruct meteor calculation (#2033)
This commit is contained in:
parent
455bb05d1b
commit
bf74f26603
@ -409,7 +409,13 @@ class MeteorEvaluator(BaseEvaluator):
|
||||
avg_score = 0
|
||||
details = []
|
||||
for pred, ans in zip(predictions, references):
|
||||
score = meteor_score([ans.split()], pred.split())
|
||||
try:
|
||||
score = (meteor_score([ans.split()], pred.split())
|
||||
if ans and pred else 0.0)
|
||||
except AttributeError:
|
||||
logging.error(f'Failed to compute METEOR'
|
||||
f"score:\npred='{pred}'\nans='{ans}'")
|
||||
score = 0.0
|
||||
avg_score += score
|
||||
detail = {'pred': pred, 'answer': ans, 'score': score}
|
||||
details.append(detail)
|
||||
|
Loading…
Reference in New Issue
Block a user