From 1c114549a2d441f245af23e72bb4097267f0aef0 Mon Sep 17 00:00:00 2001 From: Alexey Gorbatovski Date: Thu, 17 Oct 2024 19:23:45 +0300 Subject: [PATCH] fix liners --- turbo_alignment/metrics/distinctness.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/turbo_alignment/metrics/distinctness.py b/turbo_alignment/metrics/distinctness.py index 4f1f206..2e49e73 100755 --- a/turbo_alignment/metrics/distinctness.py +++ b/turbo_alignment/metrics/distinctness.py @@ -1,8 +1,8 @@ from collections import defaultdict +from transformers.tokenization_utils_base import PreTrainedTokenizerBase from turbo_alignment.metrics.metric import Metric from turbo_alignment.settings.metric import ElementWiseScores, MetricResults, MetricType -from transformers.tokenization_utils_base import PreTrainedTokenizerBase @Metric.register(MetricType.DIST_N) @@ -48,7 +48,7 @@ def distinctness(answers: list[str], vocab_size: int) -> dict[str, float]: ngram_sets[n].update(ngrams) total_ngrams[n] += len(ngrams) - result = dict() + result = {} for n in range(5): result[f'dist_{n+1}'] = len(ngram_sets[n]) / total_ngrams[n] if total_ngrams[n] > 0 else 0 try: