Spaces:
Runtime error
Runtime error
mend
Browse files
app.py
CHANGED
|
@@ -102,17 +102,28 @@ class EntailmentChecker(BaseComponent):
|
|
| 102 |
# if in the first documents there is a strong evidence of entailment/contradiction,
|
| 103 |
# there is no need to consider less relevant documents
|
| 104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
|
| 117 |
return entailment_checker_result, "output_1"
|
| 118 |
|
|
|
|
| 102 |
# if in the first documents there is a strong evidence of entailment/contradiction,
|
| 103 |
# there is no need to consider less relevant documents
|
| 104 |
|
| 105 |
+
if scores > 0:
|
| 106 |
+
aggregate_entailment_info = {
|
| 107 |
+
"contradiction": round(agg_con / scores, 2),
|
| 108 |
+
"neutral": round(agg_neu / scores, 2),
|
| 109 |
+
"entailment": round(agg_ent / scores, 2),
|
| 110 |
+
}
|
| 111 |
|
| 112 |
+
entailment_checker_result = {
|
| 113 |
+
"documents": considered_documents,
|
| 114 |
+
"aggregate_entailment_info": aggregate_entailment_info,
|
| 115 |
+
}
|
| 116 |
+
else:
|
| 117 |
+
aggregate_entailment_info = {
|
| 118 |
+
"contradiction": 0,
|
| 119 |
+
"neutral": 0,
|
| 120 |
+
"entailment": 0,
|
| 121 |
+
}
|
| 122 |
|
| 123 |
+
entailment_checker_result = {
|
| 124 |
+
"documents": considered_documents,
|
| 125 |
+
"aggregate_entailment_info": aggregate_entailment_info,
|
| 126 |
+
}
|
| 127 |
|
| 128 |
return entailment_checker_result, "output_1"
|
| 129 |
|
config.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
-
RETRIEVER_MODEL = "sentence-transformers/distiluse-base-multilingual-cased-v1"
|
|
|
|
| 2 |
RETRIEVER_TOP_K = 15
|
| 3 |
|
| 4 |
-
NLI_MODEL = "
|
|
|
|
| 1 |
+
# RETRIEVER_MODEL = "sentence-transformers/distiluse-base-multilingual-cased-v1"
|
| 2 |
+
RETRIEVER_MODEL = "unicamp-dl/mt5-base-en-pt-msmarco-v2"
|
| 3 |
RETRIEVER_TOP_K = 15
|
| 4 |
|
| 5 |
+
NLI_MODEL = "MoritzLaurer/mDeBERTa-v3-base-xnli-multilingual-nli-2mil7"
|