RichardErkhov commited on
Commit
a3bd614
1 Parent(s): 6239007

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +234 -0
README.md ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Quantization made by Richard Erkhov.
2
+
3
+ [Github](https://github.com/RichardErkhov)
4
+
5
+ [Discord](https://discord.gg/pvy7H8DZMG)
6
+
7
+ [Request more models](https://github.com/RichardErkhov/quant_request)
8
+
9
+
10
+ OpenELM-1_1B-Instruct - GGUF
11
+ - Model creator: https://huggingface.co/apple/
12
+ - Original model: https://huggingface.co/apple/OpenELM-1_1B-Instruct/
13
+
14
+
15
+ | Name | Quant method | Size |
16
+ | ---- | ---- | ---- |
17
+ | [OpenELM-1_1B-Instruct.Q2_K.gguf](https://huggingface.co/RichardErkhov/apple_-_OpenELM-1_1B-Instruct-gguf/blob/main/OpenELM-1_1B-Instruct.Q2_K.gguf) | Q2_K | 0.39GB |
18
+ | [OpenELM-1_1B-Instruct.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/apple_-_OpenELM-1_1B-Instruct-gguf/blob/main/OpenELM-1_1B-Instruct.IQ3_XS.gguf) | IQ3_XS | 0.44GB |
19
+ | [OpenELM-1_1B-Instruct.IQ3_S.gguf](https://huggingface.co/RichardErkhov/apple_-_OpenELM-1_1B-Instruct-gguf/blob/main/OpenELM-1_1B-Instruct.IQ3_S.gguf) | IQ3_S | 0.46GB |
20
+ | [OpenELM-1_1B-Instruct.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/apple_-_OpenELM-1_1B-Instruct-gguf/blob/main/OpenELM-1_1B-Instruct.Q3_K_S.gguf) | Q3_K_S | 0.46GB |
21
+ | [OpenELM-1_1B-Instruct.IQ3_M.gguf](https://huggingface.co/RichardErkhov/apple_-_OpenELM-1_1B-Instruct-gguf/blob/main/OpenELM-1_1B-Instruct.IQ3_M.gguf) | IQ3_M | 0.49GB |
22
+ | [OpenELM-1_1B-Instruct.Q3_K.gguf](https://huggingface.co/RichardErkhov/apple_-_OpenELM-1_1B-Instruct-gguf/blob/main/OpenELM-1_1B-Instruct.Q3_K.gguf) | Q3_K | 0.52GB |
23
+ | [OpenELM-1_1B-Instruct.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/apple_-_OpenELM-1_1B-Instruct-gguf/blob/main/OpenELM-1_1B-Instruct.Q3_K_M.gguf) | Q3_K_M | 0.52GB |
24
+ | [OpenELM-1_1B-Instruct.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/apple_-_OpenELM-1_1B-Instruct-gguf/blob/main/OpenELM-1_1B-Instruct.Q3_K_L.gguf) | Q3_K_L | 0.56GB |
25
+ | [OpenELM-1_1B-Instruct.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/apple_-_OpenELM-1_1B-Instruct-gguf/blob/main/OpenELM-1_1B-Instruct.IQ4_XS.gguf) | IQ4_XS | 0.55GB |
26
+ | [OpenELM-1_1B-Instruct.Q4_0.gguf](https://huggingface.co/RichardErkhov/apple_-_OpenELM-1_1B-Instruct-gguf/blob/main/OpenELM-1_1B-Instruct.Q4_0.gguf) | Q4_0 | 0.58GB |
27
+ | [OpenELM-1_1B-Instruct.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/apple_-_OpenELM-1_1B-Instruct-gguf/blob/main/OpenELM-1_1B-Instruct.IQ4_NL.gguf) | IQ4_NL | 0.58GB |
28
+ | [OpenELM-1_1B-Instruct.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/apple_-_OpenELM-1_1B-Instruct-gguf/blob/main/OpenELM-1_1B-Instruct.Q4_K_S.gguf) | Q4_K_S | 0.58GB |
29
+ | [OpenELM-1_1B-Instruct.Q4_K.gguf](https://huggingface.co/RichardErkhov/apple_-_OpenELM-1_1B-Instruct-gguf/blob/main/OpenELM-1_1B-Instruct.Q4_K.gguf) | Q4_K | 0.63GB |
30
+ | [OpenELM-1_1B-Instruct.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/apple_-_OpenELM-1_1B-Instruct-gguf/blob/main/OpenELM-1_1B-Instruct.Q4_K_M.gguf) | Q4_K_M | 0.63GB |
31
+ | [OpenELM-1_1B-Instruct.Q4_1.gguf](https://huggingface.co/RichardErkhov/apple_-_OpenELM-1_1B-Instruct-gguf/blob/main/OpenELM-1_1B-Instruct.Q4_1.gguf) | Q4_1 | 0.64GB |
32
+ | [OpenELM-1_1B-Instruct.Q5_0.gguf](https://huggingface.co/RichardErkhov/apple_-_OpenELM-1_1B-Instruct-gguf/blob/main/OpenELM-1_1B-Instruct.Q5_0.gguf) | Q5_0 | 0.7GB |
33
+ | [OpenELM-1_1B-Instruct.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/apple_-_OpenELM-1_1B-Instruct-gguf/blob/main/OpenELM-1_1B-Instruct.Q5_K_S.gguf) | Q5_K_S | 0.7GB |
34
+ | [OpenELM-1_1B-Instruct.Q5_K.gguf](https://huggingface.co/RichardErkhov/apple_-_OpenELM-1_1B-Instruct-gguf/blob/main/OpenELM-1_1B-Instruct.Q5_K.gguf) | Q5_K | 0.73GB |
35
+ | [OpenELM-1_1B-Instruct.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/apple_-_OpenELM-1_1B-Instruct-gguf/blob/main/OpenELM-1_1B-Instruct.Q5_K_M.gguf) | Q5_K_M | 0.73GB |
36
+ | [OpenELM-1_1B-Instruct.Q5_1.gguf](https://huggingface.co/RichardErkhov/apple_-_OpenELM-1_1B-Instruct-gguf/blob/main/OpenELM-1_1B-Instruct.Q5_1.gguf) | Q5_1 | 0.76GB |
37
+ | [OpenELM-1_1B-Instruct.Q6_K.gguf](https://huggingface.co/RichardErkhov/apple_-_OpenELM-1_1B-Instruct-gguf/blob/main/OpenELM-1_1B-Instruct.Q6_K.gguf) | Q6_K | 0.83GB |
38
+ | [OpenELM-1_1B-Instruct.Q8_0.gguf](https://huggingface.co/RichardErkhov/apple_-_OpenELM-1_1B-Instruct-gguf/blob/main/OpenELM-1_1B-Instruct.Q8_0.gguf) | Q8_0 | 1.07GB |
39
+
40
+
41
+
42
+
43
+ Original model description:
44
+ ---
45
+ license: other
46
+ license_name: apple-sample-code-license
47
+ license_link: LICENSE
48
+ ---
49
+
50
+ # OpenELM
51
+
52
+ *Sachin Mehta, Mohammad Hossein Sekhavat, Qingqing Cao, Maxwell Horton, Yanzi Jin, Chenfan Sun, Iman Mirzadeh, Mahyar Najibi, Dmitry Belenko, Peter Zatloukal, Mohammad Rastegari*
53
+
54
+ We introduce **OpenELM**, a family of **Open** **E**fficient **L**anguage **M**odels. OpenELM uses a layer-wise scaling strategy to efficiently allocate parameters within each layer of the transformer model, leading to enhanced accuracy. We pretrained OpenELM models using the [CoreNet](https://github.com/apple/corenet) library. We release both pretrained and instruction tuned models with 270M, 450M, 1.1B and 3B parameters.
55
+
56
+ Our pre-training dataset contains RefinedWeb, deduplicated PILE, a subset of RedPajama, and a subset of Dolma v1.6, totaling approximately 1.8 trillion tokens. Please check license agreements and terms of these datasets before using them.
57
+
58
+
59
+
60
+ ## Usage
61
+
62
+ We have provided an example function to generate output from OpenELM models loaded via [HuggingFace Hub](https://huggingface.co/docs/hub/) in `generate_openelm.py`.
63
+
64
+ You can try the model by running the following command:
65
+ ```
66
+ python generate_openelm.py --model apple/OpenELM-1_1B-Instruct --hf_access_token [HF_ACCESS_TOKEN] --prompt 'Once upon a time there was' --generate_kwargs repetition_penalty=1.2
67
+ ```
68
+ Please refer to [this link](https://huggingface.co/docs/hub/security-tokens) to obtain your hugging face access token.
69
+
70
+ Additional arguments to the hugging face generate function can be passed via `generate_kwargs`. As an example, to speedup the inference, you can try [lookup token speculative generation](https://huggingface.co/docs/transformers/generation_strategies) by passing the `prompt_lookup_num_tokens` argument as follows:
71
+ ```
72
+ python generate_openelm.py --model apple/OpenELM-1_1B-Instruct --hf_access_token [HF_ACCESS_TOKEN] --prompt 'Once upon a time there was' --generate_kwargs repetition_penalty=1.2 prompt_lookup_num_tokens=10
73
+ ```
74
+ Alternatively, try model-wise speculative generation with an [assistive model](https://huggingface.co/blog/assisted-generation) by passing a smaller model through the `assistant_model` argument, for example:
75
+ ```
76
+ python generate_openelm.py --model apple/OpenELM-1_1B-Instruct --hf_access_token [HF_ACCESS_TOKEN] --prompt 'Once upon a time there was' --generate_kwargs repetition_penalty=1.2 --assistant_model [SMALLER_MODEL]
77
+ ```
78
+
79
+ ## Main Results
80
+
81
+ ### Zero-Shot
82
+
83
+ | **Model Size** | **ARC-c** | **ARC-e** | **BoolQ** | **HellaSwag** | **PIQA** | **SciQ** | **WinoGrande** | **Average** |
84
+ |-----------------------------------------------------------------------------|-----------|-----------|-----------|---------------|-----------|-----------|----------------|-------------|
85
+ | [OpenELM-270M](https://huggingface.co/apple/OpenELM-270M) | 26.45 | 45.08 | **53.98** | 46.71 | 69.75 | **84.70** | **53.91** | 54.37 |
86
+ | [OpenELM-270M-Instruct](https://huggingface.co/apple/OpenELM-270M-Instruct) | **30.55** | **46.68** | 48.56 | **52.07** | **70.78** | 84.40 | 52.72 | **55.11** |
87
+ | [OpenELM-450M](https://huggingface.co/apple/OpenELM-450M) | 27.56 | 48.06 | 55.78 | 53.97 | 72.31 | 87.20 | 58.01 | 57.56 |
88
+ | [OpenELM-450M-Instruct](https://huggingface.co/apple/OpenELM-450M-Instruct) | **30.38** | **50.00** | **60.37** | **59.34** | **72.63** | **88.00** | **58.96** | **59.95** |
89
+ | [OpenELM-1_1B](https://huggingface.co/apple/OpenELM-1_1B) | 32.34 | **55.43** | 63.58 | 64.81 | **75.57** | **90.60** | 61.72 | 63.44 |
90
+ | [OpenELM-1_1B-Instruct](https://huggingface.co/apple/OpenELM-1_1B-Instruct) | **37.97** | 52.23 | **70.00** | **71.20** | 75.03 | 89.30 | **62.75** | **65.50** |
91
+ | [OpenELM-3B](https://huggingface.co/apple/OpenELM-3B) | 35.58 | 59.89 | 67.40 | 72.44 | 78.24 | **92.70** | 65.51 | 67.39 |
92
+ | [OpenELM-3B-Instruct](https://huggingface.co/apple/OpenELM-3B-Instruct) | **39.42** | **61.74** | **68.17** | **76.36** | **79.00** | 92.50 | **66.85** | **69.15** |
93
+
94
+ ### LLM360
95
+
96
+ | **Model Size** | **ARC-c** | **HellaSwag** | **MMLU** | **TruthfulQA** | **WinoGrande** | **Average** |
97
+ |-----------------------------------------------------------------------------|-----------|---------------|-----------|----------------|----------------|-------------|
98
+ | [OpenELM-270M](https://huggingface.co/apple/OpenELM-270M) | 27.65 | 47.15 | 25.72 | **39.24** | **53.83** | 38.72 |
99
+ | [OpenELM-270M-Instruct](https://huggingface.co/apple/OpenELM-270M-Instruct) | **32.51** | **51.58** | **26.70** | 38.72 | 53.20 | **40.54** |
100
+ | [OpenELM-450M](https://huggingface.co/apple/OpenELM-450M) | 30.20 | 53.86 | **26.01** | 40.18 | 57.22 | 41.50 |
101
+ | [OpenELM-450M-Instruct](https://huggingface.co/apple/OpenELM-450M-Instruct) | **33.53** | **59.31** | 25.41 | **40.48** | **58.33** | **43.41** |
102
+ | [OpenELM-1_1B](https://huggingface.co/apple/OpenELM-1_1B) | 36.69 | 65.71 | **27.05** | 36.98 | 63.22 | 45.93 |
103
+ | [OpenELM-1_1B-Instruct](https://huggingface.co/apple/OpenELM-1_1B-Instruct) | **41.55** | **71.83** | 25.65 | **45.95** | **64.72** | **49.94** |
104
+ | [OpenELM-3B](https://huggingface.co/apple/OpenELM-3B) | 42.24 | 73.28 | **26.76** | 34.98 | 67.25 | 48.90 |
105
+ | [OpenELM-3B-Instruct](https://huggingface.co/apple/OpenELM-3B-Instruct) | **47.70** | **76.87** | 24.80 | **38.76** | **67.96** | **51.22** |
106
+
107
+
108
+ ### OpenLLM Leaderboard
109
+
110
+ | **Model Size** | **ARC-c** | **CrowS-Pairs** | **HellaSwag** | **MMLU** | **PIQA** | **RACE** | **TruthfulQA** | **WinoGrande** | **Average** |
111
+ |-----------------------------------------------------------------------------|-----------|-----------------|---------------|-----------|-----------|-----------|----------------|----------------|-------------|
112
+ | [OpenELM-270M](https://huggingface.co/apple/OpenELM-270M) | 27.65 | **66.79** | 47.15 | 25.72 | 69.75 | 30.91 | **39.24** | **53.83** | 45.13 |
113
+ | [OpenELM-270M-Instruct](https://huggingface.co/apple/OpenELM-270M-Instruct) | **32.51** | 66.01 | **51.58** | **26.70** | **70.78** | 33.78 | 38.72 | 53.20 | **46.66** |
114
+ | [OpenELM-450M](https://huggingface.co/apple/OpenELM-450M) | 30.20 | **68.63** | 53.86 | **26.01** | 72.31 | 33.11 | 40.18 | 57.22 | 47.69 |
115
+ | [OpenELM-450M-Instruct](https://huggingface.co/apple/OpenELM-450M-Instruct) | **33.53** | 67.44 | **59.31** | 25.41 | **72.63** | **36.84** | **40.48** | **58.33** | **49.25** |
116
+ | [OpenELM-1_1B](https://huggingface.co/apple/OpenELM-1_1B) | 36.69 | **71.74** | 65.71 | **27.05** | **75.57** | 36.46 | 36.98 | 63.22 | 51.68 |
117
+ | [OpenELM-1_1B-Instruct](https://huggingface.co/apple/OpenELM-1_1B-Instruct) | **41.55** | 71.02 | **71.83** | 25.65 | 75.03 | **39.43** | **45.95** | **64.72** | **54.40** |
118
+ | [OpenELM-3B](https://huggingface.co/apple/OpenELM-3B) | 42.24 | **73.29** | 73.28 | **26.76** | 78.24 | **38.76** | 34.98 | 67.25 | 54.35 |
119
+ | [OpenELM-3B-Instruct](https://huggingface.co/apple/OpenELM-3B-Instruct) | **47.70** | 72.33 | **76.87** | 24.80 | **79.00** | 38.47 | **38.76** | **67.96** | **55.73** |
120
+
121
+ See the technical report for more results and comparison.
122
+
123
+ ## Evaluation
124
+
125
+ ### Setup
126
+
127
+ Install the following dependencies:
128
+
129
+ ```bash
130
+
131
+ # install public lm-eval-harness
132
+
133
+ harness_repo="public-lm-eval-harness"
134
+ git clone https://github.com/EleutherAI/lm-evaluation-harness ${harness_repo}
135
+ cd ${harness_repo}
136
+ # use main branch on 03-15-2024, SHA is dc90fec
137
+ git checkout dc90fec
138
+ pip install -e .
139
+ cd ..
140
+
141
+ # 66d6242 is the main branch on 2024-04-01
142
+ pip install datasets@git+https://github.com/huggingface/datasets.git@66d6242
143
+ pip install tokenizers>=0.15.2 transformers>=4.38.2 sentencepiece>=0.2.0
144
+
145
+ ```
146
+
147
+ ### Evaluate OpenELM
148
+
149
+ ```bash
150
+
151
+ # OpenELM-1_1B-Instruct
152
+ hf_model=apple/OpenELM-1_1B-Instruct
153
+
154
+ # this flag is needed because lm-eval-harness set add_bos_token to False by default, but OpenELM uses LLaMA tokenizer which requires add_bos_token to be True
155
+ tokenizer=meta-llama/Llama-2-7b-hf
156
+ add_bos_token=True
157
+ batch_size=1
158
+
159
+ mkdir lm_eval_output
160
+
161
+ shot=0
162
+ task=arc_challenge,arc_easy,boolq,hellaswag,piqa,race,winogrande,sciq,truthfulqa_mc2
163
+ lm_eval --model hf \
164
+ --model_args pretrained=${hf_model},trust_remote_code=True,add_bos_token=${add_bos_token},tokenizer=${tokenizer} \
165
+ --tasks ${task} \
166
+ --device cuda:0 \
167
+ --num_fewshot ${shot} \
168
+ --output_path ./lm_eval_output/${hf_model//\//_}_${task//,/_}-${shot}shot \
169
+ --batch_size ${batch_size} 2>&1 | tee ./lm_eval_output/eval-${hf_model//\//_}_${task//,/_}-${shot}shot.log
170
+
171
+ shot=5
172
+ task=mmlu,winogrande
173
+ lm_eval --model hf \
174
+ --model_args pretrained=${hf_model},trust_remote_code=True,add_bos_token=${add_bos_token},tokenizer=${tokenizer} \
175
+ --tasks ${task} \
176
+ --device cuda:0 \
177
+ --num_fewshot ${shot} \
178
+ --output_path ./lm_eval_output/${hf_model//\//_}_${task//,/_}-${shot}shot \
179
+ --batch_size ${batch_size} 2>&1 | tee ./lm_eval_output/eval-${hf_model//\//_}_${task//,/_}-${shot}shot.log
180
+
181
+ shot=25
182
+ task=arc_challenge,crows_pairs_english
183
+ lm_eval --model hf \
184
+ --model_args pretrained=${hf_model},trust_remote_code=True,add_bos_token=${add_bos_token},tokenizer=${tokenizer} \
185
+ --tasks ${task} \
186
+ --device cuda:0 \
187
+ --num_fewshot ${shot} \
188
+ --output_path ./lm_eval_output/${hf_model//\//_}_${task//,/_}-${shot}shot \
189
+ --batch_size ${batch_size} 2>&1 | tee ./lm_eval_output/eval-${hf_model//\//_}_${task//,/_}-${shot}shot.log
190
+
191
+ shot=10
192
+ task=hellaswag
193
+ lm_eval --model hf \
194
+ --model_args pretrained=${hf_model},trust_remote_code=True,add_bos_token=${add_bos_token},tokenizer=${tokenizer} \
195
+ --tasks ${task} \
196
+ --device cuda:0 \
197
+ --num_fewshot ${shot} \
198
+ --output_path ./lm_eval_output/${hf_model//\//_}_${task//,/_}-${shot}shot \
199
+ --batch_size ${batch_size} 2>&1 | tee ./lm_eval_output/eval-${hf_model//\//_}_${task//,/_}-${shot}shot.log
200
+
201
+ ```
202
+
203
+
204
+ ## Bias, Risks, and Limitations
205
+
206
+ The release of OpenELM models aims to empower and enrich the open research community by providing access to state-of-the-art language models. Trained on publicly available datasets, these models are made available without any safety guarantees. Consequently, there exists the possibility of these models producing outputs that are inaccurate, harmful, biased, or objectionable in response to user prompts. Thus, it is imperative for users and developers to undertake thorough safety testing and implement appropriate filtering mechanisms tailored to their specific requirements.
207
+
208
+ ## Citation
209
+
210
+ If you find our work useful, please cite:
211
+
212
+ ```BibTex
213
+ @article{mehtaOpenELMEfficientLanguage2024,
214
+ title = {{OpenELM}: {An} {Efficient} {Language} {Model} {Family} with {Open} {Training} and {Inference} {Framework}},
215
+ shorttitle = {{OpenELM}},
216
+ url = {https://arxiv.org/abs/2404.14619v1},
217
+ language = {en},
218
+ urldate = {2024-04-24},
219
+ journal = {arXiv.org},
220
+ author = {Mehta, Sachin and Sekhavat, Mohammad Hossein and Cao, Qingqing and Horton, Maxwell and Jin, Yanzi and Sun, Chenfan and Mirzadeh, Iman and Najibi, Mahyar and Belenko, Dmitry and Zatloukal, Peter and Rastegari, Mohammad},
221
+ month = apr,
222
+ year = {2024},
223
+ }
224
+
225
+ @inproceedings{mehta2022cvnets,
226
+ author = {Mehta, Sachin and Abdolhosseini, Farzad and Rastegari, Mohammad},
227
+ title = {CVNets: High Performance Library for Computer Vision},
228
+ year = {2022},
229
+ booktitle = {Proceedings of the 30th ACM International Conference on Multimedia},
230
+ series = {MM '22}
231
+ }
232
+ ```
233
+
234
+