File size: 1,495 Bytes
c911d26
 
 
 
 
 
 
 
 
 
 
 
50a405f
c911d26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---

license: apache-2.0
base_model:
- mistralai/Mistral-7B-Instruct-v0.3
datasets:
- samzheng/SymbolicCode-CoT
language:
- en
pipeline_tag: question-answering
---

model_name: "Mistral-7B-Math (Merged FP16 Checkpoint)" \
repo: "samzheng/mistral-7b-math-merged"\
base_model:
  name: "unsloth/mistral-7b-instruct-v0.3-bnb-4bit"
  url: "https://huggingface.co/unsloth/mistral-7b-instruct-v0.3-bnb-4bit"\
task: "Grade-school symbolic math word problems → Python code answers"\
fine_tuning:
  method: "LoRA adapters (r=16, α=16, dropout=0) merged into the base weights, FP16 precision"
  parameters:
    r: 16
    alpha: 16
    dropout: 0\
dataset:
  description: "6.7k Alpaca-formatted Q/A pairs with chain-of-thought + code"
  splits:
    - "symboliccode_cot_train"
    - "symboliccode_cot_validation"\
  language: python \
  code: 
  
    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))