Spaces:
Runtime error
Runtime error
fix: switch to zephyr-7b-beta with chat_completion
Browse files- pipeline/explainer.py +6 -6
pipeline/explainer.py
CHANGED
|
@@ -21,7 +21,7 @@ FALLACY_DEFINITIONS = {
|
|
| 21 |
"intentional": "A deliberate and deceptive use of misleading reasoning"
|
| 22 |
}
|
| 23 |
|
| 24 |
-
DEFAULT_MODEL_ID = "
|
| 25 |
|
| 26 |
|
| 27 |
class FallacyExplainer:
|
|
@@ -39,12 +39,12 @@ class FallacyExplainer:
|
|
| 39 |
print(f"FallacyExplainer ready (model: {model_id})")
|
| 40 |
|
| 41 |
def _generate_with_prompt(self, prompt_text, max_new_tokens=128):
|
| 42 |
-
|
| 43 |
-
prompt_text,
|
| 44 |
-
|
| 45 |
temperature=0.1,
|
| 46 |
-
|
| 47 |
-
|
| 48 |
|
| 49 |
def _load_prompt(self, path):
|
| 50 |
with open(BASE_DIR / path, "r") as f:
|
|
|
|
| 21 |
"intentional": "A deliberate and deceptive use of misleading reasoning"
|
| 22 |
}
|
| 23 |
|
| 24 |
+
DEFAULT_MODEL_ID = "HuggingFaceH4/zephyr-7b-beta"
|
| 25 |
|
| 26 |
|
| 27 |
class FallacyExplainer:
|
|
|
|
| 39 |
print(f"FallacyExplainer ready (model: {model_id})")
|
| 40 |
|
| 41 |
def _generate_with_prompt(self, prompt_text, max_new_tokens=128):
|
| 42 |
+
result = self._client.chat_completion(
|
| 43 |
+
messages=[{"role": "user", "content": prompt_text}],
|
| 44 |
+
max_tokens=max_new_tokens,
|
| 45 |
temperature=0.1,
|
| 46 |
+
)
|
| 47 |
+
return result.choices[0].message.content.strip()
|
| 48 |
|
| 49 |
def _load_prompt(self, path):
|
| 50 |
with open(BASE_DIR / path, "r") as f:
|