TheBloke commited on
Commit
8eba8e2
1 Parent(s): 196392c

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +290 -0
README.md ADDED
@@ -0,0 +1,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: https://huggingface.co/ziqingyang/chinese-llama-2-13b
3
+ inference: false
4
+ license: apache-2.0
5
+ model_creator: Ziqing Yang
6
+ model_name: Chinese Llama 2 13B
7
+ model_type: llama
8
+ quantized_by: TheBloke
9
+ ---
10
+
11
+ <!-- header start -->
12
+ <!-- 200823 -->
13
+ <div style="width: auto; margin-left: auto; margin-right: auto">
14
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
15
+ </div>
16
+ <div style="display: flex; justify-content: space-between; width: 100%;">
17
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
18
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
19
+ </div>
20
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
21
+ <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>
22
+ </div>
23
+ </div>
24
+ <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>
25
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
26
+ <!-- header end -->
27
+
28
+ # Chinese Llama 2 13B - GPTQ
29
+ - Model creator: [Ziqing Yang](https://huggingface.co/ziqingyang)
30
+ - Original model: [Chinese Llama 2 13B](https://huggingface.co/ziqingyang/chinese-llama-2-13b)
31
+
32
+ <!-- description start -->
33
+ ## Description
34
+
35
+ This repo contains GPTQ model files for [Ziqing Yang's Chinese Llama 2 13B](https://huggingface.co/ziqingyang/chinese-llama-2-13b).
36
+
37
+ Multiple GPTQ parameter permutations are provided; see Provided Files below for details of the options provided, their parameters, and the software used to create them.
38
+
39
+ <!-- description end -->
40
+ <!-- repositories-available start -->
41
+ ## Repositories available
42
+
43
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Chinese-Llama-2-13B-GPTQ)
44
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Chinese-Llama-2-13B-GGUF)
45
+ * [Ziqing Yang's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/ziqingyang/chinese-llama-2-13b)
46
+ <!-- repositories-available end -->
47
+
48
+ <!-- prompt-template start -->
49
+ ## Prompt template: Alpaca
50
+
51
+ ```
52
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
53
+
54
+ ### Instruction:
55
+ {prompt}
56
+
57
+ ### Response:
58
+
59
+ ```
60
+
61
+ <!-- prompt-template end -->
62
+ <!-- licensing start -->
63
+ ## Licensing
64
+
65
+ The creator of the source model has listed its license as `apache-2.0`, and this quantization has therefore used that same license.
66
+
67
+ 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.
68
+
69
+ In the meantime, any questions regarding licensing, and in particular how these two licenses might interact, should be directed to the original model repository: [Ziqing Yang's Chinese Llama 2 13B](https://huggingface.co/ziqingyang/chinese-llama-2-13b).
70
+ <!-- licensing end -->
71
+ <!-- README_GPTQ.md-provided-files start -->
72
+ ## Provided files and GPTQ parameters
73
+
74
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
75
+
76
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
77
+
78
+ All recent GPTQ files are made with AutoGPTQ, and all files in non-main branches are made with AutoGPTQ. Files in the `main` branch which were uploaded before August 2023 were made with GPTQ-for-LLaMa.
79
+
80
+ <details>
81
+ <summary>Explanation of GPTQ parameters</summary>
82
+
83
+ - Bits: The bit size of the quantised model.
84
+ - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
85
+ - Act Order: True or False. Also known as `desc_act`. True results in better quantisation accuracy. Some GPTQ clients have had issues with models that use Act Order plus Group Size, but this is generally resolved now.
86
+ - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
87
+ - GPTQ dataset: The dataset used for quantisation. Using a dataset more appropriate to the model's training can improve quantisation accuracy. Note that the GPTQ dataset is not the same as the dataset used to train the model - please refer to the original model repo for details of the training dataset(s).
88
+ - Sequence Length: The length of the dataset sequences used for quantisation. Ideally this is the same as the model sequence length. For some very long sequence models (16+K), a lower sequence length may have to be used. Note that a lower sequence length does not limit the sequence length of the quantised model. It only impacts the quantisation accuracy on longer inference sequences.
89
+ - ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama models in 4-bit.
90
+
91
+ </details>
92
+
93
+ | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
94
+ | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
95
+ | [main](https://huggingface.co/TheBloke/Chinese-Llama-2-13B-GPTQ/tree/main) | 4 | 128 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 7.74 GB | Yes | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. |
96
+ | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/Chinese-Llama-2-13B-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 8.48 GB | Yes | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
97
+ | [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/Chinese-Llama-2-13B-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 13.84 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
98
+ | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/Chinese-Llama-2-13B-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 4096 | 14.13 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
99
+
100
+ <!-- README_GPTQ.md-provided-files end -->
101
+
102
+ <!-- README_GPTQ.md-download-from-branches start -->
103
+ ## How to download from branches
104
+
105
+ - In text-generation-webui, you can add `:branch` to the end of the download name, eg `TheBloke/Chinese-Llama-2-13B-GPTQ:main`
106
+ - With Git, you can clone a branch with:
107
+ ```
108
+ git clone --single-branch --branch main https://huggingface.co/TheBloke/Chinese-Llama-2-13B-GPTQ
109
+ ```
110
+ - In Python Transformers code, the branch is the `revision` parameter; see below.
111
+ <!-- README_GPTQ.md-download-from-branches end -->
112
+ <!-- README_GPTQ.md-text-generation-webui start -->
113
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
114
+
115
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
116
+
117
+ It is strongly recommended to use the text-generation-webui one-click-installers unless you're sure you know how to make a manual install.
118
+
119
+ 1. Click the **Model tab**.
120
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/Chinese-Llama-2-13B-GPTQ`.
121
+ - To download from a specific branch, enter for example `TheBloke/Chinese-Llama-2-13B-GPTQ:main`
122
+ - see Provided Files above for the list of branches for each option.
123
+ 3. Click **Download**.
124
+ 4. The model will start downloading. Once it's finished it will say "Done".
125
+ 5. In the top left, click the refresh icon next to **Model**.
126
+ 6. In the **Model** dropdown, choose the model you just downloaded: `Chinese-Llama-2-13B-GPTQ`
127
+ 7. The model will automatically load, and is now ready for use!
128
+ 8. If you want any custom settings, set them and then click **Save settings for this model** followed by **Reload the Model** in the top right.
129
+ * Note that you do not need to and should not set manual GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
130
+ 9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
131
+ <!-- README_GPTQ.md-text-generation-webui end -->
132
+
133
+ <!-- README_GPTQ.md-use-from-python start -->
134
+ ## How to use this GPTQ model from Python code
135
+
136
+ ### Install the necessary packages
137
+
138
+ Requires: Transformers 4.32.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
139
+
140
+ ```shell
141
+ pip3 install transformers>=4.32.0 optimum>=1.12.0
142
+ pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # Use cu117 if on CUDA 11.7
143
+ ```
144
+
145
+ If you have problems installing AutoGPTQ using the pre-built wheels, install it from source instead:
146
+
147
+ ```shell
148
+ pip3 uninstall -y auto-gptq
149
+ git clone https://github.com/PanQiWei/AutoGPTQ
150
+ cd AutoGPTQ
151
+ pip3 install .
152
+ ```
153
+
154
+ ### For CodeLlama models only: you must use Transformers 4.33.0 or later.
155
+
156
+ If 4.33.0 is not yet released when you read this, you will need to install Transformers from source:
157
+ ```shell
158
+ pip3 uninstall -y transformers
159
+ pip3 install git+https://github.com/huggingface/transformers.git
160
+ ```
161
+
162
+ ### You can then use the following code
163
+
164
+ ```python
165
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
166
+
167
+ model_name_or_path = "TheBloke/Chinese-Llama-2-13B-GPTQ"
168
+ # To use a different branch, change revision
169
+ # For example: revision="main"
170
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
171
+ device_map="auto",
172
+ trust_remote_code=False,
173
+ revision="main")
174
+
175
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
176
+
177
+ prompt = "Tell me about AI"
178
+ prompt_template=f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
179
+
180
+ ### Instruction:
181
+ {prompt}
182
+
183
+ ### Response:
184
+
185
+ '''
186
+
187
+ print("\n\n*** Generate:")
188
+
189
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
190
+ output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
191
+ print(tokenizer.decode(output[0]))
192
+
193
+ # Inference can also be done using transformers' pipeline
194
+
195
+ print("*** Pipeline:")
196
+ pipe = pipeline(
197
+ "text-generation",
198
+ model=model,
199
+ tokenizer=tokenizer,
200
+ max_new_tokens=512,
201
+ do_sample=True,
202
+ temperature=0.7,
203
+ top_p=0.95,
204
+ top_k=40,
205
+ repetition_penalty=1.1
206
+ )
207
+
208
+ print(pipe(prompt_template)[0]['generated_text'])
209
+ ```
210
+ <!-- README_GPTQ.md-use-from-python end -->
211
+
212
+ <!-- README_GPTQ.md-compatibility start -->
213
+ ## Compatibility
214
+
215
+ The files provided are tested to work with AutoGPTQ, both via Transformers and using AutoGPTQ directly. They should also work with [Occ4m's GPTQ-for-LLaMa fork](https://github.com/0cc4m/KoboldAI).
216
+
217
+ [ExLlama](https://github.com/turboderp/exllama) is compatible with Llama models in 4-bit. Please see the Provided Files table above for per-file compatibility.
218
+
219
+ [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) is compatible with all GPTQ models.
220
+ <!-- README_GPTQ.md-compatibility end -->
221
+
222
+ <!-- footer start -->
223
+ <!-- 200823 -->
224
+ ## Discord
225
+
226
+ For further support, and discussions on these models and AI in general, join us at:
227
+
228
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
229
+
230
+ ## Thanks, and how to contribute
231
+
232
+ Thanks to the [chirper.ai](https://chirper.ai) team!
233
+
234
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
235
+
236
+ 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.
237
+
238
+ 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.
239
+
240
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
241
+
242
+ * Patreon: https://patreon.com/TheBlokeAI
243
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
244
+
245
+ **Special thanks to**: Aemon Algiz.
246
+
247
+ **Patreon special mentions**: Russ Johnson, J, alfie_i, Alex, NimbleBox.ai, Chadd, Mandus, Nikolai Manek, Ken Nordquist, ya boyyy, Illia Dulskyi, Viktor Bowallius, vamX, Iucharbius, zynix, Magnesian, Clay Pascal, Pierre Kircher, Enrico Ros, Tony Hughes, Elle, Andrey, knownsqashed, Deep Realms, Jerry Meng, Lone Striker, Derek Yates, Pyrater, Mesiah Bishop, James Bentley, Femi Adebogun, Brandon Frisco, SuperWojo, Alps Aficionado, Michael Dempsey, Vitor Caleffi, Will Dee, Edmond Seymore, usrbinkat, LangChain4j, Kacper Wikieł, Luke Pendergrass, John Detwiler, theTransient, Nathan LeClaire, Tiffany J. Kim, biorpg, Eugene Pentland, Stanislav Ovsiannikov, Fred von Graf, terasurfer, Kalila, Dan Guido, Nitin Borwankar, 阿明, Ai Maven, John Villwock, Gabriel Puliatti, Stephen Murray, Asp the Wyvern, danny, Chris Smitley, ReadyPlayerEmma, S_X, Daniel P. Andersen, Olakabola, Jeffrey Morgan, Imad Khwaja, Caitlyn Gatomon, webtim, Alicia Loh, Trenton Dambrowitz, Swaroop Kallakuri, Erik Bjäreholt, Leonard Tan, Spiking Neurons AB, Luke @flexchar, Ajan Kanaga, Thomas Belote, Deo Leter, RoA, Willem Michiel, transmissions 11, subjectnull, Matthew Berman, Joseph William Delisle, David Ziegler, Michael Davis, Johann-Peter Hartmann, Talal Aujan, senxiiz, Artur Olbinski, Rainer Wilmers, Spencer Kim, Fen Risland, Cap'n Zoog, Rishabh Srivastava, Michael Levine, Geoffrey Montalvo, Sean Connelly, Alexandros Triantafyllidis, Pieter, Gabriel Tamborski, Sam, Subspace Studios, Junyu Yang, Pedro Madruga, Vadim, Cory Kujawski, K, Raven Klaugh, Randy H, Mano Prime, Sebastain Graf, Space Cruiser
248
+
249
+
250
+ Thank you to all my generous patrons and donaters!
251
+
252
+ And thank you again to a16z for their generous grant.
253
+
254
+ <!-- footer end -->
255
+
256
+ # Original model card: Ziqing Yang's Chinese Llama 2 13B
257
+
258
+
259
+ # Chinese-LLaMA-2-13B
260
+
261
+ **This is the full Chinese-LLaMA-2-13B model,which can be loaded directly for inference and full-parameter training.**
262
+
263
+ **Related models👇**
264
+ * Long context base models
265
+ * [Chinese-LLaMA-2-7B-16K (full model)](https://huggingface.co/ziqingyang/chinese-llama-2-7b-16k)
266
+ * [Chinese-LLaMA-2-LoRA-7B-16K (LoRA model)](https://huggingface.co/ziqingyang/chinese-llama-2-lora-7b-16k)
267
+ * [Chinese-LLaMA-2-13B-16K (full model)](https://huggingface.co/ziqingyang/chinese-llama-2-13b-16k)
268
+ * [Chinese-LLaMA-2-LoRA-13B-16K (LoRA model)](https://huggingface.co/ziqingyang/chinese-llama-2-lora-13b-16k)
269
+ * Base models
270
+ * [Chinese-LLaMA-2-7B (full model)](https://huggingface.co/ziqingyang/chinese-llama-2-7b)
271
+ * [Chinese-LLaMA-2-LoRA-7B (LoRA model)](https://huggingface.co/ziqingyang/chinese-llama-2-lora-7b)
272
+ * [Chinese-LLaMA-2-13B (full model)](https://huggingface.co/ziqingyang/chinese-llama-2-13b)
273
+ * [Chinese-LLaMA-2-LoRA-13B (LoRA model)](https://huggingface.co/ziqingyang/chinese-llama-2-lora-13b)
274
+ * Instruction/Chat models
275
+ * [Chinese-Alpaca-2-7B (full model)](https://huggingface.co/ziqingyang/chinese-alpaca-2-7b)
276
+ * [Chinese-Alpaca-2-LoRA-7B (LoRA model)](https://huggingface.co/ziqingyang/chinese-alpaca-2-lora-7b)
277
+ * [Chinese-Alpaca-2-13B (full model)](https://huggingface.co/ziqingyang/chinese-alpaca-2-13b)
278
+ * [Chinese-Alpaca-2-LoRA-13B (LoRA model)](https://huggingface.co/ziqingyang/chinese-alpaca-2-lora-13b)
279
+
280
+ # Description of Chinese-LLaMA-Alpaca-2
281
+ This project is based on the Llama-2, released by Meta, and it is the second generation of the Chinese LLaMA & Alpaca LLM project. We open-source Chinese LLaMA-2 (foundation model) and Alpaca-2 (instruction-following model). These models have been expanded and optimized with Chinese vocabulary beyond the original Llama-2. We used large-scale Chinese data for incremental pre-training, which further improved the fundamental semantic understanding of the Chinese language, resulting in a significant performance improvement compared to the first-generation models. The relevant models support a 4K context and can be expanded up to 18K+ using the NTK method.
282
+
283
+ The main contents of this project include:
284
+
285
+ * 🚀 New extended Chinese vocabulary beyond Llama-2, open-sourcing the Chinese LLaMA-2 and Alpaca-2 LLMs.
286
+ * 🚀 Open-sourced the pre-training and instruction finetuning (SFT) scripts for further tuning on user's data
287
+ * 🚀 Quickly deploy and experience the quantized LLMs on CPU/GPU of personal PC
288
+ * 🚀 Support for LLaMA ecosystems like 🤗transformers, llama.cpp, text-generation-webui, LangChain, vLLM etc.
289
+
290
+ Please refer to [https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/](https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/) for details.