andrijdavid commited on
Commit
b152e25
1 Parent(s): 4b2d4cf

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +209 -0
README.md ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ ---
4
+ tags:
5
+ - GGUF
6
+ datasets:
7
+ - Yukang/LongAlpaca-16k-length
8
+ quantized_by: andrijdavid
9
+ ---
10
+ # Llama-3-8B-16K-GGUF
11
+ - Original model: [Llama-3-8B-16K](https://huggingface.co/mattshumer/Llama-3-8B-16K)
12
+
13
+ <!-- description start -->
14
+ ## Description
15
+
16
+ This repo contains GGUF format model files for [Llama-3-8B-16K](https://huggingface.co/mattshumer/Llama-3-8B-16K).
17
+
18
+ <!-- description end -->
19
+ <!-- README_GGUF.md-about-gguf start -->
20
+ ### About GGUF
21
+ 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.
22
+ Here is an incomplete list of clients and libraries that are known to support GGUF:
23
+ * [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.
24
+ * [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.
25
+ * [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​
26
+ * [KoboldCpp](https://github.com/LostRuins/koboldcpp), A comprehensive web UI offering GPU acceleration across all platforms and architectures, particularly renowned for storytelling.
27
+ * [GPT4All](https://gpt4all.io), This is a free and open source GUI that runs locally, supporting Windows, Linux, and macOS with full GPU acceleration.
28
+ * [LM Studio](https://lmstudio.ai/) An intuitive and powerful local GUI for Windows and macOS (Silicon), featuring GPU acceleration.
29
+ * [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.
30
+ * [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.
31
+ * [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.
32
+ * [candle](https://github.com/huggingface/candle), A Rust-based ML framework focusing on performance, including GPU support, and designed for ease of use.
33
+ * [ctransformers](https://github.com/marella/ctransformers), A Python library featuring GPU acceleration, LangChain support, and an OpenAI-compatible AI server.
34
+ * [localGPT](https://github.com/PromtEngineer/localGPT) An open-source initiative enabling private conversations with documents.
35
+ <!-- README_GGUF.md-about-gguf end -->
36
+
37
+ <!-- compatibility_gguf start -->
38
+ ## Explanation of quantisation methods
39
+ <details>
40
+ <summary>Click to see details</summary>
41
+ The new methods available are:
42
+
43
+ * 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)
44
+ * 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.
45
+ * 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.
46
+ * GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
47
+ * 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.
48
+ </details>
49
+ <!-- compatibility_gguf end -->
50
+
51
+ <!-- README_GGUF.md-how-to-download start -->
52
+ ## How to download GGUF files
53
+
54
+ **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.
55
+
56
+ The following clients/libraries will automatically download models for you, providing a list of available models to choose from:
57
+
58
+ * LM Studio
59
+ * LoLLMS Web UI
60
+ * Faraday.dev
61
+
62
+ ### In `text-generation-webui`
63
+
64
+ Under Download Model, you can enter the model repo: LiteLLMs/Llama-3-8B-16K-GGUF and below it, a specific filename to download, such as: Q4_0/Q4_0-00001-of-00009.gguf.
65
+
66
+ Then click Download.
67
+
68
+ ### On the command line, including multiple files at once
69
+
70
+ I recommend using the `huggingface-hub` Python library:
71
+
72
+ ```shell
73
+ pip3 install huggingface-hub
74
+ ```
75
+
76
+ Then you can download any individual model file to the current directory, at high speed, with a command like this:
77
+
78
+ ```shell
79
+ huggingface-cli download LiteLLMs/Llama-3-8B-16K-GGUF Q4_0/Q4_0-00001-of-00009.gguf --local-dir . --local-dir-use-symlinks False
80
+ ```
81
+
82
+ <details>
83
+ <summary>More advanced huggingface-cli download usage (click to read)</summary>
84
+
85
+ You can also download multiple files at once with a pattern:
86
+
87
+ ```shell
88
+ huggingface-cli download LiteLLMs/Llama-3-8B-16K-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
89
+ ```
90
+
91
+ 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).
92
+
93
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
94
+
95
+ ```shell
96
+ pip3 install huggingface_hub[hf_transfer]
97
+ ```
98
+
99
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
100
+
101
+ ```shell
102
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download LiteLLMs/Llama-3-8B-16K-GGUF Q4_0/Q4_0-00001-of-00009.gguf --local-dir . --local-dir-use-symlinks False
103
+ ```
104
+
105
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
106
+ </details>
107
+ <!-- README_GGUF.md-how-to-download end -->
108
+ <!-- README_GGUF.md-how-to-run start -->
109
+ ## Example `llama.cpp` command
110
+
111
+ Make sure you are using `llama.cpp` from commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
112
+
113
+ ```shell
114
+ ./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>"
115
+ ```
116
+
117
+ Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
118
+
119
+ 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.
120
+
121
+ If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
122
+
123
+ 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)
124
+
125
+ ## How to run in `text-generation-webui`
126
+
127
+ 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).
128
+
129
+ ## How to run from Python code
130
+
131
+ 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.
132
+
133
+ ### How to load this model in Python code, using llama-cpp-python
134
+
135
+ For full documentation, please see: [llama-cpp-python docs](https://abetlen.github.io/llama-cpp-python/).
136
+
137
+ #### First install the package
138
+
139
+ Run one of the following commands, according to your system:
140
+
141
+ ```shell
142
+ # Base ctransformers with no GPU acceleration
143
+ pip install llama-cpp-python
144
+ # With NVidia CUDA acceleration
145
+ CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
146
+ # Or with OpenBLAS acceleration
147
+ CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
148
+ # Or with CLBLast acceleration
149
+ CMAKE_ARGS="-DLLAMA_CLBLAST=on" pip install llama-cpp-python
150
+ # Or with AMD ROCm GPU acceleration (Linux only)
151
+ CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python
152
+ # Or with Metal GPU acceleration for macOS systems only
153
+ CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
154
+ # In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
155
+ $env:CMAKE_ARGS = "-DLLAMA_OPENBLAS=on"
156
+ pip install llama-cpp-python
157
+ ```
158
+
159
+ #### Simple llama-cpp-python example code
160
+
161
+ ```python
162
+ from llama_cpp import Llama
163
+ # Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
164
+ llm = Llama(
165
+ model_path="./Q4_0/Q4_0-00001-of-00009.gguf", # Download the model file first
166
+ n_ctx=32768, # The max sequence length to use - note that longer sequence lengths require much more resources
167
+ n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
168
+ n_gpu_layers=35 # The number of layers to offload to GPU, if you have GPU acceleration available
169
+ )
170
+ # Simple inference example
171
+ output = llm(
172
+ "<PROMPT>", # Prompt
173
+ max_tokens=512, # Generate up to 512 tokens
174
+ stop=["</s>"], # Example stop token - not necessarily correct for this specific model! Please check before using.
175
+ echo=True # Whether to echo the prompt
176
+ )
177
+ # Chat Completion API
178
+ 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
179
+ llm.create_chat_completion(
180
+ messages = [
181
+ {"role": "system", "content": "You are a story writing assistant."},
182
+ {
183
+ "role": "user",
184
+ "content": "Write a story about llamas."
185
+ }
186
+ ]
187
+ )
188
+ ```
189
+
190
+ ## How to use with LangChain
191
+
192
+ Here are guides on using llama-cpp-python and ctransformers with LangChain:
193
+
194
+ * [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp)
195
+ * [LangChain + ctransformers](https://python.langchain.com/docs/integrations/providers/ctransformers)
196
+
197
+ <!-- README_GGUF.md-how-to-run end -->
198
+
199
+ <!-- footer end -->
200
+
201
+ <!-- original-model-card start -->
202
+ # Original model card: Llama-3-8B-16K
203
+
204
+
205
+ This is an extended (16K) context version of LLaMA 3 8B (base, not instruct). Trained for five hours on 8x A6000 GPUs, using the `Yukang/LongAlpaca-16k-length` dataset.
206
+
207
+ `rope_theta` was set to `1000000.0`. Trained with Axolotl.
208
+
209
+ <!-- original-model-card end -->