andrijdavid
commited on
Commit
•
2b0e8ee
1
Parent(s):
f90ef6f
Upload folder using huggingface_hub
Browse files
README.md
ADDED
@@ -0,0 +1,363 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
---
|
4 |
+
license: other
|
5 |
+
tags:
|
6 |
+
- GGUF
|
7 |
+
license_name: apple-sample-code-license
|
8 |
+
license_link: LICENSE
|
9 |
+
quantized_by: andrijdavid
|
10 |
+
---
|
11 |
+
# OpenELM-3B-Instruct-GGUF
|
12 |
+
- Original model: [OpenELM-3B-Instruct](https://huggingface.co/apple/OpenELM-3B-Instruct)
|
13 |
+
|
14 |
+
<!-- description start -->
|
15 |
+
## Description
|
16 |
+
|
17 |
+
This repo contains GGUF format model files for [OpenELM-3B-Instruct](https://huggingface.co/apple/OpenELM-3B-Instruct).
|
18 |
+
|
19 |
+
<!-- description end -->
|
20 |
+
<!-- README_GGUF.md-about-gguf start -->
|
21 |
+
### About GGUF
|
22 |
+
GGUF is a new format introduced by the llama.cpp team on August 21st 2023. It is a replacement for GGML, which is no longer supported by llama.cpp.
|
23 |
+
Here is an incomplete list of clients and libraries that are known to support GGUF:
|
24 |
+
* [llama.cpp](https://github.com/ggerganov/llama.cpp). This is the source project for GGUF, providing both a Command Line Interface (CLI) and a server option.
|
25 |
+
* [text-generation-webui](https://github.com/oobabooga/text-generation-webui), Known as the most widely used web UI, this project boasts numerous features and powerful extensions, and supports GPU acceleration.
|
26 |
+
* [Ollama](https://github.com/jmorganca/ollama) Ollama is a lightweight and extensible framework designed for building and running language models locally. It features a simple API for creating, managing, and executing models, along with a library of pre-built models for use in various applications
|
27 |
+
* [KoboldCpp](https://github.com/LostRuins/koboldcpp), A comprehensive web UI offering GPU acceleration across all platforms and architectures, particularly renowned for storytelling.
|
28 |
+
* [GPT4All](https://gpt4all.io), This is a free and open source GUI that runs locally, supporting Windows, Linux, and macOS with full GPU acceleration.
|
29 |
+
* [LM Studio](https://lmstudio.ai/) An intuitive and powerful local GUI for Windows and macOS (Silicon), featuring GPU acceleration.
|
30 |
+
* [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui). A notable web UI with a variety of unique features, including a comprehensive model library for easy model selection.
|
31 |
+
* [Faraday.dev](https://faraday.dev/), An attractive, user-friendly character-based chat GUI for Windows and macOS (both Silicon and Intel), also offering GPU acceleration.
|
32 |
+
* [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), A Python library equipped with GPU acceleration, LangChain support, and an OpenAI-compatible API server.
|
33 |
+
* [candle](https://github.com/huggingface/candle), A Rust-based ML framework focusing on performance, including GPU support, and designed for ease of use.
|
34 |
+
* [ctransformers](https://github.com/marella/ctransformers), A Python library featuring GPU acceleration, LangChain support, and an OpenAI-compatible AI server.
|
35 |
+
* [localGPT](https://github.com/PromtEngineer/localGPT) An open-source initiative enabling private conversations with documents.
|
36 |
+
<!-- README_GGUF.md-about-gguf end -->
|
37 |
+
|
38 |
+
<!-- compatibility_gguf start -->
|
39 |
+
## Explanation of quantisation methods
|
40 |
+
<details>
|
41 |
+
<summary>Click to see details</summary>
|
42 |
+
The new methods available are:
|
43 |
+
|
44 |
+
* GGML_TYPE_Q2_K - "type-1" 2-bit quantization in super-blocks containing 16 blocks, each block having 16 weight. Block scales and mins are quantized with 4 bits. This ends up effectively using 2.5625 bits per weight (bpw)
|
45 |
+
* GGML_TYPE_Q3_K - "type-0" 3-bit quantization in super-blocks containing 16 blocks, each block having 16 weights. Scales are quantized with 6 bits. This end up using 3.4375 bpw.
|
46 |
+
* GGML_TYPE_Q4_K - "type-1" 4-bit quantization in super-blocks containing 8 blocks, each block having 32 weights. Scales and mins are quantized with 6 bits. This ends up using 4.5 bpw.
|
47 |
+
* GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
|
48 |
+
* GGML_TYPE_Q6_K - "type-0" 6-bit quantization. Super-blocks with 16 blocks, each block having 16 weights. Scales are quantized with 8 bits. This ends up using 6.5625 bpw.
|
49 |
+
</details>
|
50 |
+
<!-- compatibility_gguf end -->
|
51 |
+
|
52 |
+
<!-- README_GGUF.md-how-to-download start -->
|
53 |
+
## How to download GGUF files
|
54 |
+
|
55 |
+
**Note for manual downloaders:** You almost never want to clone the entire repo! Multiple different quantisation formats are provided, and most users only want to pick and download a single folder.
|
56 |
+
|
57 |
+
The following clients/libraries will automatically download models for you, providing a list of available models to choose from:
|
58 |
+
|
59 |
+
* LM Studio
|
60 |
+
* LoLLMS Web UI
|
61 |
+
* Faraday.dev
|
62 |
+
|
63 |
+
### In `text-generation-webui`
|
64 |
+
|
65 |
+
Under Download Model, you can enter the model repo: LiteLLMs/OpenELM-3B-Instruct-GGUF and below it, a specific filename to download, such as: Q4_0/Q4_0-00001-of-00009.gguf.
|
66 |
+
|
67 |
+
Then click Download.
|
68 |
+
|
69 |
+
### On the command line, including multiple files at once
|
70 |
+
|
71 |
+
I recommend using the `huggingface-hub` Python library:
|
72 |
+
|
73 |
+
```shell
|
74 |
+
pip3 install huggingface-hub
|
75 |
+
```
|
76 |
+
|
77 |
+
Then you can download any individual model file to the current directory, at high speed, with a command like this:
|
78 |
+
|
79 |
+
```shell
|
80 |
+
huggingface-cli download LiteLLMs/OpenELM-3B-Instruct-GGUF Q4_0/Q4_0-00001-of-00009.gguf --local-dir . --local-dir-use-symlinks False
|
81 |
+
```
|
82 |
+
|
83 |
+
<details>
|
84 |
+
<summary>More advanced huggingface-cli download usage (click to read)</summary>
|
85 |
+
|
86 |
+
You can also download multiple files at once with a pattern:
|
87 |
+
|
88 |
+
```shell
|
89 |
+
huggingface-cli download LiteLLMs/OpenELM-3B-Instruct-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
|
90 |
+
```
|
91 |
+
|
92 |
+
For more documentation on downloading with `huggingface-cli`, please see: [HF -> Hub Python Library -> Download files -> Download from the CLI](https://huggingface.co/docs/huggingface_hub/guides/download#download-from-the-cli).
|
93 |
+
|
94 |
+
To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
|
95 |
+
|
96 |
+
```shell
|
97 |
+
pip3 install huggingface_hub[hf_transfer]
|
98 |
+
```
|
99 |
+
|
100 |
+
And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
|
101 |
+
|
102 |
+
```shell
|
103 |
+
HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download LiteLLMs/OpenELM-3B-Instruct-GGUF Q4_0/Q4_0-00001-of-00009.gguf --local-dir . --local-dir-use-symlinks False
|
104 |
+
```
|
105 |
+
|
106 |
+
Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
|
107 |
+
</details>
|
108 |
+
<!-- README_GGUF.md-how-to-download end -->
|
109 |
+
<!-- README_GGUF.md-how-to-run start -->
|
110 |
+
## Example `llama.cpp` command
|
111 |
+
|
112 |
+
Make sure you are using `llama.cpp` from commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
|
113 |
+
|
114 |
+
```shell
|
115 |
+
./main -ngl 35 -m Q4_0/Q4_0-00001-of-00009.gguf --color -c 8192 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "<PROMPT>"
|
116 |
+
```
|
117 |
+
|
118 |
+
Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
|
119 |
+
|
120 |
+
Change `-c 8192` to the desired sequence length. For extended sequence models - eg 8K, 16K, 32K - the necessary RoPE scaling parameters are read from the GGUF file and set by llama.cpp automatically. Note that longer sequence lengths require much more resources, so you may need to reduce this value.
|
121 |
+
|
122 |
+
If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
|
123 |
+
|
124 |
+
For other parameters and how to use them, please refer to [the llama.cpp documentation](https://github.com/ggerganov/llama.cpp/blob/master/examples/main/README.md)
|
125 |
+
|
126 |
+
## How to run in `text-generation-webui`
|
127 |
+
|
128 |
+
Further instructions can be found in the text-generation-webui documentation, here: [text-generation-webui/docs/04 ‐ Model Tab.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/04%20%E2%80%90%20Model%20Tab.md#llamacpp).
|
129 |
+
|
130 |
+
## How to run from Python code
|
131 |
+
|
132 |
+
You can use GGUF models from Python using the [llama-cpp-python](https://github.com/abetlen/llama-cpp-python) or [ctransformers](https://github.com/marella/ctransformers) libraries. Note that at the time of writing (Nov 27th 2023), ctransformers has not been updated for some time and is not compatible with some recent models. Therefore I recommend you use llama-cpp-python.
|
133 |
+
|
134 |
+
### How to load this model in Python code, using llama-cpp-python
|
135 |
+
|
136 |
+
For full documentation, please see: [llama-cpp-python docs](https://abetlen.github.io/llama-cpp-python/).
|
137 |
+
|
138 |
+
#### First install the package
|
139 |
+
|
140 |
+
Run one of the following commands, according to your system:
|
141 |
+
|
142 |
+
```shell
|
143 |
+
# Base ctransformers with no GPU acceleration
|
144 |
+
pip install llama-cpp-python
|
145 |
+
# With NVidia CUDA acceleration
|
146 |
+
CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
|
147 |
+
# Or with OpenBLAS acceleration
|
148 |
+
CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
|
149 |
+
# Or with CLBLast acceleration
|
150 |
+
CMAKE_ARGS="-DLLAMA_CLBLAST=on" pip install llama-cpp-python
|
151 |
+
# Or with AMD ROCm GPU acceleration (Linux only)
|
152 |
+
CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python
|
153 |
+
# Or with Metal GPU acceleration for macOS systems only
|
154 |
+
CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
|
155 |
+
# In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
|
156 |
+
$env:CMAKE_ARGS = "-DLLAMA_OPENBLAS=on"
|
157 |
+
pip install llama-cpp-python
|
158 |
+
```
|
159 |
+
|
160 |
+
#### Simple llama-cpp-python example code
|
161 |
+
|
162 |
+
```python
|
163 |
+
from llama_cpp import Llama
|
164 |
+
# Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
|
165 |
+
llm = Llama(
|
166 |
+
model_path="./Q4_0/Q4_0-00001-of-00009.gguf", # Download the model file first
|
167 |
+
n_ctx=32768, # The max sequence length to use - note that longer sequence lengths require much more resources
|
168 |
+
n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
|
169 |
+
n_gpu_layers=35 # The number of layers to offload to GPU, if you have GPU acceleration available
|
170 |
+
)
|
171 |
+
# Simple inference example
|
172 |
+
output = llm(
|
173 |
+
"<PROMPT>", # Prompt
|
174 |
+
max_tokens=512, # Generate up to 512 tokens
|
175 |
+
stop=["</s>"], # Example stop token - not necessarily correct for this specific model! Please check before using.
|
176 |
+
echo=True # Whether to echo the prompt
|
177 |
+
)
|
178 |
+
# Chat Completion API
|
179 |
+
llm = Llama(model_path="./Q4_0/Q4_0-00001-of-00009.gguf", chat_format="llama-2") # Set chat_format according to the model you are using
|
180 |
+
llm.create_chat_completion(
|
181 |
+
messages = [
|
182 |
+
{"role": "system", "content": "You are a story writing assistant."},
|
183 |
+
{
|
184 |
+
"role": "user",
|
185 |
+
"content": "Write a story about llamas."
|
186 |
+
}
|
187 |
+
]
|
188 |
+
)
|
189 |
+
```
|
190 |
+
|
191 |
+
## How to use with LangChain
|
192 |
+
|
193 |
+
Here are guides on using llama-cpp-python and ctransformers with LangChain:
|
194 |
+
|
195 |
+
* [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp)
|
196 |
+
* [LangChain + ctransformers](https://python.langchain.com/docs/integrations/providers/ctransformers)
|
197 |
+
|
198 |
+
<!-- README_GGUF.md-how-to-run end -->
|
199 |
+
|
200 |
+
<!-- footer end -->
|
201 |
+
|
202 |
+
<!-- original-model-card start -->
|
203 |
+
# Original model card: OpenELM-3B-Instruct
|
204 |
+
|
205 |
+
|
206 |
+
# OpenELM
|
207 |
+
|
208 |
+
*Sachin Mehta, Mohammad Hossein Sekhavat, Qingqing Cao, Maxwell Horton, Yanzi Jin, Chenfan Sun, Iman Mirzadeh, Mahyar Najibi, Dmitry Belenko, Peter Zatloukal, Mohammad Rastegari*
|
209 |
+
|
210 |
+
We introduce **OpenELM**, a family of **Open**-source **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.
|
211 |
+
|
212 |
+
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.
|
213 |
+
|
214 |
+
|
215 |
+
|
216 |
+
## Usage
|
217 |
+
|
218 |
+
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`.
|
219 |
+
|
220 |
+
You can try the model by running the following command:
|
221 |
+
```
|
222 |
+
python generate_openelm.py --model apple/OpenELM-3B-Instruct --hf_access_token [HF_ACCESS_TOKEN] --prompt 'Once upon a time there was' --generate_kwargs repetition_penalty=1.2
|
223 |
+
```
|
224 |
+
Please refer to [this link](https://huggingface.co/docs/hub/security-tokens) to obtain your hugging face access token.
|
225 |
+
|
226 |
+
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:
|
227 |
+
```
|
228 |
+
python generate_openelm.py --model apple/OpenELM-3B-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
|
229 |
+
```
|
230 |
+
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:
|
231 |
+
```
|
232 |
+
python generate_openelm.py --model apple/OpenELM-3B-Instruct --hf_access_token [HF_ACCESS_TOKEN] --prompt 'Once upon a time there was' --generate_kwargs repetition_penalty=1.2 --assistant_model [SMALLER_MODEL]
|
233 |
+
```
|
234 |
+
|
235 |
+
## Main Results
|
236 |
+
|
237 |
+
### Zero-Shot
|
238 |
+
|
239 |
+
| **Model Size** | **ARC-c** | **ARC-e** | **BoolQ** | **HellaSwag** | **PIQA** | **SciQ** | **WinoGrande** | **Average** |
|
240 |
+
| | | - | | -- | | | -- | -- | | | - | | -- |
|
241 |
+
| [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 |
|
242 |
+
| [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** |
|
243 |
+
| [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 |
|
244 |
+
| [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** |
|
245 |
+
| [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 |
|
246 |
+
| [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** |
|
247 |
+
| [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 |
|
248 |
+
| [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** |
|
249 |
+
|
250 |
+
See the technical report for more results and comparison.
|
251 |
+
|
252 |
+
## Evaluation
|
253 |
+
|
254 |
+
### Setup
|
255 |
+
|
256 |
+
Install the following dependencies:
|
257 |
+
|
258 |
+
```bash
|
259 |
+
|
260 |
+
# install public lm-eval-harness
|
261 |
+
|
262 |
+
harness_repo="public-lm-eval-harness"
|
263 |
+
git clone https://github.com/EleutherAI/lm-evaluation-harness ${harness_repo}
|
264 |
+
cd ${harness_repo}
|
265 |
+
# use main branch on 03-15-2024, SHA is dc90fec
|
266 |
+
git checkout dc90fec
|
267 |
+
pip install -e .
|
268 |
+
cd ..
|
269 |
+
|
270 |
+
# 66d6242 is the main branch on 2024-04-01
|
271 |
+
pip install datasets@git+https://github.com/huggingface/datasets.git@66d6242
|
272 |
+
pip install tokenizers>=0.15.2 transformers>=4.38.2 sentencepiece>=0.2.0
|
273 |
+
|
274 |
+
```
|
275 |
+
|
276 |
+
### Evaluate OpenELM
|
277 |
+
|
278 |
+
```bash
|
279 |
+
|
280 |
+
# OpenELM-3B-Instruct
|
281 |
+
hf_model=OpenELM-3B-Instruct
|
282 |
+
|
283 |
+
# 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
|
284 |
+
tokenizer=meta-llama/Llama-2-7b-hf
|
285 |
+
add_bos_token=True
|
286 |
+
batch_size=1
|
287 |
+
|
288 |
+
mkdir lm_eval_output
|
289 |
+
|
290 |
+
shot=0
|
291 |
+
task=arc_challenge,arc_easy,boolq,hellaswag,piqa,race,winogrande,sciq,truthfulqa_mc2
|
292 |
+
lm_eval --model hf \
|
293 |
+
--model_args pretrained=${hf_model},trust_remote_code=True,add_bos_token=${add_bos_token},tokenizer=${tokenizer} \
|
294 |
+
--tasks ${task} \
|
295 |
+
--device cuda:0 \
|
296 |
+
--num_fewshot ${shot} \
|
297 |
+
--output_path ./lm_eval_output/${hf_model//\//_}_${task//,/_}-${shot}shot \
|
298 |
+
--batch_size ${batch_size} 2>&1 | tee ./lm_eval_output/eval-${hf_model//\//_}_${task//,/_}-${shot}shot.log
|
299 |
+
|
300 |
+
shot=5
|
301 |
+
task=mmlu,winogrande
|
302 |
+
lm_eval --model hf \
|
303 |
+
--model_args pretrained=${hf_model},trust_remote_code=True,add_bos_token=${add_bos_token},tokenizer=${tokenizer} \
|
304 |
+
--tasks ${task} \
|
305 |
+
--device cuda:0 \
|
306 |
+
--num_fewshot ${shot} \
|
307 |
+
--output_path ./lm_eval_output/${hf_model//\//_}_${task//,/_}-${shot}shot \
|
308 |
+
--batch_size ${batch_size} 2>&1 | tee ./lm_eval_output/eval-${hf_model//\//_}_${task//,/_}-${shot}shot.log
|
309 |
+
|
310 |
+
shot=25
|
311 |
+
task=arc_challenge,crows_pairs_english
|
312 |
+
lm_eval --model hf \
|
313 |
+
--model_args pretrained=${hf_model},trust_remote_code=True,add_bos_token=${add_bos_token},tokenizer=${tokenizer} \
|
314 |
+
--tasks ${task} \
|
315 |
+
--device cuda:0 \
|
316 |
+
--num_fewshot ${shot} \
|
317 |
+
--output_path ./lm_eval_output/${hf_model//\//_}_${task//,/_}-${shot}shot \
|
318 |
+
--batch_size ${batch_size} 2>&1 | tee ./lm_eval_output/eval-${hf_model//\//_}_${task//,/_}-${shot}shot.log
|
319 |
+
|
320 |
+
shot=10
|
321 |
+
task=hellaswag
|
322 |
+
lm_eval --model hf \
|
323 |
+
--model_args pretrained=${hf_model},trust_remote_code=True,add_bos_token=${add_bos_token},tokenizer=${tokenizer} \
|
324 |
+
--tasks ${task} \
|
325 |
+
--device cuda:0 \
|
326 |
+
--num_fewshot ${shot} \
|
327 |
+
--output_path ./lm_eval_output/${hf_model//\//_}_${task//,/_}-${shot}shot \
|
328 |
+
--batch_size ${batch_size} 2>&1 | tee ./lm_eval_output/eval-${hf_model//\//_}_${task//,/_}-${shot}shot.log
|
329 |
+
|
330 |
+
```
|
331 |
+
|
332 |
+
|
333 |
+
## Bias, Risks, and Limitations
|
334 |
+
|
335 |
+
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.
|
336 |
+
|
337 |
+
## Citation
|
338 |
+
|
339 |
+
If you find our work useful, please cite:
|
340 |
+
|
341 |
+
```BibTex
|
342 |
+
@article{mehtaOpenELMEfficientLanguage2024,
|
343 |
+
title = {{OpenELM}: {An} {Efficient} {Language} {Model} {Family} with {Open}-source {Training} and {Inference} {Framework}},
|
344 |
+
shorttitle = {{OpenELM}},
|
345 |
+
url = {https://arxiv.org/abs/2404.14619v1},
|
346 |
+
language = {en},
|
347 |
+
urldate = {2024-04-24},
|
348 |
+
journal = {arXiv.org},
|
349 |
+
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},
|
350 |
+
month = apr,
|
351 |
+
year = {2024},
|
352 |
+
}
|
353 |
+
|
354 |
+
@inproceedings{mehta2022cvnets,
|
355 |
+
author = {Mehta, Sachin and Abdolhosseini, Farzad and Rastegari, Mohammad},
|
356 |
+
title = {CVNets: High Performance Library for Computer Vision},
|
357 |
+
year = {2022},
|
358 |
+
booktitle = {Proceedings of the 30th ACM International Conference on Multimedia},
|
359 |
+
series = {MM '22}
|
360 |
+
}
|
361 |
+
```
|
362 |
+
|
363 |
+
<!-- original-model-card end -->
|