Firsty1 commited on
Commit
46d2bf5
·
1 Parent(s): 7c00400

fix: switch to zephyr-7b-beta with chat_completion

Browse files
Files changed (1) hide show
  1. 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 = "mistralai/Mistral-7B-Instruct-v0.3"
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
- return self._client.text_generation(
43
- prompt_text,
44
- max_new_tokens=max_new_tokens,
45
  temperature=0.1,
46
- do_sample=True,
47
- ).strip()
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: