Spaces:
Runtime error
Runtime error
Update nli_detector.py
Browse files- nli_detector.py +2 -3
nli_detector.py
CHANGED
|
@@ -14,10 +14,11 @@ class NLIDetector:
|
|
| 14 |
Returns entailment probability (0 to 1) for a given premise‑hypothesis pair.
|
| 15 |
"""
|
| 16 |
|
| 17 |
-
def __init__(self, model_name: str = "
|
| 18 |
"""
|
| 19 |
Args:
|
| 20 |
model_name: Hugging Face model identifier for NLI.
|
|
|
|
| 21 |
"""
|
| 22 |
try:
|
| 23 |
# Request all scores to obtain probabilities for each class.
|
|
@@ -36,11 +37,9 @@ class NLIDetector:
|
|
| 36 |
def check(self, premise: str, hypothesis: str) -> Optional[float]:
|
| 37 |
"""
|
| 38 |
Returns probability of entailment (higher means more consistent).
|
| 39 |
-
|
| 40 |
Args:
|
| 41 |
premise: The original input/context.
|
| 42 |
hypothesis: The generated response.
|
| 43 |
-
|
| 44 |
Returns:
|
| 45 |
Float between 0 and 1, or None if model unavailable.
|
| 46 |
"""
|
|
|
|
| 14 |
Returns entailment probability (0 to 1) for a given premise‑hypothesis pair.
|
| 15 |
"""
|
| 16 |
|
| 17 |
+
def __init__(self, model_name: str = "microsoft/deberta-base-mnli"):
|
| 18 |
"""
|
| 19 |
Args:
|
| 20 |
model_name: Hugging Face model identifier for NLI.
|
| 21 |
+
Default is a public model that does not require authentication.
|
| 22 |
"""
|
| 23 |
try:
|
| 24 |
# Request all scores to obtain probabilities for each class.
|
|
|
|
| 37 |
def check(self, premise: str, hypothesis: str) -> Optional[float]:
|
| 38 |
"""
|
| 39 |
Returns probability of entailment (higher means more consistent).
|
|
|
|
| 40 |
Args:
|
| 41 |
premise: The original input/context.
|
| 42 |
hypothesis: The generated response.
|
|
|
|
| 43 |
Returns:
|
| 44 |
Float between 0 and 1, or None if model unavailable.
|
| 45 |
"""
|