Views
No views yet
explanation field to teach the model the underlying mathematical logic and derivation steps.trl and peft libraries on a single NVIDIA T4 GPU, utilizing strictly native FP16 precision to ensure mathematical gradient stability.### Instruction: and ### Response: format for it to output the correct mathematical explanations.1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_id = "ZentithLLM/NexusLLM-Math-1B-v1"
5
6tokenizer = AutoTokenizer.from_pretrained(model_id)
7model = AutoModelForCausalLM.from_pretrained(
8 model_id,
9 torch_dtype=torch.float16,
10 device_map="auto"
11)
12
13question = "What is the general term in the expansion of (x+y)^n?"
14formatted_prompt = f"### Instruction:\\n{question}\\n\\n### Response:\\n"
15
16inputs = tokenizer(formatted_prompt, return_tensors="pt").to(model.device)
17
18outputs = model.generate(
19 **inputs,
20 max_new_tokens=250,
21 temperature=0.3,
22 do_sample=True,
23 pad_token_id=tokenizer.eos_token_id
24)
25
26print(tokenizer.decode(outputs[0], skip_special_tokens=True))