Update README.md
Browse files
README.md
CHANGED
|
@@ -3,11 +3,51 @@ license: apache-2.0
|
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
base_model:
|
| 6 |
-
- Qwen/Qwen2.5-Math-
|
| 7 |
pipeline_tag: question-answering
|
| 8 |
library_name: transformers
|
| 9 |
tags:
|
| 10 |
- verifier
|
| 11 |
---
|
| 12 |
|
| 13 |
-
This is the verifier we used in [General Reasoner](https://github.com/TIGER-AI-Lab/General-Reasoner).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
base_model:
|
| 6 |
+
- Qwen/Qwen2.5-Math-1.5B
|
| 7 |
pipeline_tag: question-answering
|
| 8 |
library_name: transformers
|
| 9 |
tags:
|
| 10 |
- verifier
|
| 11 |
---
|
| 12 |
|
| 13 |
+
This is the verifier we used in [General Reasoner](https://github.com/TIGER-AI-Lab/General-Reasoner).
|
| 14 |
+
|
| 15 |
+
## Usage
|
| 16 |
+
```python
|
| 17 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 18 |
+
import torch
|
| 19 |
+
|
| 20 |
+
# Replace with your model path
|
| 21 |
+
model_path = "TIGER-Lab/general-verifier"
|
| 22 |
+
|
| 23 |
+
# Load tokenizer and model
|
| 24 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
| 25 |
+
model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype=torch.float16).cuda()
|
| 26 |
+
|
| 27 |
+
# Example inputs
|
| 28 |
+
question = "Factor the following quadratic: $3 x^3+\frac{69 x^2}{2}-36 x-810$"
|
| 29 |
+
ground_truth = "\\frac{3(2x-9)(x+6)(x+10)}{2}"
|
| 30 |
+
student_answer = "\\frac{3}{2}(x+6)(2x-9)(x+10)"
|
| 31 |
+
|
| 32 |
+
# Create prompt
|
| 33 |
+
prompt = (
|
| 34 |
+
f"User: ### Question: {question}\n\n"
|
| 35 |
+
f"### Ground Truth Answer: {ground_truth}\n\n"
|
| 36 |
+
f"### Student Answer: {student_answer}\n\n"
|
| 37 |
+
"For the above question, please verify if the student's answer is equivalent to the ground truth answer.\n"
|
| 38 |
+
"Do not solve the question by yourself; just check if the student's answer is equivalent to the ground truth answer.\n"
|
| 39 |
+
"If the student's answer is correct, output \"Final Decision: Yes\". If the student's answer is incorrect, output \"Final Decision: No\". Assistant:"
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
+
# Tokenize and generate
|
| 43 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 44 |
+
outputs = model.generate(
|
| 45 |
+
**inputs,
|
| 46 |
+
max_new_tokens=1024,
|
| 47 |
+
temperature=0.0,
|
| 48 |
+
do_sample=False
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
# Decode and print output
|
| 52 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 53 |
+
```
|