Skip to content

Commit

Permalink
fix liners
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Gorbatovski authored and Alexey Gorbatovski committed Oct 17, 2024
1 parent 3ff9145 commit 1c11454
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions turbo_alignment/metrics/distinctness.py
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 1c11454

Please sign in to comment.