Views
No views yet
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"samzheng/mistral-7b-math-merged",
torch_dtype="auto", device_map="auto"
)
tok = AutoTokenizer.from_pretrained("samzheng/mistral-7b-math-merged")
prompt = """Below is an instruction that describes a task...
### Instruction: Solve the problem using step-by-step reasoning and provide Python code.
### Input: Solve for x: 2x + 5 = 17
### Response:
"""
print(tok.decode(model.generate(**tok(prompt, return_tensors="pt").to(model.device),max_new_tokens=256)[0], skip_special_tokens=True))