abacaj commited on
Commit
c9d05bc
·
1 Parent(s): 00ad477

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +90 -0
README.md ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ model-index:
3
+ - name: abacaj/mistral-7b-sft
4
+ results:
5
+ - task:
6
+ type: text-generation
7
+ dataset:
8
+ type: openai_humaneval
9
+ name: HumanEval
10
+ metrics:
11
+ - name: pass@1
12
+ type: pass@1
13
+ value: 54.27
14
+ verified: false
15
+ - task:
16
+ type: text-generation
17
+ dataset:
18
+ type: mbpp
19
+ name: MBPP
20
+ metrics:
21
+ - name: pass@1
22
+ type: pass@1
23
+ value: 38.00
24
+ verified: false
25
+ - task:
26
+ type: text-generation
27
+ dataset:
28
+ type: mmlu
29
+ name: MMLU
30
+ metrics:
31
+ - name: pass@1
32
+ type: pass@1
33
+ value: 45.89
34
+ verified: false
35
+ language:
36
+ - en
37
+ ---
38
+
39
+ How to run inference:
40
+ ```python
41
+ import transformers
42
+ import torch
43
+
44
+
45
+ def fmt_prompt(prompt: str) -> str:
46
+ return f"""[Instructions]:\n{prompt}\n\n[Response]:"""
47
+
48
+
49
+ if __name__ == "__main__":
50
+ model_name = "abacaj/mistral-7b-sft"
51
+ tokenizer = transformers.AutoTokenizer.from_pretrained(model_name)
52
+
53
+ model = (
54
+ transformers.AutoModelForCausalLM.from_pretrained(
55
+ model_name,
56
+ )
57
+ .to("cuda:0")
58
+ .eval()
59
+ )
60
+
61
+ prompt = "If A is greater than B and B is greater than C. Is A greater than C?"
62
+ prompt_input = fmt_prompt(prompt)
63
+ inputs = tokenizer(prompt_input, return_tensors="pt").to(model.device)
64
+ input_ids_cutoff = inputs.input_ids.size(dim=1)
65
+
66
+ with torch.no_grad():
67
+ generated_ids = model.generate(
68
+ **inputs,
69
+ use_cache=True,
70
+ max_new_tokens=512,
71
+ temperature=0.2,
72
+ top_p=0.95,
73
+ do_sample=True,
74
+ eos_token_id=tokenizer.eos_token_id,
75
+ pad_token_id=tokenizer.pad_token_id,
76
+ )
77
+
78
+ completion = tokenizer.decode(
79
+ generated_ids[0][input_ids_cutoff:],
80
+ skip_special_tokens=True,
81
+ )
82
+
83
+ print(completion)
84
+ ```
85
+
86
+ Evals:
87
+
88
+
89
+ Code to train model:
90
+ https://github.com/abacaj/train-with-fsdp