ChristianAzinn commited on
Commit
ab038c8
1 Parent(s): f3634a7

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +221 -0
README.md ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: mistral-community/Mixtral-8x22B-v0.1
3
+ inference: false
4
+ language:
5
+ - en
6
+ license: apache-2.0
7
+ model_creator: MODELCREATOR
8
+ model_name: MODELNAMEU
9
+ model_type: TODO
10
+ quantized_by: ChristianAzinn
11
+ library_name: transformers
12
+ pipeline_tag: text-generation
13
+ tags:
14
+ - quantized
15
+ - 2-bit
16
+ - 3-bit
17
+ - 4-bit
18
+ - 5-bit
19
+ - 6-bit
20
+ - 8-bit
21
+ - 16-bit
22
+ - GGUF
23
+ - mixtral
24
+ - moe
25
+ ---
26
+
27
+ # mixtral-8x22b-v0.1-imatrix
28
+
29
+ Model creator: [Mistral AI](https://huggingface.co/mistralai)
30
+
31
+ Original model: [Mixtral-8x22B-v0.1](https://huggingface.co/mistral-community/Mixtral-8x22B-v0.1).
32
+
33
+ ## Original Description
34
+
35
+ None so far, but check back when Mistral releases the model officially on HF Hub.
36
+
37
+ ## Description
38
+
39
+ This repo contains GGUF format files for the Mixtral-8x22B-v0.1 text generation model.
40
+
41
+ These files were converted and quantized with [llama.cpp](https://github.com/ggerganov/llama.cpp) on a consumer RTX 4090.
42
+
43
+ This model supports a 65536 context window.
44
+
45
+ ### Quantizer's Notes
46
+
47
+ Be warned that this model is ENORMOUS and will not run on most consumer hardware! Consider using an I quant (IQ2_XXS, IQ2_XS, IQ3_XS) for better performance per bit.
48
+
49
+ This repo also contains files uniquely quantized using an **importance matrix**, which increases response quality at little cost otherwise, supported by llama.cpp as of [PR #4861](https://github.com/ggerganov/llama.cpp/pull/4861) and supported for K-quants as of [PR #4930](https://github.com/ggerganov/llama.cpp/pull/4930). The imatrix does nothing to Q8_0, fp16, or fp32, so use another repository for those quantizations.
50
+
51
+ The files are split in a weird way because `llama.cpp/gguf-split` bugs out with extra-large models like Mixtral 8x22B. This may be fixed later.
52
+
53
+ Speaking of which, these files are split because HuggingFace limits file size to 50GB. You may need to merge them using llama.cpp's [`gguf-split`](https://github.com/ggerganov/llama.cpp/pull/6135) merge functionality, but both llama.cpp and LM Studio (as of latest release) support loading directly from model shards.
54
+
55
+ The "Original Model" link above links to a repository of HF Transformers-compatible safetensors on the Hub, but the files in this repository (the one whose README you are reading) were quantized directly from a local conversion of the original torrent.
56
+
57
+ ## Compatibility
58
+
59
+ These files are compatible with [llama.cpp](https://github.com/ggerganov/llama.cpp), [LM Studio](https://lmstudio.ai/), [Ollama](https://ollama.com/), and any other service built on top of llama.cpp.
60
+
61
+ # Meta-information
62
+
63
+ ## Provided Files
64
+ There's no good way for me to make a Provided Files section since each is sharded. However, I provide the following quantizations: IQ2_XXS, IQ2_XS, Q2_K, IQ3_XXS, Q3_K_S, Q3_K_M, Q3_K_L, Q4_K_S, Q4_K_M, Q5_K_S, Q5_K_M, Q6_K.
65
+
66
+ # Examples
67
+ ## How to download GGUF files
68
+
69
+ **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 file.
70
+
71
+ The following clients/libraries will automatically download models for you, providing a list of available models to choose from:
72
+
73
+ * LM Studio
74
+ * LoLLMS Web UI
75
+ * Faraday.dev
76
+
77
+ ### In `text-generation-webui`
78
+
79
+ Under Download Model, you can enter the model repo: ChristianAzinn/mixtral-8x22b-v0.1-imatrix and below it, a specific filename to download, such as: mixtral-8x22b-v0.1-imatrix.Q4_K_M.gguf.
80
+
81
+ Then click Download.
82
+
83
+ ### On the command line, including multiple files at once
84
+
85
+ I recommend using the `huggingface-hub` Python library:
86
+
87
+ ```shell
88
+ pip3 install huggingface-hub
89
+ ```
90
+
91
+ Then you can download any individual model file to the current directory, at high speed, with a command like this:
92
+
93
+ ```shell
94
+ huggingface-cli download ChristianAzinn/mixtral-8x22b-v0.1-imatrix mixtral-8x22b-v0.1-imatrix.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
95
+ ```
96
+
97
+ <details>
98
+ <summary>More advanced huggingface-cli download usage (click to read)</summary>
99
+
100
+ You can also download multiple files at once with a pattern:
101
+
102
+ ```shell
103
+ huggingface-cli download ChristianAzinn/mixtral-8x22b-v0.1-imatrix --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
104
+ ```
105
+
106
+ 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).
107
+
108
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
109
+
110
+ ```shell
111
+ pip3 install hf_transfer
112
+ ```
113
+
114
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
115
+
116
+ ```shell
117
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download ChristianAzinn/mixtral-8x22b-v0.1-imatrix mixtral-8x22b-v0.1-imatrix.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
118
+ ```
119
+
120
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
121
+ </details>
122
+ <!-- README_GGUF.md-how-to-download end -->
123
+ <!-- README_GGUF.md-how-to-run start -->
124
+ ## Example `llama.cpp` command
125
+
126
+ Make sure you are using `llama.cpp` from commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
127
+
128
+ ```shell
129
+ ./main -ngl 35 -m mixtral-8x22b-v0.1-imatrix.Q4_K_M.gguf --color -c 32768 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "<s>[INST] {prompt} [/INST]"
130
+ ```
131
+
132
+ Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
133
+
134
+ Change `-c 32768` 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.
135
+
136
+ If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
137
+
138
+ 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)
139
+
140
+ ## How to run in `text-generation-webui`
141
+
142
+ 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).
143
+
144
+ ## How to run from Python code
145
+
146
+ 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.
147
+
148
+ ### How to load this model in Python code, using llama-cpp-python
149
+
150
+ For full documentation, please see: [llama-cpp-python docs](https://abetlen.github.io/llama-cpp-python/).
151
+
152
+ #### First install the package
153
+
154
+ Run one of the following commands, according to your system:
155
+
156
+ ```shell
157
+ # Base ctransformers with no GPU acceleration
158
+ pip install llama-cpp-python
159
+ # With NVidia CUDA acceleration
160
+ CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
161
+ # Or with OpenBLAS acceleration
162
+ CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
163
+ # Or with CLBLast acceleration
164
+ CMAKE_ARGS="-DLLAMA_CLBLAST=on" pip install llama-cpp-python
165
+ # Or with AMD ROCm GPU acceleration (Linux only)
166
+ CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python
167
+ # Or with Metal GPU acceleration for macOS systems only
168
+ CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
169
+ # In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
170
+ $env:CMAKE_ARGS = "-DLLAMA_OPENBLAS=on"
171
+ pip install llama-cpp-python
172
+ ```
173
+
174
+ #### Simple llama-cpp-python example code
175
+
176
+ ```python
177
+ from llama_cpp import Llama
178
+ # Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
179
+ llm = Llama(
180
+ model_path="./mistral-7b-instruct-v0.2.Q4_K_M.gguf", # Download the model file first
181
+ n_ctx=32768, # The max sequence length to use - note that longer sequence lengths require much more resources
182
+ n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
183
+ n_gpu_layers=35 # The number of layers to offload to GPU, if you have GPU acceleration available
184
+ )
185
+ # Simple inference example
186
+ output = llm(
187
+ "<s>[INST] {prompt} [/INST]", # Prompt
188
+ max_tokens=512, # Generate up to 512 tokens
189
+ stop=["</s>"], # Example stop token - not necessarily correct for this specific model! Please check before using.
190
+ echo=True # Whether to echo the prompt
191
+ )
192
+ # Chat Completion API
193
+ llm = Llama(model_path="./mistral-7b-instruct-v0.2.Q4_K_M.gguf", chat_format="llama-2") # Set chat_format according to the model you are using
194
+ llm.create_chat_completion(
195
+ messages = [
196
+ {"role": "system", "content": "You are a story writing assistant."},
197
+ {
198
+ "role": "user",
199
+ "content": "Write a story about llamas."
200
+ }
201
+ ]
202
+ )
203
+ ```
204
+
205
+ ## How to use with LangChain
206
+
207
+ Here are guides on using llama-cpp-python and ctransformers with LangChain:
208
+
209
+ * [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp)
210
+ * [LangChain + ctransformers](https://python.langchain.com/docs/integrations/providers/ctransformers)
211
+
212
+ ## How to use with LM Studio
213
+
214
+ Here are guides on using [LM Studio](https://lmstudio.ai/) to serve this model. The chat UI is very intuitive to get up and running, but don't be afraid to ask in the Discord if you have any trouble. LM Studio also supports [serving with the OpenAI API format](https://lmstudio.ai/docs/local-server), running multiple models at once, and serving [embedding models](https://huggingface.co/collections/ChristianAzinn/embedding-ggufs-6615e9f216917dfdc6773fa3).
215
+
216
+ * [LM Studio Documentation](https://lmstudio.ai/docs/welcome)
217
+ * [LM Studio Discord](https://discord.gg/aPQfnNkxGC)
218
+
219
+ ## Acknowledgements
220
+
221
+ This README is inspired by those of the legendary [TheBloke](https://huggingface.co/TheBloke). They say imitation is the sincerest form of flattery, and I've elected to reuse his "Examples" section because he did it very well and I see no reason to reinvent the wheel.