File size: 7,175 Bytes
8377e26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43e814d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8377e26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
---
license: apache-2.0
datasets:
- allenai/dolmino-mix-1124
- allenai/olmo-mix-1124
language:
- en
base_model: allenai/OLMo-2-1124-7B
tags:
- llama-cpp
- gguf-my-repo
---

# Triangle104/OLMo-2-1124-7B-Q5_K_S-GGUF
This model was converted to GGUF format from [`allenai/OLMo-2-1124-7B`](https://huggingface.co/allenai/OLMo-2-1124-7B) using llama.cpp via the ggml.ai's [GGUF-my-repo](https://huggingface.co/spaces/ggml-org/gguf-my-repo) space.
Refer to the [original model card](https://huggingface.co/allenai/OLMo-2-1124-7B) for more details on the model.

---
Model details:
-
We introduce OLMo 2, a new family of 7B and 13B models featuring a 
9-point increase in MMLU, among other evaluation improvements, compared 
to the original OLMo 7B model. These gains come from training on 
OLMo-mix-1124 and Dolmino-mix-1124 datasets and staged training 
approach.

OLMo is a series of Open Language Models
 designed to enable the science of language models. 
These models are trained on the Dolma dataset. We are releasing all 
code, checkpoints, logs (coming soon), and associated training details. 

		Installation
	



OLMo 2 will be supported in the next version of Transformers, and you need to install it from the main branch using:


pip install --upgrade git+https://github.com/huggingface/transformers.git

    Inference



You can use OLMo with the standard HuggingFace transformers library:

from transformers import AutoModelForCausalLM, AutoTokenizer
olmo = AutoModelForCausalLM.from_pretrained("allenai/OLMo-2-1124-7B")
tokenizer = AutoTokenizer.from_pretrained("allenai/OLMo-2-1124-7B")
message = ["Language modeling is "]
inputs = tokenizer(message, return_tensors='pt', return_token_type_ids=False)

		optional verifying cuda
	




	
		
	

		inputs = {k: v.to('cuda') for k,v in inputs.items()}
	




	
		
	

		olmo = olmo.to('cuda')
	



response = olmo.generate(**inputs, max_new_tokens=100, do_sample=True, top_k=50, top_p=0.95)
print(tokenizer.batch_decode(response, skip_special_tokens=True)[0])

'Language modeling is  a key component of any text-based application, but its effectiveness...'

For faster performance, you can quantize the model using the following method:

AutoModelForCausalLM.from_pretrained("allenai/OLMo-2-1124-7B", 
    torch_dtype=torch.float16, 
    load_in_8bit=True)  # Requires bitsandbytes


The quantized model is more sensitive to data 
types and CUDA operations. To avoid potential issues, it's recommended 
to pass the inputs directly to CUDA using:

inputs.input_ids.to('cuda')

We have released checkpoints for these models. For pretraining, the 
naming convention is stepXXX-tokensYYYB. For checkpoints with 
ingredients of the soup, the naming convention is 
stage2-ingredientN-stepXXX-tokensYYYB

To load a specific model revision with HuggingFace, simply add the argument revision:

olmo = AutoModelForCausalLM.from_pretrained("allenai/OLMo-2-1124-7B", revision="step1000-tokens5B")

Or, you can access all the revisions for the models via the following code snippet:

from huggingface_hub import list_repo_refs
out = list_repo_refs("allenai/OLMo-2-1124-7B")
branches = [b.name for b in out.branches]

    Fine-tuning



Model fine-tuning can be done from the final checkpoint (the main 
revision of this model) or many intermediate checkpoints. Two recipes 
for tuning are available.

Fine-tune with the OLMo repository:

torchrun --nproc_per_node=8 scripts/train.py {path_to_train_config} 
    --data.paths=[{path_to_data}/input_ids.npy] 
    --data.label_mask_paths=[{path_to_data}/label_mask.npy] 
    --load_path={path_to_checkpoint} 
    --reset_trainer_state


For more documentation, see the GitHub readme.

Further fine-tuning support is being developing in AI2's Open Instruct repository. Details are here.


    Model Description



Developed by: Allen Institute for AI (Ai2)
Model type: a Transformer style autoregressive language model.
Language(s) (NLP): English
License: The code and model are released under Apache 2.0.
Contact: Technical inquiries: [email protected]. Press: [email protected]
Date cutoff: Dec. 2023.

    Model Sources



Project Page: https://allenai.org/olmo
Repositories: 
Core repo (training, inference, fine-tuning etc.): https://github.com/allenai/OLMo
Evaluation code: https://github.com/allenai/OLMo-Eval
Further fine-tuning code: https://github.com/allenai/open-instruct

Paper: Coming soon

    Pretraining






    



OLMo 2 7B
OLMo 2 13B

Pretraining Stage 1
(OLMo-Mix-1124)
4 trillion tokens
(1 epoch)
5 trillion tokens
(1.2 epochs)

Pretraining Stage 2
(Dolmino-Mix-1124)
50B tokens (3 runs)
merged
100B tokens (3 runs)
300B tokens (1 run)
merged

Post-training
(Tulu 3 SFT OLMo mix)
SFT + DPO + PPO
(preference mix)
SFT + DPO + PPO
(preference mix)

    Stage 1: Initial Pretraining



Dataset: OLMo-Mix-1124 (3.9T tokens)
Coverage: 90%+ of total pretraining budget
7B Model: ~1 epoch
13B Model: 1.2 epochs (5T tokens)

    Stage 2: Fine-tuning



Dataset: Dolmino-Mix-1124 (843B tokens)
Three training mixes:
50B tokens
100B tokens
300B tokens

Mix composition: 50% high-quality data + academic/Q&A/instruction/math content

    Model Merging



7B Model: 3 versions trained on 50B mix, merged via model souping
13B Model: 3 versions on 100B mix + 1 version on 300B mix, merged for final checkpoint

    Bias, Risks, and Limitations



Like any base language model or fine-tuned model without safety 
filtering, these models can easily be prompted by users to generate 
harmful and sensitive content. Such content may also be produced 
unintentionally, especially in cases involving bias, so we recommend 
that users consider the risks when applying this technology. 
Additionally, many statements from OLMo or any LLM are often inaccurate,
 so facts should be verified.

    Citation



A technical manuscript is forthcoming!

    Model Card Contact



For errors in this model card, contact [email protected].

---
## Use with llama.cpp
Install llama.cpp through brew (works on Mac and Linux)

```bash
brew install llama.cpp

```
Invoke the llama.cpp server or the CLI.

### CLI:
```bash
llama-cli --hf-repo Triangle104/OLMo-2-1124-7B-Q5_K_S-GGUF --hf-file olmo-2-1124-7b-q5_k_s.gguf -p "The meaning to life and the universe is"
```

### Server:
```bash
llama-server --hf-repo Triangle104/OLMo-2-1124-7B-Q5_K_S-GGUF --hf-file olmo-2-1124-7b-q5_k_s.gguf -c 2048
```

Note: You can also use this checkpoint directly through the [usage steps](https://github.com/ggerganov/llama.cpp?tab=readme-ov-file#usage) listed in the Llama.cpp repo as well.

Step 1: Clone llama.cpp from GitHub.
```
git clone https://github.com/ggerganov/llama.cpp
```

Step 2: Move into the llama.cpp folder and build it with `LLAMA_CURL=1` flag along with other hardware-specific flags (for ex: LLAMA_CUDA=1 for Nvidia GPUs on Linux).
```
cd llama.cpp && LLAMA_CURL=1 make
```

Step 3: Run inference through the main binary.
```
./llama-cli --hf-repo Triangle104/OLMo-2-1124-7B-Q5_K_S-GGUF --hf-file olmo-2-1124-7b-q5_k_s.gguf -p "The meaning to life and the universe is"
```
or 
```
./llama-server --hf-repo Triangle104/OLMo-2-1124-7B-Q5_K_S-GGUF --hf-file olmo-2-1124-7b-q5_k_s.gguf -c 2048
```