|
--- |
|
license: apache-2.0 |
|
datasets: |
|
- allenai/dolmino-mix-1124 |
|
language: |
|
- en |
|
--- |
|
|
|
## Model Details |
|
|
|
<img src="https://allenai.org/olmo/olmo-7b-animation.gif" alt="OLMo Logo" width="800" style="margin-left:'auto' margin-right:'auto' display:'block'"/> |
|
|
|
|
|
# Model Card for OLMo2 7B |
|
|
|
OLMo2 7B November 2024 is an updated version of the original [OLMo 7B](https://huggingface.co/allenai/OLMo-7B) model rocking a ____ point increase in ____, among other evaluations improvements, from an improved version of the Dolma dataset and staged training. |
|
|
|
OLMo is a series of **O**pen **L**anguage **Mo**dels 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. |
|
The core models released in this batch include the following: |
|
|
|
| Size | Training Tokens | Layers | Hidden Size | Attention Heads | Context Length | |
|
|------|--------|---------|-------------|-----------------|----------------| |
|
| [OLMo2-7B July 2024](https://huggingface.co/allenai/OLMo-2-7B-1124) | 4 Trillion | 32 | 4096 | 32 | 4096 | |
|
| [OLMo2- 13B July 2024](https://huggingface.co/allenai/OLMo-2-13B-1124) | 5 Trillion | 40 | 5120 | 42 | 4096 | |
|
|
|
## Inference |
|
|
|
You can use OLMo with the standard HuggingFace transformers library: |
|
```python |
|
from transformers import AutoModelForCausalLM, AutoTokenizer |
|
olmo = AutoModelForCausalLM.from_pretrained("allenai/OLMo2-7B-1124") |
|
tokenizer = AutoTokenizer.from_pretrained("allenai/OLMo2-7B-1124") |
|
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 the first step to build natural language generation...' |
|
``` |
|
|
|
For faster performance, you can quantize the model using the following method: |
|
```python |
|
AutoModelForCausalLM.from_pretrained("allenai/OLMo2-7B-1124", |
|
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: |
|
```python |
|
inputs.input_ids.to('cuda') |
|
``` |
|
|
|
We have released checkpoints for these models, for every 1000 training steps. |
|
The naming convention is `stepXXX-tokensYYYB`. |
|
|
|
To load a specific model revision with HuggingFace, simply add the argument `revision`: |
|
```bash |
|
olmo = AutoModelForCausalLM.from_pretrained("allenai/OLMo2-7B-1124", revision="step1000-tokens5B") |
|
``` |
|
|
|
Or, you can access all the revisions for the models via the following code snippet: |
|
```python |
|
from huggingface_hub import list_repo_refs |
|
out = list_repo_refs("allenai/OLMo2-7B-1124") |
|
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. |
|
1. Fine-tune with the OLMo repository: |
|
```bash |
|
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](https://github.com/allenai/OLMo?tab=readme-ov-file#fine-tuning). |
|
|
|
2. Further fine-tuning support is being developing in AI2's Open Instruct repository. Details are [here](https://github.com/allenai/open-instruct). |
|
|
|
### Model Description |
|
|
|
- **Developed by:** Allen Institute for AI (Ai2) |
|
- **Supported by:** Databricks, Kempner Institute for the Study of Natural and Artificial Intelligence at Harvard University, AMD, CSC (Lumi Supercomputer), UW |
|
- **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: `olmo at allenai dot org`. Press: `press at allenai dot org` |
|
- **Date cutoff:** Oct. 2023, with most data from Feb./March 2023 based on Dolma dataset version. |
|
|
|
|
|
### 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:** [Link](https://arxiv.org/abs/2402.00838) --> |
|
<!-- - **Technical blog post:** https://blog.allenai.org/olmo-1-7-7b-a-24-point-improvement-on-mmlu-92b43f7d269d --> |
|
<!-- - **W&B Logs:** [pretraining](https://wandb.ai/ai2-llm/OLMo-7B/groups/OLMo-1.7-7B), [annealing](https://wandb.ai/ai2-llm/OLMo-7B/groups/OLMo-1.7-7B-anneal) --> |
|
|
|
|
|
<!-- TODO --> |
|
## Evaluation |
|
`TODO` |
|
<!-- Core model results for OLMo2 7B models are found below: |
|
|
|
| Task | Llama-7b | Llama2-7b | Falcon-7b | Mpt-7b | OLMo-7B | Llama2-13b | OLMo 7B April 2024 | **OLMo2 7B** | |
|
|-------------------|----------|-----------|-----------|--------|---------|------------|--------------------|-----------------------| |
|
| arc_c | 44.5 | 48.5 | 47.5 | 46.5 | 48.5 | 52.8 | 42.5 | 43.8 | |
|
| arc_e | 67.9 | 69.5 | 70.4 | 70.5 | 65.4 | 73.7 | 67.2 | 68.8 | |
|
| boolq | 75.4 | 80.2 | 74.6 | 74.2 | 73.4 | 82.2 | 83.7 | 78.9 | |
|
| copa | 91.0 | 86.0 | 86.0 | 85.0 | 90.0 | 90.0 | 86.0 | 84.0 | |
|
| hellaswag | 76.2 | 76.8 | 75.9 | 77.6 | 76.4 | 78.6 | 75.5 | 77.4 | |
|
| openbookqa | 51.2 | 48.4 | 53.0 | 48.6 | 50.4 | 51.8 | 50.0 | 48.2 | |
|
| piqa | 77.2 | 76.7 | 78.5 | 77.3 | 78.4 | 79.0 | 77.5 | 78.2 | |
|
| sciq | 93.9 | 94.5 | 93.9 | 93.7 | 93.8 | 95.5 | 96.7 | 97.0 | |
|
| winogrande | 70.5 | 69.4 | 68.9 | 69.9 | 67.9 | 73.5 | 69.8 | 68.8 | |
|
| truthfulQA (MC2) | 33.9 | 38.5 | 34.0 | 33.0 | 36.0 | 36.8 | 35.8 | 36.5 | |
|
| MMLU (5 shot MC) | 31.5 | 45.0 | 24.0 | 30.8 | 28.3 | 55.5 | 52.0 | 53.4 | |
|
| GSM8k | 10.0 | 12.0 | 4.0 | 4.5 | 8.5 | 25.0 | 29.0 | 35.0 | |
|
| Full average | 60.3 | 62.1 | 59.2 | 59.3 | 59.8 | 66.2 | 63.8 | 64.2 | |
|
|
|
And for OLMo 13B model: |
|
|
|
| task | random | [StableLM 2 1.6b](https://huggingface.co/stabilityai/stablelm-2-1_6b)\* | [Pythia 1B](https://huggingface.co/EleutherAI/pythia-1b) | [TinyLlama 1.1B](https://huggingface.co/TinyLlama/TinyLlama-1.1B-intermediate-step-1195k-token-2.5T) | [OLMo 1.0 1B](https://huggingface.co/allenai/OLMo-1B-hf) | **OLMo 1B July 2024** | |
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------ | ----------------- | --------- | -------------------------------------- | ------- | ------ | |
|
| arc_challenge | 25 | 43.81 | 33.11 | 34.78 | 34.45 | 36.5 | |
|
| arc_easy | 25 | 63.68 | 50.18 | 53.16 | 58.07 | 55.3 | |
|
| boolq | 50 | 76.6 | 61.8 | 64.6 | 60.7 | 67.5 | |
|
| copa | 50 | 84 | 72 | 78 | 79 | 83.0 | |
|
| hellaswag | 25 | 68.2 | 44.7 | 58.7 | 62.5 | 66.9 | |
|
| openbookqa | 25 | 45.8 | 37.8 | 43.6 | 46.4 | 46.4 | |
|
| piqa | 50 | 74 | 69.1 | 71.1 | 73.7 | 74.9 | |
|
| sciq | 25 | 94.7 | 86 | 90.5 | 88.1 | 93.4 | |
|
| winogrande | 50 | 64.9 | 53.3 | 58.9 | 58.9 | 61.4 | |
|
| Average | 36.11 | 68.41 | 56.44 | 61.48 | 62.42 | 65.0 | |
|
--> |
|
|
|
## Model Details |
|
|
|
### Data |
|
`TODO` |
|
|
|
### Staged training / annealing |
|
`TODO` |
|
|
|
|
|
|
|
|
|
## 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 |
|
`TODO` |
|
|
|
## Model Card Contact |
|
|
|
|
|
For errors in this model card, contact Aman, `{amanr} at allenai dot org`. |