waadarsh commited on
Commit
4c92df1
·
verified ·
1 Parent(s): baf3c56

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +212 -0
README.md ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: waadarsh/mistral_7b_magnite_finetuned
3
+ inference: false
4
+ license: apache-2.0
5
+ model_creator: Mistral AI
6
+ model_name: mistral_7b_magnite_finetuned
7
+ model_type: mistral
8
+ pipeline_tag: text-generation
9
+ prompt_template: '<s>[INST]{prompt} [/INST]
10
+
11
+ '
12
+ quantized_by: waadarsh
13
+ tags:
14
+ - finetuned
15
+ ---
16
+
17
+ # Mistral 7B Magnite Finetuned - GGUF
18
+ - Model creator: [Aadarsh Unni Wilson](https://huggingface.co/waadarsh)
19
+ - Original model: [Mistral 7B Magnite Finetuned](https://huggingface.co/waadarsh/mistral_7b_magnite_finetuned)
20
+
21
+ <!-- description start -->
22
+ ## Description
23
+
24
+ This repo contains GGUF format model files for [Mistral 7B Magnite Finetuned](https://huggingface.co/waadarsh/mistral_7b_magnite_finetuned).
25
+
26
+ <!-- description end -->
27
+ <!-- README_GGUF.md-about-gguf start -->
28
+ ### About GGUF
29
+
30
+ 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.
31
+
32
+ Here is an incomplate list of clients and libraries that are known to support GGUF:
33
+
34
+ * [llama.cpp](https://github.com/ggerganov/llama.cpp). The source project for GGUF. Offers a CLI and a server option.
35
+ * [text-generation-webui](https://github.com/oobabooga/text-generation-webui), the most widely used web UI, with many features and powerful extensions. Supports GPU acceleration.
36
+ * [KoboldCpp](https://github.com/LostRuins/koboldcpp), a fully featured web UI, with GPU accel across all platforms and GPU architectures. Especially good for story telling.
37
+ * [LM Studio](https://lmstudio.ai/), an easy-to-use and powerful local GUI for Windows and macOS (Silicon), with GPU acceleration.
38
+ * [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui), a great web UI with many interesting and unique features, including a full model library for easy model selection.
39
+ * [Faraday.dev](https://faraday.dev/), an attractive and easy to use character-based chat GUI for Windows and macOS (both Silicon and Intel), with GPU acceleration.
40
+ * [ctransformers](https://github.com/marella/ctransformers), a Python library with GPU accel, LangChain support, and OpenAI-compatible AI server.
41
+ * [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), a Python library with GPU accel, LangChain support, and OpenAI-compatible API server.
42
+ * [candle](https://github.com/huggingface/candle), a Rust ML framework with a focus on performance, including GPU support, and ease of use.
43
+
44
+ <!-- README_GGUF.md-about-gguf end -->
45
+
46
+ ## Prompt template: Mistral
47
+
48
+ ```
49
+ <s>[INST] {prompt} [/INST]
50
+ ```
51
+
52
+ <!-- prompt-template end -->
53
+
54
+
55
+ <!-- compatibility_gguf start -->
56
+ ## Compatibility
57
+
58
+ These quantised GGUFv2 files are compatible with llama.cpp from August 27th onwards, as of commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221)
59
+
60
+ They are also compatible with many third party UIs and libraries - please see the list at the top of this README.
61
+
62
+ Sequence length note: The model will work at sequence lengths of 4096, or lower. GGUF does not yet have support for the new sliding window sequence length mode, so longer sequence lengths are not supported.
63
+
64
+ ## Explanation of quantisation methods
65
+ <details>
66
+ <summary>Click to see details</summary>
67
+
68
+ The new methods available are:
69
+ * 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.
70
+ * GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
71
+
72
+ Refer to the Provided Files table below to see what files use which methods, and how.
73
+ </details>
74
+ <!-- compatibility_gguf end -->
75
+
76
+ <!-- README_GGUF.md-provided-files start -->
77
+ ## Provided files
78
+
79
+ | Name | Quant method | Bits | Size | Max RAM required | Use case |
80
+ | ---- | ---- | ---- | ---- | ---- | ----- |
81
+ | [mistral_7b_magnite_finetuned.Q4_K_M.gguf](https://huggingface.co/waadarsh/mistral_7b_magnite_finetuned-GGUF/blob/main/mistral_7b_magnite_finetuned.Q4_K_M.gguf) | Q4_K_M | 4 | 4.37 GB| 6.87 GB | medium, balanced quality - recommended |
82
+ | [mistral_7b_magnite_finetuned.Q5_K_M.gguf](https://huggingface.co/waadarsh/mistral_7b_magnite_finetuned-GGUF/blob/main/mistral_7b_magnite_finetuned.Q5_K_M.gguf) | Q5_K_M | 5 | 5.13 GB| 7.63 GB | large, very low quality loss - recommended |
83
+
84
+ **Note**: the above RAM figures assume no GPU offloading. If layers are offloaded to the GPU, this will reduce RAM usage and use VRAM instead.
85
+
86
+
87
+
88
+ <!-- README_GGUF.md-provided-files end -->
89
+
90
+ <!-- README_GGUF.md-how-to-download start -->
91
+ ## How to download GGUF files
92
+
93
+ **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.
94
+
95
+ The following clients/libraries will automatically download models for you, providing a list of available models to choose from:
96
+ - LM Studio
97
+ - LoLLMS Web UI
98
+ - Faraday.dev
99
+
100
+ ### In `text-generation-webui`
101
+
102
+ Under Download Model, you can enter the model repo: TheBloke/Mistral-7B-Instruct-v0.1-GGUF and below it, a specific filename to download, such as: mistral-7b-instruct-v0.1.Q4_K_M.gguf.
103
+
104
+ Then click Download.
105
+
106
+ ### On the command line, including multiple files at once
107
+
108
+ I recommend using the `huggingface-hub` Python library:
109
+
110
+ ```shell
111
+ pip3 install huggingface-hub
112
+ ```
113
+
114
+ Then you can download any individual model file to the current directory, at high speed, with a command like this:
115
+
116
+ ```shell
117
+ huggingface-cli download TheBloke/Mistral-7B-Instruct-v0.1-GGUF mistral-7b-instruct-v0.1.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
118
+ ```
119
+
120
+ <details>
121
+ <summary>More advanced huggingface-cli download usage</summary>
122
+
123
+ You can also download multiple files at once with a pattern:
124
+
125
+ ```shell
126
+ huggingface-cli download waadarsh/mistral_7b_magnite_finetuned-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
127
+ ```
128
+
129
+ 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).
130
+
131
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
132
+
133
+ ```shell
134
+ pip3 install hf_transfer
135
+ ```
136
+
137
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
138
+
139
+ ```shell
140
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download waadarsh/mistral_7b_magnite_finetuned-GGUF mistral_7b_magnite_finetuned.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
141
+ ```
142
+
143
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
144
+ </details>
145
+ <!-- README_GGUF.md-how-to-download end -->
146
+
147
+ <!-- README_GGUF.md-how-to-run start -->
148
+ ## Example `llama.cpp` command
149
+
150
+ Make sure you are using `llama.cpp` from commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
151
+
152
+ ```shell
153
+ ./main -ngl 32 -m mistral_7b_magnite_finetuned.Q4_K_M.gguf --color -c 4096 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "<s>[INST]{prompt} [/INST]"
154
+ ```
155
+
156
+ Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
157
+
158
+ Sequence length can be 4096 or lower. Mistral's sliding window sequence length is not yet supported in llama.cpp, so do not use sequence lengths longer than 4096.
159
+
160
+ If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
161
+
162
+ 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)
163
+
164
+ ## How to run in `text-generation-webui`
165
+
166
+ Further instructions here: [text-generation-webui/docs/llama.cpp.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/llama.cpp.md).
167
+
168
+ ## How to run from Python code
169
+
170
+ 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.
171
+
172
+ ### How to load this model in Python code, using ctransformers
173
+
174
+ I have not tested ctransformers with Mistral models. It may work, but will require that you set the `model_type` to `llama` for now, until ctransformers updates with specific support.
175
+
176
+ #### First install the package
177
+
178
+ Run one of the following commands, according to your system:
179
+
180
+ ```shell
181
+ # Base ctransformers with no GPU acceleration
182
+ pip install ctransformers
183
+ # Or with CUDA GPU acceleration
184
+ pip install ctransformers[cuda]
185
+ # Or with AMD ROCm GPU acceleration (Linux only)
186
+ CT_HIPBLAS=1 pip install ctransformers --no-binary ctransformers
187
+ # Or with Metal GPU acceleration for macOS systems only
188
+ CT_METAL=1 pip install ctransformers --no-binary ctransformers
189
+ ```
190
+
191
+ #### Simple ctransformers example code
192
+
193
+ ```python
194
+ from ctransformers import AutoModelForCausalLM
195
+
196
+ # Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
197
+ llm = AutoModelForCausalLM.from_pretrained("TheBloke/Mistral-7B-Instruct-v0.1-GGUF", model_file="mistral-7b-instruct-v0.1.Q4_K_M.gguf", model_type="mistral", gpu_layers=50)
198
+
199
+ print(llm("AI is going to"))
200
+ ```
201
+
202
+ ## How to use with LangChain
203
+
204
+ Here are guides on using llama-cpp-python and ctransformers with LangChain:
205
+
206
+ * [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp)
207
+ * [LangChain + ctransformers](https://python.langchain.com/docs/integrations/providers/ctransformers)
208
+
209
+ <!-- README_GGUF.md-how-to-run end -->
210
+
211
+ <!-- footer start -->
212
+ <!-- 200823 -->