Transformers
GGUF
English
llama
causal-lm
TheBloke commited on
Commit
c20e3a3
1 Parent(s): b9caa62

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +496 -0
README.md ADDED
@@ -0,0 +1,496 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: https://huggingface.co/CarperAI/stable-vicuna-13b-delta
3
+ datasets:
4
+ - OpenAssistant/oasst1
5
+ - nomic-ai/gpt4all_prompt_generations
6
+ - tatsu-lab/alpaca
7
+ inference: false
8
+ language:
9
+ - en
10
+ license: cc-by-nc-sa-4.0
11
+ model_creator: CarperAI
12
+ model_name: Stable Vicuna 13B
13
+ model_type: llama
14
+ prompt_template: 'A chat between a curious user and an artificial intelligence assistant.
15
+ The assistant gives helpful, detailed, and polite answers to the user''s questions.
16
+ USER: {prompt} ASSISTANT:
17
+
18
+ '
19
+ quantized_by: TheBloke
20
+ tags:
21
+ - causal-lm
22
+ - llama
23
+ ---
24
+
25
+ <!-- header start -->
26
+ <!-- 200823 -->
27
+ <div style="width: auto; margin-left: auto; margin-right: auto">
28
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
29
+ </div>
30
+ <div style="display: flex; justify-content: space-between; width: 100%;">
31
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
32
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
33
+ </div>
34
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
35
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
36
+ </div>
37
+ </div>
38
+ <div style="text-align:center; margin-top: 0em; margin-bottom: 0em"><p style="margin-top: 0.25em; margin-bottom: 0em;">TheBloke's LLM work is generously supported by a grant from <a href="https://a16z.com">andreessen horowitz (a16z)</a></p></div>
39
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
40
+ <!-- header end -->
41
+
42
+ # Stable Vicuna 13B - GGUF
43
+ - Model creator: [CarperAI](https://huggingface.co/CarperAI)
44
+ - Original model: [Stable Vicuna 13B](https://huggingface.co/CarperAI/stable-vicuna-13b-delta)
45
+
46
+ <!-- description start -->
47
+ ## Description
48
+
49
+ This repo contains GGUF format model files for [CarperAI's Stable Vicuna 13B](https://huggingface.co/CarperAI/stable-vicuna-13b-delta).
50
+
51
+ <!-- description end -->
52
+ <!-- README_GGUF.md-about-gguf start -->
53
+ ### About GGUF
54
+
55
+ 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. GGUF offers numerous advantages over GGML, such as better tokenisation, and support for special tokens. It is also supports metadata, and is designed to be extensible.
56
+
57
+ Here is an incomplate list of clients and libraries that are known to support GGUF:
58
+
59
+ * [llama.cpp](https://github.com/ggerganov/llama.cpp). The source project for GGUF. Offers a CLI and a server option.
60
+ * [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.
61
+ * [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.
62
+ * [LM Studio](https://lmstudio.ai/), an easy-to-use and powerful local GUI for Windows and macOS (Silicon), with GPU acceleration.
63
+ * [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.
64
+ * [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.
65
+ * [ctransformers](https://github.com/marella/ctransformers), a Python library with GPU accel, LangChain support, and OpenAI-compatible AI server.
66
+ * [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), a Python library with GPU accel, LangChain support, and OpenAI-compatible API server.
67
+ * [candle](https://github.com/huggingface/candle), a Rust ML framework with a focus on performance, including GPU support, and ease of use.
68
+
69
+ <!-- README_GGUF.md-about-gguf end -->
70
+ <!-- repositories-available start -->
71
+ ## Repositories available
72
+
73
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/stable-vicuna-13B-AWQ)
74
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/stable-vicuna-13B-GPTQ)
75
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/stable-vicuna-13B-GGUF)
76
+ * [CarperAI's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/CarperAI/stable-vicuna-13b-delta)
77
+ <!-- repositories-available end -->
78
+
79
+ <!-- prompt-template start -->
80
+ ## Prompt template: Vicuna
81
+
82
+ ```
83
+ A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. USER: {prompt} ASSISTANT:
84
+
85
+ ```
86
+
87
+ <!-- prompt-template end -->
88
+ <!-- licensing start -->
89
+ ## Licensing
90
+
91
+ The creator of the source model has listed its license as `cc-by-nc-sa-4.0`, and this quantization has therefore used that same license.
92
+
93
+ As this model is based on Llama 2, it is also subject to the Meta Llama 2 license terms, and the license files for that are additionally included. It should therefore be considered as being claimed to be licensed under both licenses. I contacted Hugging Face for clarification on dual licensing but they do not yet have an official position. Should this change, or should Meta provide any feedback on this situation, I will update this section accordingly.
94
+
95
+ In the meantime, any questions regarding licensing, and in particular how these two licenses might interact, should be directed to the original model repository: [CarperAI's Stable Vicuna 13B](https://huggingface.co/CarperAI/stable-vicuna-13b-delta).
96
+ <!-- licensing end -->
97
+ <!-- compatibility_gguf start -->
98
+ ## Compatibility
99
+
100
+ These quantised GGUFv2 files are compatible with llama.cpp from August 27th onwards, as of commit [d0cee0d36d5be95a0d9088b674dbb27354107221](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221)
101
+
102
+ They are also compatible with many third party UIs and libraries - please see the list at the top of this README.
103
+
104
+ ## Explanation of quantisation methods
105
+ <details>
106
+ <summary>Click to see details</summary>
107
+
108
+ The new methods available are:
109
+ * 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)
110
+ * 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.
111
+ * 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.
112
+ * GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
113
+ * 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
114
+
115
+ Refer to the Provided Files table below to see what files use which methods, and how.
116
+ </details>
117
+ <!-- compatibility_gguf end -->
118
+
119
+ <!-- README_GGUF.md-provided-files start -->
120
+ ## Provided files
121
+
122
+ | Name | Quant method | Bits | Size | Max RAM required | Use case |
123
+ | ---- | ---- | ---- | ---- | ---- | ----- |
124
+ | [stable-vicuna-13B.Q2_K.gguf](https://huggingface.co/TheBloke/stable-vicuna-13B-GGUF/blob/main/stable-vicuna-13B.Q2_K.gguf) | Q2_K | 2 | 5.43 GB| 7.93 GB | smallest, significant quality loss - not recommended for most purposes |
125
+ | [stable-vicuna-13B.Q3_K_S.gguf](https://huggingface.co/TheBloke/stable-vicuna-13B-GGUF/blob/main/stable-vicuna-13B.Q3_K_S.gguf) | Q3_K_S | 3 | 5.66 GB| 8.16 GB | very small, high quality loss |
126
+ | [stable-vicuna-13B.Q3_K_M.gguf](https://huggingface.co/TheBloke/stable-vicuna-13B-GGUF/blob/main/stable-vicuna-13B.Q3_K_M.gguf) | Q3_K_M | 3 | 6.34 GB| 8.84 GB | very small, high quality loss |
127
+ | [stable-vicuna-13B.Q3_K_L.gguf](https://huggingface.co/TheBloke/stable-vicuna-13B-GGUF/blob/main/stable-vicuna-13B.Q3_K_L.gguf) | Q3_K_L | 3 | 6.93 GB| 9.43 GB | small, substantial quality loss |
128
+ | [stable-vicuna-13B.Q4_0.gguf](https://huggingface.co/TheBloke/stable-vicuna-13B-GGUF/blob/main/stable-vicuna-13B.Q4_0.gguf) | Q4_0 | 4 | 7.37 GB| 9.87 GB | legacy; small, very high quality loss - prefer using Q3_K_M |
129
+ | [stable-vicuna-13B.Q4_K_S.gguf](https://huggingface.co/TheBloke/stable-vicuna-13B-GGUF/blob/main/stable-vicuna-13B.Q4_K_S.gguf) | Q4_K_S | 4 | 7.41 GB| 9.91 GB | small, greater quality loss |
130
+ | [stable-vicuna-13B.Q4_K_M.gguf](https://huggingface.co/TheBloke/stable-vicuna-13B-GGUF/blob/main/stable-vicuna-13B.Q4_K_M.gguf) | Q4_K_M | 4 | 7.87 GB| 10.37 GB | medium, balanced quality - recommended |
131
+ | [stable-vicuna-13B.Q5_0.gguf](https://huggingface.co/TheBloke/stable-vicuna-13B-GGUF/blob/main/stable-vicuna-13B.Q5_0.gguf) | Q5_0 | 5 | 8.97 GB| 11.47 GB | legacy; medium, balanced quality - prefer using Q4_K_M |
132
+ | [stable-vicuna-13B.Q5_K_S.gguf](https://huggingface.co/TheBloke/stable-vicuna-13B-GGUF/blob/main/stable-vicuna-13B.Q5_K_S.gguf) | Q5_K_S | 5 | 8.97 GB| 11.47 GB | large, low quality loss - recommended |
133
+ | [stable-vicuna-13B.Q5_K_M.gguf](https://huggingface.co/TheBloke/stable-vicuna-13B-GGUF/blob/main/stable-vicuna-13B.Q5_K_M.gguf) | Q5_K_M | 5 | 9.23 GB| 11.73 GB | large, very low quality loss - recommended |
134
+ | [stable-vicuna-13B.Q6_K.gguf](https://huggingface.co/TheBloke/stable-vicuna-13B-GGUF/blob/main/stable-vicuna-13B.Q6_K.gguf) | Q6_K | 6 | 10.68 GB| 13.18 GB | very large, extremely low quality loss |
135
+ | [stable-vicuna-13B.Q8_0.gguf](https://huggingface.co/TheBloke/stable-vicuna-13B-GGUF/blob/main/stable-vicuna-13B.Q8_0.gguf) | Q8_0 | 8 | 13.83 GB| 16.33 GB | very large, extremely low quality loss - not recommended |
136
+
137
+ **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.
138
+
139
+
140
+
141
+ <!-- README_GGUF.md-provided-files end -->
142
+
143
+ <!-- README_GGUF.md-how-to-download start -->
144
+ ## How to download GGUF files
145
+
146
+ **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.
147
+
148
+ The following clients/libraries will automatically download models for you, providing a list of available models to choose from:
149
+ - LM Studio
150
+ - LoLLMS Web UI
151
+ - Faraday.dev
152
+
153
+ ### In `text-generation-webui`
154
+
155
+ Under Download Model, you can enter the model repo: TheBloke/stable-vicuna-13B-GGUF and below it, a specific filename to download, such as: stable-vicuna-13B.q4_K_M.gguf.
156
+
157
+ Then click Download.
158
+
159
+ ### On the command line, including multiple files at once
160
+
161
+ I recommend using the `huggingface-hub` Python library:
162
+
163
+ ```shell
164
+ pip3 install huggingface-hub>=0.17.1
165
+ ```
166
+
167
+ Then you can download any individual model file to the current directory, at high speed, with a command like this:
168
+
169
+ ```shell
170
+ huggingface-cli download TheBloke/stable-vicuna-13B-GGUF stable-vicuna-13B.q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
171
+ ```
172
+
173
+ <details>
174
+ <summary>More advanced huggingface-cli download usage</summary>
175
+
176
+ You can also download multiple files at once with a pattern:
177
+
178
+ ```shell
179
+ huggingface-cli download TheBloke/stable-vicuna-13B-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
180
+ ```
181
+
182
+ 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).
183
+
184
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
185
+
186
+ ```shell
187
+ pip3 install hf_transfer
188
+ ```
189
+
190
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
191
+
192
+ ```shell
193
+ HUGGINGFACE_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/stable-vicuna-13B-GGUF stable-vicuna-13B.q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
194
+ ```
195
+
196
+ Windows CLI users: Use `set HUGGINGFACE_HUB_ENABLE_HF_TRANSFER=1` before running the download command.
197
+ </details>
198
+ <!-- README_GGUF.md-how-to-download end -->
199
+
200
+ <!-- README_GGUF.md-how-to-run start -->
201
+ ## Example `llama.cpp` command
202
+
203
+ Make sure you are using `llama.cpp` from commit [d0cee0d36d5be95a0d9088b674dbb27354107221](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
204
+
205
+ ```shell
206
+ ./main -ngl 32 -m stable-vicuna-13B.q4_K_M.gguf --color -c 4096 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. USER: {prompt} ASSISTANT:"
207
+ ```
208
+
209
+ Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
210
+
211
+ Change `-c 4096` 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.
212
+
213
+ If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
214
+
215
+ 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)
216
+
217
+ ## How to run in `text-generation-webui`
218
+
219
+ Further instructions here: [text-generation-webui/docs/llama.cpp.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/llama.cpp.md).
220
+
221
+ ## How to run from Python code
222
+
223
+ 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.
224
+
225
+ ### How to load this model from Python using ctransformers
226
+
227
+ #### First install the package
228
+
229
+ ```bash
230
+ # Base ctransformers with no GPU acceleration
231
+ pip install ctransformers>=0.2.24
232
+ # Or with CUDA GPU acceleration
233
+ pip install ctransformers[cuda]>=0.2.24
234
+ # Or with ROCm GPU acceleration
235
+ CT_HIPBLAS=1 pip install ctransformers>=0.2.24 --no-binary ctransformers
236
+ # Or with Metal GPU acceleration for macOS systems
237
+ CT_METAL=1 pip install ctransformers>=0.2.24 --no-binary ctransformers
238
+ ```
239
+
240
+ #### Simple example code to load one of these GGUF models
241
+
242
+ ```python
243
+ from ctransformers import AutoModelForCausalLM
244
+
245
+ # Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
246
+ llm = AutoModelForCausalLM.from_pretrained("TheBloke/stable-vicuna-13B-GGUF", model_file="stable-vicuna-13B.q4_K_M.gguf", model_type="llama", gpu_layers=50)
247
+
248
+ print(llm("AI is going to"))
249
+ ```
250
+
251
+ ## How to use with LangChain
252
+
253
+ Here's guides on using llama-cpp-python or ctransformers with LangChain:
254
+
255
+ * [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp)
256
+ * [LangChain + ctransformers](https://python.langchain.com/docs/integrations/providers/ctransformers)
257
+
258
+ <!-- README_GGUF.md-how-to-run end -->
259
+
260
+ <!-- footer start -->
261
+ <!-- 200823 -->
262
+ ## Discord
263
+
264
+ For further support, and discussions on these models and AI in general, join us at:
265
+
266
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
267
+
268
+ ## Thanks, and how to contribute
269
+
270
+ Thanks to the [chirper.ai](https://chirper.ai) team!
271
+
272
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
273
+
274
+ I've had a lot of people ask if they can contribute. I enjoy providing models and helping people, and would love to be able to spend even more time doing it, as well as expanding into new projects like fine tuning/training.
275
+
276
+ If you're able and willing to contribute it will be most gratefully received and will help me to keep providing more models, and to start work on new AI projects.
277
+
278
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
279
+
280
+ * Patreon: https://patreon.com/TheBlokeAI
281
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
282
+
283
+ **Special thanks to**: Aemon Algiz.
284
+
285
+ **Patreon special mentions**: Alicia Loh, Stephen Murray, K, Ajan Kanaga, RoA, Magnesian, Deo Leter, Olakabola, Eugene Pentland, zynix, Deep Realms, Raymond Fosdick, Elijah Stavena, Iucharbius, Erik Bjäreholt, Luis Javier Navarrete Lozano, Nicholas, theTransient, John Detwiler, alfie_i, knownsqashed, Mano Prime, Willem Michiel, Enrico Ros, LangChain4j, OG, Michael Dempsey, Pierre Kircher, Pedro Madruga, James Bentley, Thomas Belote, Luke @flexchar, Leonard Tan, Johann-Peter Hartmann, Illia Dulskyi, Fen Risland, Chadd, S_X, Jeff Scroggin, Ken Nordquist, Sean Connelly, Artur Olbinski, Swaroop Kallakuri, Jack West, Ai Maven, David Ziegler, Russ Johnson, transmissions 11, John Villwock, Alps Aficionado, Clay Pascal, Viktor Bowallius, Subspace Studios, Rainer Wilmers, Trenton Dambrowitz, vamX, Michael Levine, 준교 김, Brandon Frisco, Kalila, Trailburnt, Randy H, Talal Aujan, Nathan Dryer, Vadim, 阿明, ReadyPlayerEmma, Tiffany J. Kim, George Stoitzev, Spencer Kim, Jerry Meng, Gabriel Tamborski, Cory Kujawski, Jeffrey Morgan, Spiking Neurons AB, Edmond Seymore, Alexandros Triantafyllidis, Lone Striker, Cap'n Zoog, Nikolai Manek, danny, ya boyyy, Derek Yates, usrbinkat, Mandus, TL, Nathan LeClaire, subjectnull, Imad Khwaja, webtim, Raven Klaugh, Asp the Wyvern, Gabriel Puliatti, Caitlyn Gatomon, Joseph William Delisle, Jonathan Leane, Luke Pendergrass, SuperWojo, Sebastain Graf, Will Dee, Fred von Graf, Andrey, Dan Guido, Daniel P. Andersen, Nitin Borwankar, Elle, Vitor Caleffi, biorpg, jjj, NimbleBox.ai, Pieter, Matthew Berman, terasurfer, Michael Davis, Alex, Stanislav Ovsiannikov
286
+
287
+
288
+ Thank you to all my generous patrons and donaters!
289
+
290
+ And thank you again to a16z for their generous grant.
291
+
292
+ <!-- footer end -->
293
+
294
+ <!-- original-model-card start -->
295
+ # Original model card: CarperAI's Stable Vicuna 13B
296
+
297
+
298
+ # StableVicuna-13B
299
+
300
+ ## Model Description
301
+
302
+ StableVicuna-13B is a [Vicuna-13B v0](https://huggingface.co/lmsys/vicuna-13b-delta-v0) model fine-tuned using reinforcement learning from human feedback (RLHF) via Proximal Policy Optimization (PPO) on various conversational and instructional datasets.
303
+
304
+ ### Apply Delta Weights
305
+
306
+ StableVicuna-13B cannot be used from the `CarperAI/stable-vicuna-13b-delta` weights alone. To obtain the correct model, one must add back the difference between LLaMA 13B and `CarperAI/stable-vicuna-13b-delta` weights. We provide the [`apply_delta.py`](https://huggingface.co/CarperAI/stable-vicuna-13b-delta/raw/main/apply_delta.py) script to automate the conversion, which you can run as:
307
+
308
+ ```sh
309
+ python3 apply_delta.py --base /path/to/model_weights/llama-13b --target stable-vicuna-13b --delta CarperAI/stable-vicuna-13b-delta
310
+ ```
311
+
312
+
313
+ ## Usage
314
+
315
+ Once the delta weights are applied, get started chatting with the model by using the [`transformers`](https://huggingface.co/docs/transformers) library. Following a suggestion from Vicuna Team with Vicuna v0 you should install transformers with this version:
316
+
317
+ ```sh
318
+ pip install git+https://github.com/huggingface/transformers@c612628045822f909020f7eb6784c79700813eda
319
+ ```
320
+
321
+ ```python
322
+ from transformers import AutoTokenizer, AutoModelForCausalLM
323
+
324
+ tokenizer = AutoTokenizer.from_pretrained("path/to/stable-vicuna-13b-applied")
325
+ model = AutoModelForCausalLM.from_pretrained("path/to/stable-vicuna-13b-applied")
326
+ model.half().cuda()
327
+
328
+ prompt = """\
329
+ ### Human: Write a Python script for text classification using Transformers and PyTorch
330
+ ### Assistant:\
331
+ """
332
+
333
+ inputs = tokenizer(prompt, return_tensors='pt').to('cuda')
334
+ tokens = model.generate(
335
+ **inputs,
336
+ max_new_tokens=256,
337
+ do_sample=True,
338
+ temperature=1.0,
339
+ top_p=1.0,
340
+ )
341
+ print(tokenizer.decode(tokens[0], skip_special_tokens=True))
342
+ ```
343
+
344
+ ## Model Details
345
+
346
+ * **Trained by**: [Duy Phung](https://github.com/PhungVanDuy) of [CarperAI](https://carper.ai)
347
+ * **Model type:** **StableVicuna-13B** is an auto-regressive language model based on the LLaMA transformer architecture.
348
+ * **Language(s)**: English
349
+ * **Library**: [trlX](https://github.com/CarperAI/trlx)
350
+ * **License for delta weights**: [CC-BY-NC-SA-4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)
351
+ * *Note*: License for the base LLaMA model's weights is Meta's [non-commercial bespoke license](https://github.com/facebookresearch/llama/blob/main/MODEL_CARD.md).
352
+ * **Contact**: For questions and comments about the model, visit the [CarperAI](https://discord.com/invite/KgfkCVYHdu) and [StableFoundation](https://discord.gg/stablediffusion) Discord servers.
353
+
354
+ | Hyperparameter | Value |
355
+ |---------------------------|-------|
356
+ | \\(n_\text{parameters}\\) | 13B |
357
+ | \\(d_\text{model}\\) | 5120 |
358
+ | \\(n_\text{layers}\\) | 40 |
359
+ | \\(n_\text{heads}\\) | 40 |
360
+
361
+ ## Training
362
+
363
+ ### Training Dataset
364
+
365
+ StableVicuna-13B is fine-tuned on a mix of three datasets. [OpenAssistant Conversations Dataset (OASST1)](https://huggingface.co/datasets/OpenAssistant/oasst1), a human-generated, human-annotated assistant-style conversation corpus consisting of 161,443 messages distributed across 66,497 conversation trees, in 35 different languages;
366
+ [GPT4All Prompt Generations](https://huggingface.co/datasets/nomic-ai/gpt4all_prompt_generations), a dataset of 400k prompts and responses generated by GPT-4; and [Alpaca](https://huggingface.co/datasets/tatsu-lab/alpaca), a dataset of 52,000 instructions and demonstrations generated by OpenAI's text-davinci-003 engine.
367
+
368
+ The reward model used during RLHF was also trained on [OpenAssistant Conversations Dataset (OASST1)](https://huggingface.co/datasets/OpenAssistant/oasst1) along with two other datasets: [Anthropic HH-RLHF](https://huggingface.co/datasets/Anthropic/hh-rlhf), a dataset of preferences about AI assistant helpfulness and harmlessness; and [Stanford Human Preferences Dataset](https://huggingface.co/datasets/stanfordnlp/SHP) a dataset of 385K collective human preferences over responses to questions/instructions in 18 different subject areas, from cooking to legal advice.
369
+
370
+ ### Training Procedure
371
+
372
+ `CarperAI/stable-vicuna-13b-delta` was trained using PPO as implemented in [`trlX`](https://github.com/CarperAI/trlx/blob/main/trlx/trainer/accelerate_ppo_trainer.py) with the following configuration:
373
+
374
+ | Hyperparameter | Value |
375
+ |-------------------|---------|
376
+ | num_rollouts | 128 |
377
+ | chunk_size | 16 |
378
+ | ppo_epochs | 4 |
379
+ | init_kl_coef | 0.1 |
380
+ | target | 6 |
381
+ | horizon | 10000 |
382
+ | gamma | 1 |
383
+ | lam | 0.95 |
384
+ | cliprange | 0.2 |
385
+ | cliprange_value | 0.2 |
386
+ | vf_coef | 1.0 |
387
+ | scale_reward | None |
388
+ | cliprange_reward | 10 |
389
+ | generation_kwargs | |
390
+ | max_length | 512 |
391
+ | min_length | 48 |
392
+ | top_k | 0.0 |
393
+ | top_p | 1.0 |
394
+ | do_sample | True |
395
+ | temperature | 1.0 |
396
+
397
+ ## Use and Limitations
398
+
399
+ ### Intended Use
400
+
401
+ This model is intended to be used for text generation with a focus on conversational tasks. Users may further fine-tune the model on their own data to improve the model's performance on their specific tasks in accordance with the non-commercial [license](https://creativecommons.org/licenses/by-nc/4.0/).
402
+
403
+ ### Limitations and bias
404
+
405
+ The base LLaMA model is trained on various data, some of which may contain offensive, harmful, and biased content that can lead to toxic behavior. See Section 5.1 of the LLaMA [paper](https://arxiv.org/abs/2302.13971). We have not performed any studies to determine how fine-tuning on the aforementioned datasets affect the model's behavior and toxicity. Do not treat chat responses from this model as a substitute for human judgment or as a source of truth. Please use responsibly.
406
+
407
+ ## Acknowledgements
408
+
409
+ This work would not have been possible without the support of [Stability AI](https://stability.ai/).
410
+
411
+ ## Citations
412
+
413
+ ```bibtex
414
+ @article{touvron2023llama,
415
+ title={LLaMA: Open and Efficient Foundation Language Models},
416
+ author={Touvron, Hugo and Lavril, Thibaut and Izacard, Gautier and Martinet, Xavier and Lachaux, Marie-Anne and Lacroix, Timoth{\'e}e and Rozi{\`e}re, Baptiste and Goyal, Naman and Hambro, Eric and Azhar, Faisal and Rodriguez, Aurelien and Joulin, Armand and Grave, Edouard and Lample, Guillaume},
417
+ journal={arXiv preprint arXiv:2302.13971},
418
+ year={2023}
419
+ }
420
+ ```
421
+
422
+ ```bibtex
423
+ @misc{vicuna2023,
424
+ title = {Vicuna: An Open-Source Chatbot Impressing GPT-4 with 90%* ChatGPT Quality},
425
+ url = {https://vicuna.lmsys.org},
426
+ author = {Chiang, Wei-Lin and Li, Zhuohan and Lin, Zi and Sheng, Ying and Wu, Zhanghao and Zhang, Hao and Zheng, Lianmin and Zhuang, Siyuan and Zhuang, Yonghao and Gonzalez, Joseph E. and Stoica, Ion and Xing, Eric P.},
427
+ month = {March},
428
+ year = {2023}
429
+ }
430
+ ```
431
+
432
+ ```bibtex
433
+ @misc{gpt4all,
434
+ author = {Yuvanesh Anand and Zach Nussbaum and Brandon Duderstadt and Benjamin Schmidt and Andriy Mulyar},
435
+ title = {GPT4All: Training an Assistant-style Chatbot with Large Scale Data Distillation from GPT-3.5-Turbo},
436
+ year = {2023},
437
+ publisher = {GitHub},
438
+ journal = {GitHub repository},
439
+ howpublished = {\url{https://github.com/nomic-ai/gpt4all}},
440
+ }
441
+ ```
442
+
443
+ ```bibtex
444
+ @misc{alpaca,
445
+ author = {Rohan Taori and Ishaan Gulrajani and Tianyi Zhang and Yann Dubois and Xuechen Li and Carlos Guestrin and Percy Liang and Tatsunori B. Hashimoto },
446
+ title = {Stanford Alpaca: An Instruction-following LLaMA model},
447
+ year = {2023},
448
+ publisher = {GitHub},
449
+ journal = {GitHub repository},
450
+ howpublished = {\url{https://github.com/tatsu-lab/stanford_alpaca}},
451
+ }
452
+ ```
453
+
454
+ ```bibtex
455
+ @software{leandro_von_werra_2023_7790115,
456
+ author = {Leandro von Werra and
457
+ Alex Havrilla and
458
+ Max reciprocated and
459
+ Jonathan Tow and
460
+ Aman cat-state and
461
+ Duy V. Phung and
462
+ Louis Castricato and
463
+ Shahbuland Matiana and
464
+ Alan and
465
+ Ayush Thakur and
466
+ Alexey Bukhtiyarov and
467
+ aaronrmm and
468
+ Fabrizio Milo and
469
+ Daniel and
470
+ Daniel King and
471
+ Dong Shin and
472
+ Ethan Kim and
473
+ Justin Wei and
474
+ Manuel Romero and
475
+ Nicky Pochinkov and
476
+ Omar Sanseviero and
477
+ Reshinth Adithyan and
478
+ Sherman Siu and
479
+ Thomas Simonini and
480
+ Vladimir Blagojevic and
481
+ Xu Song and
482
+ Zack Witten and
483
+ alexandremuzio and
484
+ crumb},
485
+ title = {{CarperAI/trlx: v0.6.0: LLaMa (Alpaca), Benchmark
486
+ Util, T5 ILQL, Tests}},
487
+ month = mar,
488
+ year = 2023,
489
+ publisher = {Zenodo},
490
+ version = {v0.6.0},
491
+ doi = {10.5281/zenodo.7790115},
492
+ url = {https://doi.org/10.5281/zenodo.7790115}
493
+ }
494
+ ```
495
+
496
+ <!-- original-model-card end -->