realArceus commited on
Commit
bda77df
Β·
verified Β·
1 Parent(s): 968872c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -18,7 +18,6 @@ Be deliberate. Show your full working. Each step should be one clear thought."""
18
 
19
  # ── Setup Your Probe (Local Pipeline) ─────────────────────────────────────────
20
  print("Loading ThinkWhileThinking Probe...")
21
- # This loads your fine-tuned model directly into the Space's memory
22
  probe = pipeline("text-classification", model="realArceus/twt-probe", device="cpu")
23
 
24
  # ── Step Probe (Live Inference) ───────────────────────────────────────────────
@@ -29,19 +28,17 @@ def probe_step(problem: str, steps_so_far: list[str]) -> tuple[str, float]:
29
  if not steps_so_far:
30
  return "OK", 1.0
31
 
32
- # Split the context from the current step being evaluated
33
  context_steps = steps_so_far[:-1]
34
  current_step = steps_so_far[-1]
35
 
36
- # Format exactly like the PRM800K training data
37
  input_text = (
38
  f"[PROBLEM] {problem.strip()} "
39
  f"[STEPS SO FAR] {' '.join(context_steps)} "
40
  f"[CURRENT STEP] {current_step}"
41
  )
42
 
43
- # Run the Probe (truncate to avoid context limit crashes)
44
  try:
 
45
  result = probe(input_text[:2000])[0]
46
 
47
  # LABEL_1 is Correct (1), LABEL_0 is Fault (0)
@@ -52,7 +49,7 @@ def probe_step(problem: str, steps_so_far: list[str]) -> tuple[str, float]:
52
  return label, confidence
53
  except Exception as e:
54
  print(f"Probe Error: {e}")
55
- return "OK", 0.5 # Fallback if inference glitches
56
 
57
  # ── Core pipeline ─────────────────────────────────────────────────────────────
58
  def run_twt(problem: str):
 
18
 
19
  # ── Setup Your Probe (Local Pipeline) ─────────────────────────────────────────
20
  print("Loading ThinkWhileThinking Probe...")
 
21
  probe = pipeline("text-classification", model="realArceus/twt-probe", device="cpu")
22
 
23
  # ── Step Probe (Live Inference) ───────────────────────────────────────────────
 
28
  if not steps_so_far:
29
  return "OK", 1.0
30
 
 
31
  context_steps = steps_so_far[:-1]
32
  current_step = steps_so_far[-1]
33
 
 
34
  input_text = (
35
  f"[PROBLEM] {problem.strip()} "
36
  f"[STEPS SO FAR] {' '.join(context_steps)} "
37
  f"[CURRENT STEP] {current_step}"
38
  )
39
 
 
40
  try:
41
+ # Run the Probe (truncate to avoid context limit crashes)
42
  result = probe(input_text[:2000])[0]
43
 
44
  # LABEL_1 is Correct (1), LABEL_0 is Fault (0)
 
49
  return label, confidence
50
  except Exception as e:
51
  print(f"Probe Error: {e}")
52
+ return "OK", 0.5
53
 
54
  # ── Core pipeline ─────────────────────────────────────────────────────────────
55
  def run_twt(problem: str):