|
|
--- |
|
|
datasets: |
|
|
- TIGER-Lab/MathInstruct |
|
|
language: |
|
|
- en |
|
|
base_model: |
|
|
- mistralai/Mistral-7B-v0.3 |
|
|
pipeline_tag: text-generation |
|
|
--- |
|
|
|
|
|
<img src="https://huggingface.co/entfane/math-virtuoso-7B/resolve/main/math-virtuoso.png" width="400" height="400"/> |
|
|
|
|
|
# Math Virtuoso 7B |
|
|
|
|
|
This model is a Math Instruction fine-tuned version of Mistral 7B v0.3 model. |
|
|
|
|
|
|
|
|
### Inference |
|
|
|
|
|
```python |
|
|
!pip install transformers accelerate |
|
|
from transformers import AutoTokenizer, AutoModelForCausalLM |
|
|
model_name = "entfane/math-virtuoso-7B" |
|
|
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)) |
|
|
``` |