Safetensors
English
olmo2
OLMo-2-1124-7B / README.md
amanrangapur's picture
Update README.md
1e0ba4a verified
|
raw
history blame
9.6 kB
metadata
license: apache-2.0
datasets:
  - allenai/dolmino-mix-1124
language:
  - en

Model Details

OLMo Logo

Model Card for OLMo2 7B

OLMo2 7B November 2024 is an updated version of the original 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 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. The core models released in this batch include the following:

Size Training Tokens Layers Hidden Size Attention Heads Context Length
OLMo2-7B July 2024 4 Trillion 32 4096 32 4096
OLMo2- 13B July 2024 5 Trillion 40 5120 42 4096

Inference

You can use OLMo with the standard HuggingFace transformers library:

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:

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:

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:

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:

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:
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.

  1. 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)
  • 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

Evaluation

TODO

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.