aashish1904
commited on
Commit
•
36562fc
1
Parent(s):
5d54240
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
@@ -0,0 +1,319 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
---
|
3 |
+
|
4 |
+
license: apache-2.0
|
5 |
+
datasets:
|
6 |
+
- allenai/dolma
|
7 |
+
pipeline_tag: text-generation
|
8 |
+
|
9 |
+
---
|
10 |
+
|
11 |
+
[![QuantFactory Banner](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeiuCm7c8lEwEJuRey9kiVZsRn2W-b4pWlu3-X534V3YmVuVc2ZL-NXg2RkzSOOS2JXGHutDuyyNAUtdJI65jGTo8jT9Y99tMi4H4MqL44Uc5QKG77B0d6-JfIkZHFaUA71-RtjyYZWVIhqsNZcx8-OMaA?key=xt3VSDoCbmTY7o-cwwOFwQ)](https://hf.co/QuantFactory)
|
12 |
+
|
13 |
+
|
14 |
+
# QuantFactory/AMD-OLMo-1B-GGUF
|
15 |
+
This is quantized version of [amd/AMD-OLMo-1B](https://huggingface.co/amd/AMD-OLMo-1B) created using llama.cpp
|
16 |
+
|
17 |
+
# Original Model Card
|
18 |
+
|
19 |
+
# AMD-OLMo
|
20 |
+
|
21 |
+
AMD-OLMo are a series of 1B language models trained from scratch by AMD on AMD Instinct™ MI250 GPUs. The training code used is based on [OLMo](https://github.com/allenai/OLMo).
|
22 |
+
We release the pre-trained model, supervised fine-tuned model, and DPO aligned model as follows:
|
23 |
+
|
24 |
+
- [AMD-OLMo-1B](https://huggingface.co/amd/AMD-OLMo-1B): Pre-trained on a subset of [Dolma v1.7](https://huggingface.co/datasets/allenai/dolma) that consists of 1.3 trillion tokens.
|
25 |
+
- [AMD-OLMo-1B-SFT](https://huggingface.co/amd/AMD-OLMo-1B-SFT): Supervised fine-tuned (SFT) on [Tulu V2](https://huggingface.co/datasets/allenai/tulu-v2-sft-mixture) dataset (1st phase) and then [OpenHermes-2.5](https://huggingface.co/datasets/teknium/OpenHermes-2.5), [WebInstructSub](https://huggingface.co/datasets/TIGER-Lab/WebInstructSub), and [Code-Feedback](https://huggingface.co/datasets/m-a-p/Code-Feedback) datasets (2nd phase).
|
26 |
+
- [AMD-OLMo-1B-SFT-DPO](https://huggingface.co/amd/AMD-OLMo-1B-SFT-DPO): Aligned with human preferences using Direct Preference Optimization (DPO) on [UltraFeedback](https://huggingface.co/datasets/argilla/ultrafeedback-binarized-preferences-cleaned) dataset.
|
27 |
+
|
28 |
+
Description:
|
29 |
+
|
30 |
+
- **Hardware**: Each compute node consists of 4 AMD Instinct™ MI250 GPUs. We use 16 nodes for pretraining AMD-OLMo-1B
|
31 |
+
|
32 |
+
- **Training throughput**: 12,200 tokens/sec/gpu
|
33 |
+
|
34 |
+
- **Model architecture**: AMD-OLMo-1B is based on the model architecture and training set up of fully open source 1 billion version of [OLMo-1B](https://github.com/allenai/OLMo) with the details below:
|
35 |
+
|
36 |
+
| Parameter size | Number of layers | Number of heads | Hidden size | Context length | Vocabulary Size |
|
37 |
+
|-----------------:|:------------------:|:-----------------:|:-------------:|:----------------:|:----------------:|
|
38 |
+
| 1.2B | 16 | 16 | 2048 | 2048 | 50,280 |
|
39 |
+
|
40 |
+
- **Hyper-parameters**:
|
41 |
+
|Stage | LR schedule | Peak LR | Warmup steps |Epochs| Batch size (tokens) |
|
42 |
+
|------------:|:--------------:|:---------:|:--------------:|:------:|:---------------------:|
|
43 |
+
|Pretraining | Cosine | 4.0e-4 | 2000 | 1 | 4M |
|
44 |
+
|SFT Phase 1 | Linear | 2.0e-5 | 200 | 3 | 262K |
|
45 |
+
|SFT Phase 2 | Linear | 2.0e-5 | 200 | 3 | 1024K |
|
46 |
+
|DPO | Cosine | 4.0e-6 | 47 | 1 | 64K |
|
47 |
+
|
48 |
+
For more details, please refer to our [blog](https://www.amd.com/en/developer/resources/technical-articles/introducing-the-first-amd-1b-language-model.html).
|
49 |
+
|
50 |
+
## Usage
|
51 |
+
|
52 |
+
### PyTorch on AMD GPUs
|
53 |
+
For running pytorch on AMD GPUs you can use the following rocm docker as in [docker hub](https://hub.docker.com/r/rocm/pytorch)
|
54 |
+
|
55 |
+
```bash
|
56 |
+
docker pull rocm/pytorch:latest
|
57 |
+
# Inside docker
|
58 |
+
pip install transformers
|
59 |
+
```
|
60 |
+
|
61 |
+
### Use Example
|
62 |
+
|
63 |
+
```python
|
64 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
65 |
+
|
66 |
+
model = AutoModelForCausalLM.from_pretrained("amd/AMD-OLMo-1B-SFT").to("cuda") # remove .to("cuda") to load on cpu
|
67 |
+
tokenizer = AutoTokenizer.from_pretrained("amd/AMD-OLMo-1B-SFT")
|
68 |
+
|
69 |
+
prompt = "What is large language model?"
|
70 |
+
bos = tokenizer.eos_token
|
71 |
+
template = bos + "<|user|>\n{prompt}\n<|assistant|>\n"
|
72 |
+
|
73 |
+
input_text = template.format(prompt=prompt)
|
74 |
+
inputs = tokenizer([input_text], return_tensors='pt', return_token_type_ids=False).to("cuda")
|
75 |
+
outputs = model.generate(**inputs, max_new_tokens=1000, do_sample=True, top_k=50, top_p=0.95)
|
76 |
+
print(tokenizer.batch_decode(outputs, skip_special_tokens=True)[0])
|
77 |
+
```
|
78 |
+
|
79 |
+
|
80 |
+
## Main Results
|
81 |
+
|
82 |
+
### Pretraining Results
|
83 |
+
|
84 |
+
| **Standard Benchmarks** | [TinyLLaMA-v1.1](https://huggingface.co/TinyLlama/TinyLlama_v1.1) (1.1B) | [MobiLLaMA-1B](https://huggingface.co/MBZUAI/MobiLlama-1B) (1.2B) | [OLMo-1B](https://huggingface.co/allenai/OLMo-1B-hf) (1.2B) | [OpenELM-1_1B](https://huggingface.co/apple/OpenELM-1_1B) (1.1B) | [OLMo-1B-0724-hf](https://huggingface.co/allenai/OLMo-1B-0724-hf) (1.2B) | [AMD-OLMo-1B](https://huggingface.co/amd/AMD-OLMo-1B) (1.2B) |
|
85 |
+
|---------------------:|:-----------------:|:-----------:|:-----------:|:---------------:|:---------------:|:-----------:|
|
86 |
+
| **arc_easy** | 55.47 | 56.65 | 57.28 | 55.43 | 56.65 | **63.64** |
|
87 |
+
| **arc_challenge** | 32.68 | 32.00 | 31.06 | 32.34 | 32.34 | **33.70** |
|
88 |
+
| **hellaswag** | 61.47 | 61.80 | 62.92 | 64.81 | **66.12** | 63.61 |
|
89 |
+
| **piqa** | 73.56 | 75.30 | 75.14 | **75.57** | 75.08 | **75.57** |
|
90 |
+
| **boolq** | 55.99 | 60.83 | 61.74 | 63.58 | **66.18** | 60.58 |
|
91 |
+
| **sciq** | 89.30 | 88.20 | 87.00 | 90.60 | 92.70 | **93.20** |
|
92 |
+
| **winogrande** | 59.43 | 59.27 | 59.98 | **61.72** | **61.72** | 61.64 |
|
93 |
+
| **openbookqa** | **36.80** | 35.40 | 36.20 | 36.20 | 35.60 | 35.80 |
|
94 |
+
| **mmlu (0-shot)** | 25.02 | 24.81 | 24.23 | 25.26 | **25.45** | 24.88 |
|
95 |
+
| **gsm8k (8-shot)** | 1.82 | 0.00 | 2.50 | 2.81 | **8.95** | 2.88 |
|
96 |
+
| **bbh (3-shot)** | **25.63** | 0.00 | **25.63** | 16.77 | 21.67 | 20.95 |
|
97 |
+
| **Average** | 47.02 | 44.93 | 47.61 | 47.73 | **49.31** | 48.77 |
|
98 |
+
|
99 |
+
|
100 |
+
### Instruction Tuning Results
|
101 |
+
|
102 |
+
| **Standard Benchmarks**|[TinyLlama-1.1B-Chat-v1.0](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0) (1.1B)|[MobiLlama-1B-Chat](https://huggingface.co/MBZUAI/MobiLlama-1B-Chat) (1.2B)|[OpenELM-1_1B-Instruct](https://huggingface.co/apple/OpenELM-1_1B-Instruct) (1.1B)|[AMD-OLMo-1B-SFT](https://huggingface.co/amd/AMD-OLMo-1B-SFT) (1.2B)|[AMD-OLMo-1B-SFT-DPO](https://huggingface.co/amd/AMD-OLMo-1B-SFT-DPO) (1.2B)|
|
103 |
+
|------------------:|:---------:|:---------:|:---------:|:---------:|:---------:|
|
104 |
+
| **arc_easy** | 54.42 | 57.41 | 52.44 | 63.68 | **64.31** |
|
105 |
+
| **arc_challenge** | 32.85 | 34.56 | **37.80** | 37.12 | 37.37 |
|
106 |
+
| **hellaswag** | 60.40 | 62.51 | **71.29** | 61.63 | 61.91 |
|
107 |
+
| **piqa** | 74.48 | **75.73** | 75.03 | 74.43 | 74.16 |
|
108 |
+
| **boolq** | 61.04 | 55.66 | **70.28** | 68.53 | 70.24 |
|
109 |
+
| **sciq** | 88.40 | 87.10 | 89.50 | 91.20 | **92.10** |
|
110 |
+
| **winogrande** | 60.54 | 60.77 | **62.19** | 60.22 | 60.62 |
|
111 |
+
| **openbookqa** | 37.20 | 36.80 | 39.20 | 37.40 | **40.20** |
|
112 |
+
| **mmlu** | 24.61 | 25.25 | 25.54 | 29.97 | **30.52** |
|
113 |
+
| **gsm8k (8-shot)**| 2.81 | 0.23 | 1.82 | **18.20** | 15.77 |
|
114 |
+
| **bbh (3-shot)** | **26.83** | 0.00 | 13.40 | 25.17 | 25.45 |
|
115 |
+
| **Average** | 47.60 | 45.09 | 48.95 | 51.60 | **52.06** |
|
116 |
+
|
117 |
+
|**Chat Benchmarks**|[TinyLlama-1.1B-Chat-v1.0](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0) (1.1B)|[MobiLlama-1B-Chat](https://huggingface.co/MBZUAI/MobiLlama-1B-Chat) (1.2B)|[OpenELM-1_1B-Instruct](https://huggingface.co/apple/OpenELM-1_1B-Instruct) (1.1B)|[AMD-OLMo-1B-SFT](https://huggingface.co/amd/AMD-OLMo-1B-SFT) (1.2B)|[AMD-OLMo-1B-SFT-DPO](https://huggingface.co/amd/AMD-OLMo-1B-SFT-DPO) (1.2B)|
|
118 |
+
|------------------:|:---------:|:---------:|:---------:|:---------:|:---------:|
|
119 |
+
| **AlpacaEval 1 (Win Rate)** | 50.81 | 34.90 | 37.72 | 50.12 | **54.22** |
|
120 |
+
| **AlpacaEval 2 (LC Win Rate)**| 1.54 | 1.59 | 0.49 | **3.88** | 2.37 |
|
121 |
+
| **MTBench** | 3.38 | 2.89 | - | **4.35** | 4.10 |
|
122 |
+
|
123 |
+
|**Responsible AI Benchmarks**|[TinyLlama-1.1B-Chat-v1.0](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0) (1.1B)|[MobiLlama-1B-Chat](https://huggingface.co/MBZUAI/MobiLlama-1B-Chat) (1.2B)|[OpenELM-1_1B-Instruct](https://huggingface.co/apple/OpenELM-1_1B-Instruct) (1.1B)|[AMD-OLMo-1B-SFT](https://huggingface.co/amd/AMD-OLMo-1B-SFT) (1.2B)|[AMD-OLMo-1B-SFT-DPO](https://huggingface.co/amd/AMD-OLMo-1B-SFT-DPO) (1.2B)|
|
124 |
+
|------------------:|:---------:|:---------:|:---------:|:---------:|:---------:|
|
125 |
+
| **ToxiGen** | 41.70 | **37.23** | 42.34 | 39.04 | 39.68 |
|
126 |
+
| **crows_pairs** | 60.35 | 58.50 | 59.93 | 60.29 | **61.00** |
|
127 |
+
| **TruthfulQA-mc2**| 37.92 | 38.46 | **45.84** | 37.45 | 40.06 |
|
128 |
+
|
129 |
+
*In generating tokens for chat benchmark evaluations, we use `max_length=2048` for AlpacaEval and `max_new_tokens=2048` for MTBench.
|
130 |
+
|
131 |
+
*All numbers in above tables were obtained from our evaluations.
|
132 |
+
|
133 |
+
|
134 |
+
## Evaluation
|
135 |
+
We use the following open source evaluation frameworks for evaluating our models:
|
136 |
+
- [Language Model Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness): For evaluating on commonsense reasoning, multi-task understanding & responsible AI benchmarks
|
137 |
+
- [AlpacaEval](https://github.com/tatsu-lab/alpaca_eval): For evaluating instruction-following capabilities of chat models.
|
138 |
+
- [MT-Bench](https://github.com/lm-sys/FastChat/tree/main/fastchat/llm_judge): For evaluating multi-turn capabilities of chat models.
|
139 |
+
|
140 |
+
### Setup
|
141 |
+
```bash
|
142 |
+
# lm-eval-harness
|
143 |
+
git clone https://github.com/EleutherAI/lm-evaluation-harness
|
144 |
+
cd lm-evaluation-harness
|
145 |
+
pip install -e .
|
146 |
+
|
147 |
+
# AlpacaEval
|
148 |
+
pip install git+https://github.com/tatsu-lab/alpaca_eval
|
149 |
+
cd alpaca_eval
|
150 |
+
pip install -e .
|
151 |
+
|
152 |
+
# MT-Bench
|
153 |
+
git clone https://github.com/lm-sys/FastChat.git
|
154 |
+
cd FastChat
|
155 |
+
pip install -e ".[model_worker,llm_judge]"
|
156 |
+
```
|
157 |
+
|
158 |
+
### Run evaluation
|
159 |
+
```bash
|
160 |
+
# lm-eval-harness
|
161 |
+
HF_MODEL=amd/AMD-OLMo-1B-SFT-DPO
|
162 |
+
accelerate launch -m lm_eval --model hf \
|
163 |
+
--model_args pretrained=$HF_MODEL,trust_remote_code=True \
|
164 |
+
--tasks arc_easy,arc_challenge,hellaswag,piqa,boolq,sciq,winogrande,openbookqa,mmlu,gsm8k_cot,bbh_cot_fewshot,toxigen,truthfulqa,crows_pairs \
|
165 |
+
--device cuda \
|
166 |
+
--batch_size 32 \
|
167 |
+
--output_path ./lm-eval-results/$HF_MODEL
|
168 |
+
```
|
169 |
+
|
170 |
+
## Training
|
171 |
+
|
172 |
+
### Setup
|
173 |
+
```bash
|
174 |
+
WORK_DIR="<path_to_your_working_directory>"
|
175 |
+
cd $WORK_DIR
|
176 |
+
# Clone OLMo codebase:
|
177 |
+
git clone https://github.com/allenai/OLMo.git --branch v0.3.0
|
178 |
+
cd OLMo
|
179 |
+
# Clone AMD-OLMo that contains files to reproduce our model training
|
180 |
+
git clone https://huggingface.co/amd/AMD-OLMo
|
181 |
+
|
182 |
+
docker pull rocm/pytorch:latest
|
183 |
+
docker run -it --network=host --device=/dev/kfd --device=/dev/dri --group-add=video --ipc=host --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --shm-size 8G -v $WORK_DIR/OLMo:/OLMo -w /OLMo rocm/pytorch:latest
|
184 |
+
|
185 |
+
# Remove Line 17 as the docker already has ROCm PyTorch installed
|
186 |
+
sed -i '17d' pyproject.toml
|
187 |
+
pip install -e .[all]
|
188 |
+
```
|
189 |
+
|
190 |
+
### Download and prepare pretraining datasets
|
191 |
+
```bash
|
192 |
+
# Download
|
193 |
+
DATA_DIR=./datasets/dolma
|
194 |
+
mkdir -p $DATA_DIR
|
195 |
+
|
196 |
+
PARALLEL_DOWNLOADS="<number_of_parallel_downloads>"
|
197 |
+
cat "AMD-OLMo/dolma_v1_7_subset.txt" | xargs -n 1 -P $PARALLEL_DOWNLOADS wget -q -P $DATA_DIR
|
198 |
+
|
199 |
+
# Prepare
|
200 |
+
NUM_WORKERS="<number_of_workers>"
|
201 |
+
python scripts/prepare_memmap_dataset.py $DATA_DIR/*.json.gz -o $DATA_DIR/memmap_dataset --workers $NUM_WORKERS
|
202 |
+
```
|
203 |
+
|
204 |
+
### Download and prepare SFT datasets
|
205 |
+
```bash
|
206 |
+
# 1st phase SFT dataset
|
207 |
+
python AMD-OLMo/prepare_sft_data.py --output_dir ./datasets/tulu --tokenizer tokenizers/allenai_eleuther-ai-gpt-neox-20b-pii-special.json --dataset tulu
|
208 |
+
|
209 |
+
# 2nd phase SFT dataset
|
210 |
+
python AMD-OLMo/prepare_sft_data.py --output_dir ./datasets/OpenHermes_WebInstructSub_CodeFeedBack --tokenizer tokenizers/allenai_eleuther-ai-gpt-neox-20b-pii-special.json --dataset 2nd-phase
|
211 |
+
```
|
212 |
+
|
213 |
+
### Run Training
|
214 |
+
Pretrainig config: [AMD-OLMo-1B.yaml](AMD-OLMo-1B.yaml)
|
215 |
+
|
216 |
+
SFT config: [AMD-OLMo-1B-SFT-1st-phase.yaml](AMD-OLMo-1B-SFT-1st-phase.yaml) and [AMD-OLMo-1B-SFT-2nd-phase.yaml](AMD-OLMo-1B-SFT-2nd-phase.yaml)
|
217 |
+
```bash
|
218 |
+
# Single node
|
219 |
+
HSA_FORCE_FINE_GRAIN_PCIE=1 OMP_NUM_THREADS=128 NCCL_DEBUG=INFO torchrun --nproc_per_node=8 ./scripts/train.py AMD-OLMo/AMD-OLMo-1B.yaml
|
220 |
+
|
221 |
+
# Multiple nodes
|
222 |
+
HSA_FORCE_FINE_GRAIN_PCIE=1 OMP_NUM_THREADS=128 NCCL_DEBUG=INFO torchrun --nnodes=$nnodes --node-rank=$node_rank --master_addr=$master_addr --master_port=$master_port --nproc_per_node=8 ./scripts/train.py AMD-OLMo/AMD-OLMo-1B.yaml
|
223 |
+
```
|
224 |
+
|
225 |
+
### Run DPO Training
|
226 |
+
|
227 |
+
DPO recipe: [AMD-OLMo-1B-dpo.yaml](AMD-OLMo-1B-dpo.yaml).
|
228 |
+
```bash
|
229 |
+
# install trl library
|
230 |
+
git clone https://github.com/huggingface/trl.git -b v0.8.6
|
231 |
+
|
232 |
+
# replace dpo_trainer.py
|
233 |
+
cp AMD-OLMo/dpo_trainer.py trl/trl/trainer
|
234 |
+
|
235 |
+
pip install -e ./trl
|
236 |
+
|
237 |
+
# install alignment-handbook
|
238 |
+
git clone https://github.com/huggingface/alignment-handbook.git hf-align
|
239 |
+
# 70769f9 is the main branch on 2024-04-11.
|
240 |
+
cd hf-align && git checkout 70769f9 && cd ..
|
241 |
+
|
242 |
+
pip install -e ./hf-align
|
243 |
+
|
244 |
+
# Copy AMD OLMo DPO recipe to hf-align/recipes.
|
245 |
+
cp AMD-OLMo/AMD-OLMo-1B-dpo.yaml hf-align/recipes/
|
246 |
+
|
247 |
+
# Prepare the converted AMD-OLMo SFT Huggingface model to ckpt_dir.
|
248 |
+
ckpt_dir=amd/AMD-OLMo-1B-SFT
|
249 |
+
local_tokenizer_dir=${ckpt_dir}
|
250 |
+
|
251 |
+
# Set output checkpoint dir.
|
252 |
+
dpo_ckpt_dir=<your_output_checkpoint_dir>
|
253 |
+
|
254 |
+
accelerate launch --config_file hf-align/recipes/accelerate_configs/deepspeed_zero3.yaml \
|
255 |
+
hf-align/scripts/run_dpo.py hf-align/recipes/AMD-OLMo-1B-dpo.yaml \
|
256 |
+
--trust_remote_code=true \
|
257 |
+
--model_name_or_path=${ckpt_dir} \
|
258 |
+
--tokenizer_name_or_path=${local_tokenizer_dir} \
|
259 |
+
--output_dir=${dpo_ckpt_dir} \
|
260 |
+
--num_train_epochs=1 \
|
261 |
+
--learning_rate=4e-6 \
|
262 |
+
--beta=0.3 \
|
263 |
+
--loss_type=sigmoid
|
264 |
+
```
|
265 |
+
|
266 |
+
## Bias, Risks, and Limitations
|
267 |
+
|
268 |
+
- The models are being released for research purposes only and are not intended for use cases that require high levels of factuality, safety critical situations, health or medical applications, generating false information, facilitating toxic conversations.
|
269 |
+
- Model checkpoints are made accessible without any safety guarantees. It is crucial for users to conduct comprehensive evaluations and implement safety filtering mechanisms as per their respective use cases.
|
270 |
+
- It may be possible to prompt the model to generate content that may be factually inaccurate, harmful, violent, toxic, biased, or otherwise objectionable. Such content may also get generated by prompts that did not intend to produce output as such. Users are thus requested to be aware of this and exercise caution and responsible thinking when using the model.
|
271 |
+
- Multi-lingual abilities of the models have not been tested and thus may misunderstand and generate erroneous responses across different languages.
|
272 |
+
|
273 |
+
## Appendix
|
274 |
+
### Evaluation Metrics
|
275 |
+
| **Benchmark** | Metric |
|
276 |
+
|---------------------:|:-----------------:|
|
277 |
+
| **arc_easy** | Normalized Accuracy |
|
278 |
+
| **arc_challenge** | Normalized Accuracy |
|
279 |
+
| **hellaswag** | Normalized Accuracy |
|
280 |
+
| **piqa** | Accuracy |
|
281 |
+
| **boolq** | Accuracy |
|
282 |
+
| **sciq** | Accuracy |
|
283 |
+
| **winogrande** | Accuracy |
|
284 |
+
| **openbookqa** | Normalized Accuracy |
|
285 |
+
| **mmlu** | Accuracy |
|
286 |
+
| **gsm8k (8-shot)** | Exact Match (Flexible Extract) |
|
287 |
+
| **bbh (3-shot)** | Exact Match |
|
288 |
+
| **ToxiGen** | Accuracy |
|
289 |
+
| **crows_pairs** | PCT Stereotype |
|
290 |
+
| **TruthfulQA-mc2** | Accuracy |
|
291 |
+
| **AlpacaEval 1 (Win Rate)** | Win Rate (chatgpt_fn) |
|
292 |
+
| **AlpacaEval 2 (LC Win Rate)** | Length Control Win Rate (weighted_alpaca_eval_gpt4_turbo) |
|
293 |
+
| **MTBench** | Average score for single-answer grading (2 turns) |
|
294 |
+
|
295 |
+
Feel free to cite our AMD-OLMo models:
|
296 |
+
```bash
|
297 |
+
@misc{AMD-OLMo,
|
298 |
+
title = {AMD-OLMo: A series of 1B language models trained from scratch by AMD on AMD Instinct™ MI250 GPUs.},
|
299 |
+
url = {https://huggingface.co/amd/AMD-OLMo},
|
300 |
+
author = {Jiang Liu, Jialian Wu, Prakamya Mishra, Zicheng Liu, Sudhanshu Ranjan, Pratik Prabhanjan Brahma, Yusheng Su, Gowtham Ramesh, Peng Sun, Zhe Li, Dong Li, Lu Tian, Emad Barsoum},
|
301 |
+
month = {October},
|
302 |
+
year = {2024}
|
303 |
+
}
|
304 |
+
```
|
305 |
+
|
306 |
+
#### License
|
307 |
+
Copyright (c) 2018-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
308 |
+
|
309 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
310 |
+
you may not use this file except in compliance with the License.
|
311 |
+
You may obtain a copy of the License at
|
312 |
+
|
313 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
314 |
+
|
315 |
+
Unless required by applicable law or agreed to in writing, software
|
316 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
317 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
318 |
+
See the License for the specific language governing permissions and
|
319 |
+
limitations under the License.
|