Text Generation
PEFT
Safetensors
mistral
conversational
Eval Results
dfurman commited on
Commit
7e4f067
1 Parent(s): 4e4ddd0

Upload model

Browse files
Files changed (3) hide show
  1. README.md +140 -163
  2. adapter_config.json +5 -3
  3. adapter_model.safetensors +2 -2
README.md CHANGED
@@ -1,231 +1,208 @@
1
  ---
2
- license: llama2
3
  library_name: peft
4
- tags:
5
- - llama-2
6
- datasets:
7
- - ehartford/dolphin
8
- inference: false
9
- pipeline_tag: text-generation
10
  base_model: meta-llama/Llama-2-13b-hf
11
  ---
12
 
13
- <div align="center">
14
 
15
- <img src="./assets/llama.png" width="150px">
16
 
17
- </div>
18
 
19
- # Llama-2-13B-Instruct-v0.1
20
 
21
- This instruction model was built via parameter-efficient QLoRA finetuning of [llama-2-13b](https://huggingface.co/meta-llama/Llama-2-13b-hf) on the first 100k rows of [ehartford/dolphin](https://huggingface.co/datasets/ehartford/dolphin) (an open-source implementation of [Microsoft's Orca](https://www.microsoft.com/en-us/research/publication/orca-progressive-learning-from-complex-explanation-traces-of-gpt-4/)). Finetuning was executed on a single A6000 (48 GB) for roughly 18 hours on the [Lambda Labs](https://cloud.lambdalabs.com/instances) platform.
22
 
23
- ## Benchmark metrics
24
 
25
- | Metric | Value |
26
- |-----------------------|-------|
27
- | MMLU (5-shot) | 55.76 |
28
- | ARC (25-shot) | 59.98 |
29
- | HellaSwag (10-shot) | 82.43 |
30
- | TruthfulQA (0-shot) | 42.59 |
31
- | Avg. | 60.19 |
32
 
33
- We use state-of-the-art [Language Model Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness) to run the benchmark tests above, using the same version as Hugging Face's [Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard).
34
 
35
- ## Helpful Links
36
 
37
- * Model license: Llama 2 Community License Agreement
38
- * Basic usage: [notebook](assets/basic_inference_llama_2_13b_dolphin.ipynb)
39
- * Finetuning script: [script](https://github.com/daniel-furman/sft-demos/blob/main/src/sft/one_gpu/llama-2/dolphin/sft-Llama-2-13B-Instruct-v0.1-peft.py)
40
- * Loss curves: [plot](https://huggingface.co/dfurman/Llama-2-13B-Instruct-v0.1-peft#finetuning-description)
41
- * Runtime stats: [table](https://huggingface.co/dfurman/Llama-2-13B-Instruct-v0.1-peft#runtime-tests)
 
 
42
 
43
- ## Example prompts and responses
44
 
45
- Example 1:
46
 
47
- **User**:
48
- >You are a helpful assistant. Write me a numbered list of things to do in New York City.\n
 
49
 
50
- **Llama-2-13B-Instruct-v0.1-peft**:
51
 
52
- > 1. Visit the iconic Statue of Liberty and Ellis Island.
53
- > 2. Take a stroll through Central Park and enjoy its many attractions.
54
- > 3. Explore the world-renowned museums, such as the Metropolitan Museum of Art and the Museum of Modern Art.
55
- > 4. Experience the vibrant energy of Times Square and take in the bright lights and billboards.
56
- > 5. Visit the 9/11 Memorial and Museum to pay tribute to those who lost their lives in the attacks.
57
- > 6. Enjoy a Broadway show or a concert at one of the many theaters and venues in the city.
58
- > 7. Take a ride on the Staten Island Ferry for a free view of the Statue of Liberty and the New York City skyline.
59
- > 8. Shop at the famous Fifth Avenue stores and explore the high-end boutiques.
60
- > 9. Indulge in a variety of cuisines at one of the many restaurants in the city.
61
- > 10. Visit the Empire State Building and enjoy the panoramic views of the city from the observation deck.
62
 
63
- <br>
64
 
65
- Example 2:
66
 
67
- **User**:
68
- >You are a helpful assistant. Write a short email inviting my friends to a dinner party on Friday. Respond succinctly.\n"
69
 
70
- **Llama-2-13B-Instruct-v0.1-peft**:
71
 
72
- > Subject: Friday Dinner Party Invitation
73
- >
74
- > Dear Friends,
75
- >
76
- > I hope this email finds you well. I'm excited to invite you all to a dinner party on Friday, March 10th, at 7:00 PM. The address is 123 Main Street, Anytown, USA.
77
- >
78
- > Please RSVP by Wednesday, March 8th, so I can plan accordingly. I look forward to seeing you all and sharing a delicious meal together!
79
- >
80
- > Best,
81
- > Your Friendly Assistant
82
- >
83
- > P.S. If you have any dietary restrictions or allergies, please let me know in your RSVP. Thank you!
84
 
85
- <br>
86
 
87
- ## Model Description
88
 
89
- The architecture is a modification of a standard decoder-only transformer.
90
 
91
- The llama-2-13b models have been modified from a standard transformer in the following ways:
92
- * It uses the [SwiGLU activation function](https://arxiv.org/abs/2002.05202)
93
- * It uses [rotary positional embeddings](https://arxiv.org/abs/2104.09864) (RoPE)
94
 
95
- | Hyperparameter | Value |
96
- |----------------|-------|
97
- | n_parameters | 13B |
98
- | tokens | 2.0T |
99
- | vocab size | 32000 |
100
- | sequence length | 4096 |
101
 
102
- ## Finetuning Description
103
 
104
- This model was trained on a single A6000 (48 GB) for about 18 hours using the [Lambda Labs](https://cloud.lambdalabs.com/instances) platform.
105
 
106
- ![loss curves](https://raw.githubusercontent.com/daniel-furman/sft-demos/main/assets/jul_24_23_1_13_00_log_loss_curves_Llama-2-13B-Instruct-v0.1.png)
107
 
108
- The above loss curve was generated from the run's private wandb.ai log.
109
 
110
- ## PreTraining Data
111
 
112
- For more details on the pretraining process, see [Llama-2-13b-hf](https://huggingface.co/meta-llama/Llama-2-13b-hf).
113
 
114
- The data was tokenized using the [Llama-2-13b-hf](https://huggingface.co/meta-llama/Llama-2-13b-hf) tokenizer.
115
 
116
- ## Limitations and Biases
117
 
118
- _The following language is modified from [EleutherAI's GPT-NeoX-20B](https://huggingface.co/EleutherAI/gpt-neox-20b)_
119
 
120
- This model can produce factually incorrect output, and should not be relied on to produce factually accurate information.
121
- This model was trained on various public datasets.
122
- While great efforts have been taken to clean the pretraining data, it is possible that this model could generate lewd, biased or otherwise offensive outputs.
123
 
124
- ## How to Use
125
 
126
- * [notebook](assets/basic_inference_llama_2_dolphin.ipynb)
127
 
128
- ```python
129
- !pip install -q -U huggingface_hub peft transformers torch accelerate
130
- ```
131
 
132
- ```python
133
- from huggingface_hub import notebook_login
134
- import torch
135
- from peft import PeftModel, PeftConfig
136
- from transformers import (
137
- AutoModelForCausalLM,
138
- AutoTokenizer,
139
- BitsAndBytesConfig,
140
- pipeline,
141
- )
142
 
143
- notebook_login()
144
- ```
145
 
146
- ```python
147
- peft_model_id = "dfurman/Llama-2-13B-Instruct-v0.1-peft"
148
- config = PeftConfig.from_pretrained(peft_model_id)
149
 
150
- bnb_config = BitsAndBytesConfig(
151
- load_in_4bit=True,
152
- bnb_4bit_quant_type="nf4",
153
- bnb_4bit_compute_dtype=torch.bfloat16,
154
- )
155
 
156
- model = AutoModelForCausalLM.from_pretrained(
157
- config.base_model_name_or_path,
158
- quantization_config=bnb_config,
159
- use_auth_token=True,
160
- device_map="auto",
161
- )
162
 
163
- tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path, use_fast=True)
164
- tokenizer.pad_token = tokenizer.eos_token
165
 
166
- model = PeftModel.from_pretrained(model, peft_model_id)
167
 
168
- format_template = "You are a helpful assistant. {query}\n"
169
- ```
170
 
171
- ```python
172
- # First, format the prompt
173
- query = "Tell me a recipe for vegan banana bread."
174
- prompt = format_template.format(query=query)
175
 
176
- # Inference can be done using model.generate
177
- print("\n\n*** Generate:")
178
 
179
- input_ids = tokenizer(prompt, return_tensors="pt").input_ids.cuda()
180
- with torch.autocast("cuda", dtype=torch.bfloat16):
181
- output = model.generate(
182
- input_ids=input_ids,
183
- max_new_tokens=512,
184
- do_sample=True,
185
- temperature=0.7,
186
- return_dict_in_generate=True,
187
- eos_token_id=tokenizer.eos_token_id,
188
- pad_token_id=tokenizer.pad_token_id,
189
- repetition_penalty=1.2,
190
- )
191
 
192
- print(tokenizer.decode(output["sequences"][0], skip_special_tokens=True))
193
- ```
194
 
195
- ## Runtime tests
196
 
 
197
 
198
- | runtime / 50 tokens (sec) | GPU | attn | torch dtype | VRAM (GB) |
199
- |:-----------------------------:|:----------------------:|:---------------------:|:-------------:|:-----------------------:|
200
- | 2.93 | 1x A100 (40 GB SXM) | torch | bfloat16 | 25 |
201
- | 3.24 | 1x A6000 (48 GB) | torch | bfloat16 | 25 |
202
 
203
- The above runtime stats were generated from this [notebook](https://github.com/daniel-furman/sft-demos/blob/main/src/sft/one_gpu/llama-2/dolphin/postprocessing-Llama-2-13B-Instruct-v0.1-peft.ipynb).
204
 
205
- ## Acknowledgements
206
 
207
- This model was finetuned by Daniel Furman on July 22, 2023 and is intended primarily for research purposes.
208
 
209
- ## Disclaimer
210
 
211
- The license on this model does not constitute legal advice. We are not responsible for the actions of third parties who use this model. Please cosult an attorney before using this model for commercial purposes.
212
 
213
- ## Meta citation for llama-2 blog
214
 
215
- ```
216
- @online{Meta2023Introducing,
217
- author = {Meta AI},
218
- title = {Meta and Microsoft Introduce the Next Generation of Llama},
219
- year = {2023},
220
- url = {https://about.fb.com/news/2023/07/llama-2/},
221
- note = {Accessed: 2023-07-24},
222
- urldate = {2023-07-24}
223
- }
224
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
 
226
- ---
227
 
228
- ## Framework versions
229
 
230
 
231
- - PEFT 0.5.0.dev0
 
1
  ---
 
2
  library_name: peft
 
 
 
 
 
 
3
  base_model: meta-llama/Llama-2-13b-hf
4
  ---
5
 
6
+ # Model Card for Model ID
7
 
8
+ <!-- Provide a quick summary of what the model is/does. -->
9
 
 
10
 
 
11
 
12
+ ## Model Details
13
 
14
+ ### Model Description
15
 
16
+ <!-- Provide a longer summary of what this model is. -->
 
 
 
 
 
 
17
 
 
18
 
 
19
 
20
+ - **Developed by:** [More Information Needed]
21
+ - **Funded by [optional]:** [More Information Needed]
22
+ - **Shared by [optional]:** [More Information Needed]
23
+ - **Model type:** [More Information Needed]
24
+ - **Language(s) (NLP):** [More Information Needed]
25
+ - **License:** [More Information Needed]
26
+ - **Finetuned from model [optional]:** [More Information Needed]
27
 
28
+ ### Model Sources [optional]
29
 
30
+ <!-- Provide the basic links for the model. -->
31
 
32
+ - **Repository:** [More Information Needed]
33
+ - **Paper [optional]:** [More Information Needed]
34
+ - **Demo [optional]:** [More Information Needed]
35
 
36
+ ## Uses
37
 
38
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
 
 
 
 
 
 
 
 
 
39
 
40
+ ### Direct Use
41
 
42
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
 
44
+ [More Information Needed]
 
45
 
46
+ ### Downstream Use [optional]
47
 
48
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
 
 
 
 
 
 
 
 
 
 
 
49
 
50
+ [More Information Needed]
51
 
52
+ ### Out-of-Scope Use
53
 
54
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
 
56
+ [More Information Needed]
 
 
57
 
58
+ ## Bias, Risks, and Limitations
 
 
 
 
 
59
 
60
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
 
62
+ [More Information Needed]
63
 
64
+ ### Recommendations
65
 
66
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
 
68
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
 
70
+ ## How to Get Started with the Model
71
 
72
+ Use the code below to get started with the model.
73
 
74
+ [More Information Needed]
75
 
76
+ ## Training Details
77
 
78
+ ### Training Data
 
 
79
 
80
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
 
82
+ [More Information Needed]
83
 
84
+ ### Training Procedure
 
 
85
 
86
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
 
 
 
 
 
 
 
 
 
87
 
88
+ #### Preprocessing [optional]
 
89
 
90
+ [More Information Needed]
 
 
91
 
 
 
 
 
 
92
 
93
+ #### Training Hyperparameters
 
 
 
 
 
94
 
95
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
 
96
 
97
+ #### Speeds, Sizes, Times [optional]
98
 
99
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
 
100
 
101
+ [More Information Needed]
 
 
 
102
 
103
+ ## Evaluation
 
104
 
105
+ <!-- This section describes the evaluation protocols and provides the results. -->
 
 
 
 
 
 
 
 
 
 
 
106
 
107
+ ### Testing Data, Factors & Metrics
 
108
 
109
+ #### Testing Data
110
 
111
+ <!-- This should link to a Dataset Card if possible. -->
112
 
113
+ [More Information Needed]
 
 
 
114
 
115
+ #### Factors
116
 
117
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
 
119
+ [More Information Needed]
120
 
121
+ #### Metrics
122
 
123
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
 
125
+ [More Information Needed]
126
 
127
+ ### Results
128
+
129
+ [More Information Needed]
130
+
131
+ #### Summary
132
+
133
+
134
+
135
+ ## Model Examination [optional]
136
+
137
+ <!-- Relevant interpretability work for the model goes here -->
138
+
139
+ [More Information Needed]
140
+
141
+ ## Environmental Impact
142
+
143
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
+
145
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
+
147
+ - **Hardware Type:** [More Information Needed]
148
+ - **Hours used:** [More Information Needed]
149
+ - **Cloud Provider:** [More Information Needed]
150
+ - **Compute Region:** [More Information Needed]
151
+ - **Carbon Emitted:** [More Information Needed]
152
+
153
+ ## Technical Specifications [optional]
154
+
155
+ ### Model Architecture and Objective
156
+
157
+ [More Information Needed]
158
+
159
+ ### Compute Infrastructure
160
+
161
+ [More Information Needed]
162
+
163
+ #### Hardware
164
+
165
+ [More Information Needed]
166
+
167
+ #### Software
168
+
169
+ [More Information Needed]
170
+
171
+ ## Citation [optional]
172
+
173
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
+
175
+ **BibTeX:**
176
+
177
+ [More Information Needed]
178
+
179
+ **APA:**
180
+
181
+ [More Information Needed]
182
+
183
+ ## Glossary [optional]
184
+
185
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
+
187
+ [More Information Needed]
188
+
189
+ ## More Information [optional]
190
+
191
+ [More Information Needed]
192
+
193
+ ## Model Card Authors [optional]
194
+
195
+ [More Information Needed]
196
+
197
+ ## Model Card Contact
198
+
199
+ [More Information Needed]
200
+
201
+
202
+ ## Training procedure
203
 
 
204
 
205
+ ### Framework versions
206
 
207
 
208
+ - PEFT 0.6.3.dev0
adapter_config.json CHANGED
@@ -1,4 +1,5 @@
1
  {
 
2
  "auto_mapping": null,
3
  "base_model_name_or_path": "meta-llama/Llama-2-13b-hf",
4
  "bias": "none",
@@ -12,12 +13,13 @@
12
  "modules_to_save": null,
13
  "peft_type": "LORA",
14
  "r": 64,
 
15
  "revision": null,
16
  "target_modules": [
17
- "q_proj",
18
  "k_proj",
19
- "v_proj",
20
- "o_proj"
 
21
  ],
22
  "task_type": "CAUSAL_LM"
23
  }
 
1
  {
2
+ "alpha_pattern": {},
3
  "auto_mapping": null,
4
  "base_model_name_or_path": "meta-llama/Llama-2-13b-hf",
5
  "bias": "none",
 
13
  "modules_to_save": null,
14
  "peft_type": "LORA",
15
  "r": 64,
16
+ "rank_pattern": {},
17
  "revision": null,
18
  "target_modules": [
 
19
  "k_proj",
20
+ "q_proj",
21
+ "o_proj",
22
+ "v_proj"
23
  ],
24
  "task_type": "CAUSAL_LM"
25
  }
adapter_model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:9f70dc35db3f30fd244fcbb6c1e7ba4488e89dda8c1b0033bacf8f0dc2b74dbe
3
- size 419474032
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:809dc32759bbcaeae54c5098d86a1b5aded6b46875245adbf85f8c59a7cecbea
3
+ size 209758976