Pankaj Mathur commited on
Commit
cd003a8
·
1 Parent(s): 2c5b141

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +181 -1
README.md CHANGED
@@ -5,4 +5,184 @@ library_name: transformers
5
  license: llama2
6
  ---
7
 
8
- LlaMA-2 License, more details coming soon...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  license: llama2
6
  ---
7
 
8
+ It's a preview version of psmathur/model_007, Sorry for the naming confusion.
9
+
10
+ A hybrid (explain + instruct) style Llama2-70b model, Pleae check examples below for both style prompts, Here is the list of datasets used:
11
+
12
+ * Open-Platypus
13
+ * Alpaca
14
+ * WizardLM
15
+ * Dolly-V2
16
+ * Dolphin Samples (~200K)
17
+ * Orca_minis_v1
18
+ * Alpaca_orca
19
+ * WizardLM_orca
20
+ * Dolly-V2_orca
21
+
22
+
23
+ <br>
24
+
25
+ **P.S. If you're interested to collaborate, please connect with me at www.linkedin.com/in/pankajam.**
26
+
27
+ <br>
28
+
29
+
30
+
31
+ ### quantized versions
32
+
33
+
34
+ <br>
35
+
36
+ #### license disclaimer:
37
+
38
+ This model is bound by the license & usage restrictions of the original Llama-2 model. And comes with no warranty or gurantees of any kind.
39
+
40
+ <br>
41
+
42
+ ## Evaluation
43
+
44
+ We evaluated model_007_preview on a wide range of tasks using [Language Model Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness) from EleutherAI.
45
+
46
+ Here are the results on metrics used by [HuggingFaceH4 Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)
47
+
48
+ |||||
49
+ |:------:|:--------:|:-------:|:--------:|
50
+ |**Task**|**Metric**|**Value**|**Stderr**|
51
+ |*arc_challenge*|acc_norm|0.6314|0.0141|
52
+ |*hellaswag*|acc_norm|0.8242|0.0038|
53
+ |*mmlu*|acc_norm|0.5637|0.0351|
54
+ |*truthfulqa_mc*|mc2|0.5127|0.0157|
55
+ |**Total Average**|-|**0.6329877193**||
56
+
57
+
58
+ <br>
59
+
60
+ ## Example Usage
61
+
62
+ Here is the Orca prompt format
63
+
64
+ ```
65
+ ### System:
66
+ You are an AI assistant that follows instruction extremely well. Help as much as you can.
67
+
68
+ ### User:
69
+ Tell me about Orcas.
70
+
71
+ ### Assistant:
72
+
73
+ ```
74
+
75
+ Below shows a code example on how to use this model
76
+
77
+ ```python
78
+ import torch
79
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
80
+
81
+ tokenizer = AutoTokenizer.from_pretrained("psmathur/model_007_preview")
82
+ model = AutoModelForCausalLM.from_pretrained(
83
+ "psmathur/model_007_preview",
84
+ torch_dtype=torch.float16,
85
+ load_in_8bit=True,
86
+ low_cpu_mem_usage=True,
87
+ device_map="auto"
88
+ )
89
+ system_prompt = "### System:\nYou are an AI assistant that follows instruction extremely well. Help as much as you can.\n\n"
90
+
91
+ #generate text steps
92
+ instruction = "Tell me about Orcas."
93
+ prompt = f"{system_prompt}### User: {instruction}\n\n### Assistant:\n"
94
+ inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
95
+ output = model.generate(**inputs, do_sample=True, top_p=0.95, top_k=0, max_new_tokens=4096)
96
+
97
+ print(tokenizer.decode(output[0], skip_special_tokens=True))
98
+
99
+ ```
100
+
101
+
102
+ Here is the Alpaca prompt format
103
+
104
+ ```
105
+
106
+ ### User:
107
+ Tell me about Alpacas.
108
+
109
+ ### Assistant:
110
+
111
+ ```
112
+
113
+ Below shows a code example on how to use this model
114
+
115
+ ```python
116
+ import torch
117
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
118
+
119
+ tokenizer = AutoTokenizer.from_pretrained("psmathur/model_007_preview")
120
+ model = AutoModelForCausalLM.from_pretrained(
121
+ "psmathur/model_007_preview",
122
+ torch_dtype=torch.float16,
123
+ load_in_8bit=True,
124
+ low_cpu_mem_usage=True,
125
+ device_map="auto"
126
+ )
127
+ #generate text steps
128
+ instruction = "Tell me about Alpacas."
129
+ prompt = f"### User: {instruction}\n\n### Assistant:\n"
130
+ inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
131
+ output = model.generate(**inputs, do_sample=True, top_p=0.95, top_k=0, max_new_tokens=4096)
132
+
133
+ print(tokenizer.decode(output[0], skip_special_tokens=True))
134
+
135
+ ```
136
+
137
+ <br>
138
+
139
+ #### Limitations & Biases:
140
+
141
+ While this model aims for accuracy, it can occasionally produce inaccurate or misleading results.
142
+
143
+ Despite diligent efforts in refining the pretraining data, there remains a possibility for the generation of inappropriate, biased, or offensive content.
144
+
145
+ Exercise caution and cross-check information when necessary.
146
+
147
+
148
+ <br>
149
+
150
+ ### Citiation:
151
+
152
+ Please kindly cite using the following BibTeX:
153
+
154
+ ```
155
+ @misc{model_007_preview,
156
+ author = {Pankaj Mathur},
157
+ title = {model_007_preview: A hybrid (explain + instruct) style Llama2-70b model},
158
+ year = {2023},
159
+ publisher = {HuggingFace},
160
+ journal = {HuggingFace repository},
161
+ howpublished = {\url{https://https://huggingface.co/psmathur/model_007_preview},
162
+ }
163
+ ```
164
+
165
+ ```
166
+ @misc{mukherjee2023orca,
167
+ title={Orca: Progressive Learning from Complex Explanation Traces of GPT-4},
168
+ author={Subhabrata Mukherjee and Arindam Mitra and Ganesh Jawahar and Sahaj Agarwal and Hamid Palangi and Ahmed Awadallah},
169
+ year={2023},
170
+ eprint={2306.02707},
171
+ archivePrefix={arXiv},
172
+ primaryClass={cs.CL}
173
+ }
174
+ ```
175
+
176
+ ```
177
+ @software{touvron2023llama2,
178
+ title={Llama 2: Open Foundation and Fine-Tuned Chat Models},
179
+ author={Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava,
180
+ Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller,
181
+ Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez Madian Khabsa, Isabel Kloumann,
182
+ Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov,
183
+ Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith,
184
+ Ranjan Subramanian, Xiaoqing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu , Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan,
185
+ Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, Thomas Scialom},
186
+ year={2023}
187
+ }
188
+ ```