andrijdavid commited on
Commit
662281d
·
verified ·
1 Parent(s): dc789f2

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +303 -0
README.md ADDED
@@ -0,0 +1,303 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ ---
4
+ license: apache-2.0
5
+ tags:
6
+ - GGUF
7
+ quantized_by: andrijdavid
8
+ ---
9
+ # Tess-2.0-Mixtral-8x22B-GGUF
10
+ - Original model: [Tess-2.0-Mixtral-8x22B](https://huggingface.co/migtissera/Tess-2.0-Mixtral-8x22B)
11
+
12
+ <!-- description start -->
13
+ ## Description
14
+
15
+ This repo contains GGUF format model files for [Tess-2.0-Mixtral-8x22B](https://huggingface.co/migtissera/Tess-2.0-Mixtral-8x22B).
16
+
17
+ <!-- description end -->
18
+ <!-- README_GGUF.md-about-gguf start -->
19
+ ### About GGUF
20
+ 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.
21
+ Here is an incomplete list of clients and libraries that are known to support GGUF:
22
+ * [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.
23
+ * [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.
24
+ * [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​
25
+ * [KoboldCpp](https://github.com/LostRuins/koboldcpp), A comprehensive web UI offering GPU acceleration across all platforms and architectures, particularly renowned for storytelling.
26
+ * [GPT4All](https://gpt4all.io), This is a free and open source GUI that runs locally, supporting Windows, Linux, and macOS with full GPU acceleration.
27
+ * [LM Studio](https://lmstudio.ai/) An intuitive and powerful local GUI for Windows and macOS (Silicon), featuring GPU acceleration.
28
+ * [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.
29
+ * [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.
30
+ * [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.
31
+ * [candle](https://github.com/huggingface/candle), A Rust-based ML framework focusing on performance, including GPU support, and designed for ease of use.
32
+ * [ctransformers](https://github.com/marella/ctransformers), A Python library featuring GPU acceleration, LangChain support, and an OpenAI-compatible AI server.
33
+ * [localGPT](https://github.com/PromtEngineer/localGPT) An open-source initiative enabling private conversations with documents.
34
+ <!-- README_GGUF.md-about-gguf end -->
35
+
36
+ <!-- compatibility_gguf start -->
37
+ ## Explanation of quantisation methods
38
+ <details>
39
+ <summary>Click to see details</summary>
40
+ The new methods available are:
41
+
42
+ * 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)
43
+ * 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.
44
+ * 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.
45
+ * GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
46
+ * 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.
47
+ </details>
48
+ <!-- compatibility_gguf end -->
49
+
50
+ <!-- README_GGUF.md-how-to-download start -->
51
+ ## How to download GGUF files
52
+
53
+ **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.
54
+
55
+ The following clients/libraries will automatically download models for you, providing a list of available models to choose from:
56
+
57
+ * LM Studio
58
+ * LoLLMS Web UI
59
+ * Faraday.dev
60
+
61
+ ### In `text-generation-webui`
62
+
63
+ Under Download Model, you can enter the model repo: LiteLLMs/Tess-2.0-Mixtral-8x22B-GGUF and below it, a specific filename to download, such as: Q4_0/Q4_0-00001-of-00009.gguf.
64
+
65
+ Then click Download.
66
+
67
+ ### On the command line, including multiple files at once
68
+
69
+ I recommend using the `huggingface-hub` Python library:
70
+
71
+ ```shell
72
+ pip3 install huggingface-hub
73
+ ```
74
+
75
+ Then you can download any individual model file to the current directory, at high speed, with a command like this:
76
+
77
+ ```shell
78
+ huggingface-cli download LiteLLMs/Tess-2.0-Mixtral-8x22B-GGUF Q4_0/Q4_0-00001-of-00009.gguf --local-dir . --local-dir-use-symlinks False
79
+ ```
80
+
81
+ <details>
82
+ <summary>More advanced huggingface-cli download usage (click to read)</summary>
83
+
84
+ You can also download multiple files at once with a pattern:
85
+
86
+ ```shell
87
+ huggingface-cli download LiteLLMs/Tess-2.0-Mixtral-8x22B-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
88
+ ```
89
+
90
+ 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).
91
+
92
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
93
+
94
+ ```shell
95
+ pip3 install huggingface_hub[hf_transfer]
96
+ ```
97
+
98
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
99
+
100
+ ```shell
101
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download LiteLLMs/Tess-2.0-Mixtral-8x22B-GGUF Q4_0/Q4_0-00001-of-00009.gguf --local-dir . --local-dir-use-symlinks False
102
+ ```
103
+
104
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
105
+ </details>
106
+ <!-- README_GGUF.md-how-to-download end -->
107
+ <!-- README_GGUF.md-how-to-run start -->
108
+ ## Example `llama.cpp` command
109
+
110
+ Make sure you are using `llama.cpp` from commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
111
+
112
+ ```shell
113
+ ./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>"
114
+ ```
115
+
116
+ Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
117
+
118
+ 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.
119
+
120
+ If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
121
+
122
+ 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)
123
+
124
+ ## How to run in `text-generation-webui`
125
+
126
+ 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).
127
+
128
+ ## How to run from Python code
129
+
130
+ 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.
131
+
132
+ ### How to load this model in Python code, using llama-cpp-python
133
+
134
+ For full documentation, please see: [llama-cpp-python docs](https://abetlen.github.io/llama-cpp-python/).
135
+
136
+ #### First install the package
137
+
138
+ Run one of the following commands, according to your system:
139
+
140
+ ```shell
141
+ # Base ctransformers with no GPU acceleration
142
+ pip install llama-cpp-python
143
+ # With NVidia CUDA acceleration
144
+ CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
145
+ # Or with OpenBLAS acceleration
146
+ CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
147
+ # Or with CLBLast acceleration
148
+ CMAKE_ARGS="-DLLAMA_CLBLAST=on" pip install llama-cpp-python
149
+ # Or with AMD ROCm GPU acceleration (Linux only)
150
+ CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python
151
+ # Or with Metal GPU acceleration for macOS systems only
152
+ CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
153
+ # In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
154
+ $env:CMAKE_ARGS = "-DLLAMA_OPENBLAS=on"
155
+ pip install llama-cpp-python
156
+ ```
157
+
158
+ #### Simple llama-cpp-python example code
159
+
160
+ ```python
161
+ from llama_cpp import Llama
162
+ # Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
163
+ llm = Llama(
164
+ model_path="./Q4_0/Q4_0-00001-of-00009.gguf", # Download the model file first
165
+ n_ctx=32768, # The max sequence length to use - note that longer sequence lengths require much more resources
166
+ n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
167
+ n_gpu_layers=35 # The number of layers to offload to GPU, if you have GPU acceleration available
168
+ )
169
+ # Simple inference example
170
+ output = llm(
171
+ "<PROMPT>", # Prompt
172
+ max_tokens=512, # Generate up to 512 tokens
173
+ stop=["</s>"], # Example stop token - not necessarily correct for this specific model! Please check before using.
174
+ echo=True # Whether to echo the prompt
175
+ )
176
+ # Chat Completion API
177
+ 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
178
+ llm.create_chat_completion(
179
+ messages = [
180
+ {"role": "system", "content": "You are a story writing assistant."},
181
+ {
182
+ "role": "user",
183
+ "content": "Write a story about llamas."
184
+ }
185
+ ]
186
+ )
187
+ ```
188
+
189
+ ## How to use with LangChain
190
+
191
+ Here are guides on using llama-cpp-python and ctransformers with LangChain:
192
+
193
+ * [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp)
194
+ * [LangChain + ctransformers](https://python.langchain.com/docs/integrations/providers/ctransformers)
195
+
196
+ <!-- README_GGUF.md-how-to-run end -->
197
+
198
+ <!-- footer end -->
199
+
200
+ <!-- original-model-card start -->
201
+ # Original model card: Tess-2.0-Mixtral-8x22B
202
+
203
+
204
+ ![Tesoro](https://huggingface.co/migtissera/Tess-2.0-Mixtral-8x22B/resolve/main/Tess-2.png)
205
+
206
+ # Tess-2.0-Mixtral-8x22B
207
+ Tess, short for Tesoro (Treasure in Italian), is a general purpose Large Language Model series. Tess-2.0-Mixtral-8x22B was trained on the mistral-community/Mixtral-8x22B-v0.1 base.
208
+
209
+ # Prompt Format
210
+
211
+ ```
212
+ SYSTEM: <ANY SYSTEM CONTEXT>
213
+ USER:
214
+ ASSISTANT:
215
+ ```
216
+
217
+ # Training Methodology
218
+ Tess-2.0-Mixtral-8x22B was trained on the Tess-2.0 dataset. Tess-2.0 dataset and the training methodology follows LIMA (Less-Is-More) principles, and contains ~25K high-quality code and general training samples. The dataset is highly uncensored, hence the model will almost always follow instructions.
219
+
220
+ The model was only fine-tuned for 1-epoch to try and preserve its entropy as much as possible.
221
+
222
+
223
+ # Sample code to run inference
224
+
225
+ ```python
226
+ import torch, json
227
+ from transformers import AutoModelForCausalLM, AutoTokenizer
228
+
229
+ model_path = "migtissera/Tess-2.0-Mixtral-8x22B"
230
+ output_file_path = "./conversations.jsonl"
231
+
232
+ model = AutoModelForCausalLM.from_pretrained(
233
+ model_path,
234
+ torch_dtype=torch.float16,
235
+ device_map="auto",
236
+ load_in_8bit=False,
237
+ trust_remote_code=True,
238
+ )
239
+
240
+ tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
241
+
242
+
243
+ def generate_text(instruction):
244
+ tokens = tokenizer.encode(instruction)
245
+ tokens = torch.LongTensor(tokens).unsqueeze(0)
246
+ tokens = tokens.to("cuda")
247
+
248
+ instance = {
249
+ "input_ids": tokens,
250
+ "top_p": 1.0,
251
+ "temperature": 0.5,
252
+ "generate_len": 1024,
253
+ "top_k": 50,
254
+ }
255
+
256
+ length = len(tokens[0])
257
+ with torch.no_grad():
258
+ rest = model.generate(
259
+ input_ids=tokens,
260
+ max_length=length + instance["generate_len"],
261
+ use_cache=True,
262
+ do_sample=True,
263
+ top_p=instance["top_p"],
264
+ temperature=instance["temperature"],
265
+ top_k=instance["top_k"],
266
+ num_return_sequences=1,
267
+ )
268
+ output = rest[0][length:]
269
+ string = tokenizer.decode(output, skip_special_tokens=True)
270
+ answer = string.split("USER:")[0].strip()
271
+ return f"{answer}"
272
+
273
+
274
+ conversation = f"SYSTEM: Answer the question thoughtfully and intelligently. Always answer without hesitation."
275
+
276
+
277
+ while True:
278
+ user_input = input("You: ")
279
+ llm_prompt = f"{conversation} \nUSER: {user_input} \nASSISTANT: "
280
+ answer = generate_text(llm_prompt)
281
+ print(answer)
282
+ conversation = f"{llm_prompt}{answer}"
283
+ json_data = {"prompt": user_input, "answer": answer}
284
+
285
+ ## Save your conversation
286
+ with open(output_file_path, "a") as output_file:
287
+ output_file.write(json.dumps(json_data) + "\n")
288
+
289
+ ```
290
+
291
+ # Join My General AI Discord (NeuroLattice):
292
+ https://discord.gg/Hz6GrwGFKD
293
+
294
+ # Limitations & Biases:
295
+
296
+ While this model aims for accuracy, it can occasionally produce inaccurate or misleading results.
297
+
298
+ Despite diligent efforts in refining the pretraining data, there remains a possibility for the generation of inappropriate, biased, or offensive content.
299
+
300
+ Exercise caution and cross-check information when necessary. This is an uncensored model.
301
+
302
+
303
+ <!-- original-model-card end -->