---
library_name: transformers
tags:
- trl
- dpo
language:
- en
base_model:
- entfane/math-professor-3B
pipeline_tag: text-generation
metrics:
- accuracy
---
# Math Professor 3B DPO
This model is an aligned version of Math Professor 3B.
### DPO dataset
Model was aligned on [argilla/distilabel-math-preference-dpo](https://huggingface.co/datasets/argilla/distilabel-math-preference-dpo) Preference Dataset.
### Inference
```python
!pip install transformers accelerate
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "entfane/math-professor-3B-dpo"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
messages = [
{"role": "user", "content": "What's the derivative of 2x^2?"}
]
input = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
encoded_input = tokenizer(input, return_tensors = "pt").to(model.device)
output = model.generate(**encoded_input, max_new_tokens=1024)
print(tokenizer.decode(output[0], skip_special_tokens=False))
```
### Evaluation
Model was tested on final answer value match on [openai/gsm8k](https://huggingface.co/datasets/openai/gsm8k) dataset.
Reaching accuracy of 58%