calc RAP
Browse files
README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
emoji: 💬
|
4 |
colorFrom: yellow
|
5 |
colorTo: purple
|
6 |
sdk: gradio
|
7 |
-
sdk_version:
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
|
|
1 |
---
|
2 |
+
title: RAP
|
3 |
emoji: 💬
|
4 |
colorFrom: yellow
|
5 |
colorTo: purple
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 4.36.1
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
app.py
CHANGED
@@ -98,8 +98,9 @@ def chat(
|
|
98 |
partial_text += f"1. EWC Repetition Score: {whitespace_score:.3f}\n"
|
99 |
partial_text += f"1. Text Repetition Score: {repetition_score:.3f}\n"
|
100 |
partial_text += f"1. Total Repetitions: {total_repetitions:.3f}\n"
|
|
|
101 |
partial_text += (
|
102 |
-
f"1. Repetition Ratio: {
|
103 |
)
|
104 |
|
105 |
if index >= 0: # RAG
|
@@ -113,7 +114,10 @@ def chat(
|
|
113 |
partial_text += "\n\n Performance Metrics:\n"
|
114 |
partial_text += f'1. BLEU-1: {scores["bleu_scores"]["bleu"]:.3f}\n'
|
115 |
partial_text += f'1. RougeL: {scores["rouge_scores"]["rougeL"]:.3f}\n'
|
116 |
-
|
|
|
|
|
|
|
117 |
|
118 |
partial_text += f"\n\nGround truth: {questions[index][key][0]}\n"
|
119 |
|
|
|
98 |
partial_text += f"1. EWC Repetition Score: {whitespace_score:.3f}\n"
|
99 |
partial_text += f"1. Text Repetition Score: {repetition_score:.3f}\n"
|
100 |
partial_text += f"1. Total Repetitions: {total_repetitions:.3f}\n"
|
101 |
+
rr = total_repetitions / len(answer) if len(answer) > 0 else 0
|
102 |
partial_text += (
|
103 |
+
f"1. Repetition Ratio: {rr:.3f}\n"
|
104 |
)
|
105 |
|
106 |
if index >= 0: # RAG
|
|
|
114 |
partial_text += "\n\n Performance Metrics:\n"
|
115 |
partial_text += f'1. BLEU-1: {scores["bleu_scores"]["bleu"]:.3f}\n'
|
116 |
partial_text += f'1. RougeL: {scores["rouge_scores"]["rougeL"]:.3f}\n'
|
117 |
+
perf = scores["bert_scores"]["f1"][0]
|
118 |
+
partial_text += f'1. BERT-F1: {perf:.3f}\n'
|
119 |
+
nrr = 1 - rr
|
120 |
+
partial_text += f'1. RAP-BERT-F1: {perf * nrr * nrr * nrr:.3f}\n'
|
121 |
|
122 |
partial_text += f"\n\nGround truth: {questions[index][key][0]}\n"
|
123 |
|