andrijdavid commited on
Commit
17860c4
1 Parent(s): 01caaef

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +262 -0
README.md ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ ---
4
+ language:
5
+ - en
6
+ license: llama3
7
+ tags:
8
+ - meta
9
+ - llama-3
10
+ - GGUF
11
+ pipeline_tag: text-generation
12
+ quantized_by: andrijdavid
13
+ ---
14
+ # Llama-3-Giraffe-70B-GGUF
15
+ - Original model: [Llama-3-Giraffe-70B](https://huggingface.co/abacusai/Llama-3-Giraffe-70B)
16
+
17
+ <!-- description start -->
18
+ ## Description
19
+
20
+ This repo contains GGUF format model files for [Llama-3-Giraffe-70B](https://huggingface.co/abacusai/Llama-3-Giraffe-70B).
21
+
22
+ <!-- description end -->
23
+ <!-- README_GGUF.md-about-gguf start -->
24
+ ### About GGUF
25
+ 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.
26
+ Here is an incomplete list of clients and libraries that are known to support GGUF:
27
+ * [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.
28
+ * [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.
29
+ * [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​
30
+ * [KoboldCpp](https://github.com/LostRuins/koboldcpp), A comprehensive web UI offering GPU acceleration across all platforms and architectures, particularly renowned for storytelling.
31
+ * [GPT4All](https://gpt4all.io), This is a free and open source GUI that runs locally, supporting Windows, Linux, and macOS with full GPU acceleration.
32
+ * [LM Studio](https://lmstudio.ai/) An intuitive and powerful local GUI for Windows and macOS (Silicon), featuring GPU acceleration.
33
+ * [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.
34
+ * [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.
35
+ * [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.
36
+ * [candle](https://github.com/huggingface/candle), A Rust-based ML framework focusing on performance, including GPU support, and designed for ease of use.
37
+ * [ctransformers](https://github.com/marella/ctransformers), A Python library featuring GPU acceleration, LangChain support, and an OpenAI-compatible AI server.
38
+ * [localGPT](https://github.com/PromtEngineer/localGPT) An open-source initiative enabling private conversations with documents.
39
+ <!-- README_GGUF.md-about-gguf end -->
40
+
41
+ <!-- compatibility_gguf start -->
42
+ ## Explanation of quantisation methods
43
+ <details>
44
+ <summary>Click to see details</summary>
45
+ The new methods available are:
46
+
47
+ * 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)
48
+ * 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.
49
+ * 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.
50
+ * GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
51
+ * 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.
52
+ </details>
53
+ <!-- compatibility_gguf end -->
54
+
55
+ <!-- README_GGUF.md-how-to-download start -->
56
+ ## How to download GGUF files
57
+
58
+ **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.
59
+
60
+ The following clients/libraries will automatically download models for you, providing a list of available models to choose from:
61
+
62
+ * LM Studio
63
+ * LoLLMS Web UI
64
+ * Faraday.dev
65
+
66
+ ### In `text-generation-webui`
67
+
68
+ Under Download Model, you can enter the model repo: LiteLLMs/Llama-3-Giraffe-70B-GGUF and below it, a specific filename to download, such as: Q4_0/Q4_0-00001-of-00009.gguf.
69
+
70
+ Then click Download.
71
+
72
+ ### On the command line, including multiple files at once
73
+
74
+ I recommend using the `huggingface-hub` Python library:
75
+
76
+ ```shell
77
+ pip3 install huggingface-hub
78
+ ```
79
+
80
+ Then you can download any individual model file to the current directory, at high speed, with a command like this:
81
+
82
+ ```shell
83
+ huggingface-cli download LiteLLMs/Llama-3-Giraffe-70B-GGUF Q4_0/Q4_0-00001-of-00009.gguf --local-dir . --local-dir-use-symlinks False
84
+ ```
85
+
86
+ <details>
87
+ <summary>More advanced huggingface-cli download usage (click to read)</summary>
88
+
89
+ You can also download multiple files at once with a pattern:
90
+
91
+ ```shell
92
+ huggingface-cli download LiteLLMs/Llama-3-Giraffe-70B-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
93
+ ```
94
+
95
+ 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).
96
+
97
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
98
+
99
+ ```shell
100
+ pip3 install huggingface_hub[hf_transfer]
101
+ ```
102
+
103
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
104
+
105
+ ```shell
106
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download LiteLLMs/Llama-3-Giraffe-70B-GGUF Q4_0/Q4_0-00001-of-00009.gguf --local-dir . --local-dir-use-symlinks False
107
+ ```
108
+
109
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
110
+ </details>
111
+ <!-- README_GGUF.md-how-to-download end -->
112
+ <!-- README_GGUF.md-how-to-run start -->
113
+ ## Example `llama.cpp` command
114
+
115
+ Make sure you are using `llama.cpp` from commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
116
+
117
+ ```shell
118
+ ./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>"
119
+ ```
120
+
121
+ Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
122
+
123
+ 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.
124
+
125
+ If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
126
+
127
+ 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)
128
+
129
+ ## How to run in `text-generation-webui`
130
+
131
+ 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).
132
+
133
+ ## How to run from Python code
134
+
135
+ 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.
136
+
137
+ ### How to load this model in Python code, using llama-cpp-python
138
+
139
+ For full documentation, please see: [llama-cpp-python docs](https://abetlen.github.io/llama-cpp-python/).
140
+
141
+ #### First install the package
142
+
143
+ Run one of the following commands, according to your system:
144
+
145
+ ```shell
146
+ # Base ctransformers with no GPU acceleration
147
+ pip install llama-cpp-python
148
+ # With NVidia CUDA acceleration
149
+ CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
150
+ # Or with OpenBLAS acceleration
151
+ CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
152
+ # Or with CLBLast acceleration
153
+ CMAKE_ARGS="-DLLAMA_CLBLAST=on" pip install llama-cpp-python
154
+ # Or with AMD ROCm GPU acceleration (Linux only)
155
+ CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python
156
+ # Or with Metal GPU acceleration for macOS systems only
157
+ CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
158
+ # In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
159
+ $env:CMAKE_ARGS = "-DLLAMA_OPENBLAS=on"
160
+ pip install llama-cpp-python
161
+ ```
162
+
163
+ #### Simple llama-cpp-python example code
164
+
165
+ ```python
166
+ from llama_cpp import Llama
167
+ # Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
168
+ llm = Llama(
169
+ model_path="./Q4_0/Q4_0-00001-of-00009.gguf", # Download the model file first
170
+ n_ctx=32768, # The max sequence length to use - note that longer sequence lengths require much more resources
171
+ n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
172
+ n_gpu_layers=35 # The number of layers to offload to GPU, if you have GPU acceleration available
173
+ )
174
+ # Simple inference example
175
+ output = llm(
176
+ "<PROMPT>", # Prompt
177
+ max_tokens=512, # Generate up to 512 tokens
178
+ stop=["</s>"], # Example stop token - not necessarily correct for this specific model! Please check before using.
179
+ echo=True # Whether to echo the prompt
180
+ )
181
+ # Chat Completion API
182
+ 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
183
+ llm.create_chat_completion(
184
+ messages = [
185
+ {"role": "system", "content": "You are a story writing assistant."},
186
+ {
187
+ "role": "user",
188
+ "content": "Write a story about llamas."
189
+ }
190
+ ]
191
+ )
192
+ ```
193
+
194
+ ## How to use with LangChain
195
+
196
+ Here are guides on using llama-cpp-python and ctransformers with LangChain:
197
+
198
+ * [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp)
199
+ * [LangChain + ctransformers](https://python.langchain.com/docs/integrations/providers/ctransformers)
200
+
201
+ <!-- README_GGUF.md-how-to-run end -->
202
+
203
+ <!-- footer end -->
204
+
205
+ <!-- original-model-card start -->
206
+ # Original model card: Llama-3-Giraffe-70B
207
+
208
+
209
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/64c14f6b02e1f8f67c73bd05/pf4d6FA7DriRtVq5HCkxd.png)
210
+
211
+
212
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/64c14f6b02e1f8f67c73bd05/VcZWbW_eZkJAZZ5ricL4B.png)
213
+
214
+ # Llama-3-Giraffe-70B
215
+
216
+ Abacus.AI presents our longer-necked variant of Llama 3 70B!
217
+
218
+ This model has an effective context length of approximately 128k.
219
+
220
+ We have currently trained on ~1B tokens.
221
+ This is an initial release and we are hoping to improve the heatmap below further as we continue training.
222
+
223
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/64c14f6b02e1f8f67c73bd05/_NVEuQ2ZT-sBtDBNjgmbt.png)
224
+
225
+ ## Training Methodology
226
+
227
+ The methodology for training uses [PoSE](https://arxiv.org/abs/2309.10400) and dynamic-NTK interpolation.
228
+
229
+ ### NTK-scaling
230
+
231
+ The scale factor for NTK is 4. Note that we also tried theta-scaling but this did not work as well as NTK scaling in our experiments.
232
+
233
+ ### PoSE
234
+
235
+ We utilise Positional Skip-wise Training (PoSE) with the following parameters:
236
+
237
+ - **Number of Chunks**: 5
238
+ - **Max position ID**: 32768
239
+
240
+ ### Data
241
+
242
+ We use on average ~8K long samples from [RedPajama](https://github.com/togethercomputer/RedPajama-Data).
243
+
244
+ ### Hardware
245
+
246
+ We train on 8xH100 GPUs with Deepspeed Zero Stage 3.
247
+
248
+ ## Evaluation Methodology
249
+
250
+ We use the [EasyContext](https://github.com/abacusai/EasyContext/blob/eval_runs/eval_needle.py) implementation of Needle-in-a-Haystack to evaluate Llama-3-Giraffe-70B.
251
+
252
+ We evaluate with the following parameters:
253
+
254
+ - **Min context length**: 2000
255
+ - **Max context length**: 128000
256
+ - **Context interval**: 4000
257
+ - **Depth interval**: 0.1
258
+ - **Num samples**: 2
259
+ - **Rnd number digits**: 7
260
+ - **Haystack dir**: PaulGrahamEssays
261
+
262
+ <!-- original-model-card end -->