Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- zh
|
5 |
+
- en
|
6 |
+
pipeline_tag: question-answering
|
7 |
+
tags:
|
8 |
+
- not-for-all-audiences
|
9 |
+
---
|
10 |
+
|
11 |
+
# Chinese-Alpaca-Plus-13B-GPTQ
|
12 |
+
|
13 |
+
This is GPTQ format quantised 4bit models of [Yiming Cui's Chinese-LLaMA-Alpaca 13B](https://github.com/ymcui/Chinese-LLaMA-Alpaca).
|
14 |
+
|
15 |
+
It is the result of quantising to 4bit using [GPTQ-for-LLaMa](https://github.com/qwopqwop200/GPTQ-for-LLaMa).
|
16 |
+
|
17 |
+
## Model Details
|
18 |
+
|
19 |
+
### Model Description
|
20 |
+
|
21 |
+
- **Developed by:** [ymcui (Yiming Cui)](https://github.com/ymcui)
|
22 |
+
- **Shared by:** Known Rabbit
|
23 |
+
- **Language(s) (NLP):** Chinese, English
|
24 |
+
- **License:** Apache 2.0
|
25 |
+
- **Finetuned from model:** LLaMA
|
26 |
+
|
27 |
+
The original Github project: [ymcui/Chinese-LLaMA-Alpaca: 中文LLaMA&Alpaca大语言模型+本地CPU/GPU部署 (Chinese LLaMA & Alpaca LLMs)](https://github.com/ymcui/Chinese-LLaMA-Alpaca)
|
28 |
+
|
29 |
+
> In order to promote the open research of large models in the Chinese NLP community, this project open sourced the Chinese LLaMA model and the Alpaca large model with fine-tuned instructions. Based on the original LLaMA, these models expand the Chinese vocabulary and use Chinese data for secondary pre-training, which further improves the basic semantic understanding of Chinese. At the same time, the Chinese Alpaca model further uses Chinese instruction data for fine-tuning, which significantly improves the model's ability to understand and execute instructions. For details, please refer to the technical report (Cui, Yang, and Yao, 2023).
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
### Model Sources
|
34 |
+
|
35 |
+
<!-- Provide the basic links for the model. -->
|
36 |
+
|
37 |
+
- **Repository:** https://github.com/ymcui/Chinese-LLaMA-Alpaca
|
38 |
+
- **Paper:** [[2304.08177] Efficient and Effective Text Encoding for Chinese LLaMA and Alpaca](https://arxiv.org/abs/2304.08177)
|
39 |
+
|
40 |
+
## Uses
|
41 |
+
|
42 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
43 |
+
|
44 |
+
### Direct Use
|
45 |
+
|
46 |
+
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
47 |
+
|
48 |
+
#### How to easily download and use this model in text-generation-webui
|
49 |
+
|
50 |
+
Open the text-generation-webui UI as normal.
|
51 |
+
|
52 |
+
1. Click the **Model tab**.
|
53 |
+
2. Under **Download custom model or LoRA**, enter `rabitt/Chinese-Alpaca-Plus-13B-GPTQ`.
|
54 |
+
3. Click **Download**.
|
55 |
+
4. Wait until it says it's finished downloading.
|
56 |
+
5. Click the **Refresh** icon next to **Model** in the top left.
|
57 |
+
6. In the **Model drop-down**: choose the model you just downloaded, `Chinese-Alpaca-Plus-13B-GPTQ`.
|
58 |
+
7. If you see an error in the bottom right, ignore it - it's temporary.
|
59 |
+
8. Fill out the `GPTQ parameters` on the right: `Bits = 4`, `Groupsize = 128`, `model_type = Llama`
|
60 |
+
9. Click **Save settings for this model** in the top right.
|
61 |
+
10. Click **Reload the Model** in the top right.
|
62 |
+
11. Once it says it's loaded, click the **Text Generation tab** and enter a prompt!
|
63 |
+
|
64 |
+
|
65 |
+
|
66 |
+
## Training Details
|
67 |
+
|
68 |
+
### Training Procedure
|
69 |
+
|
70 |
+
1. Download models from the following links
|
71 |
+
|
72 |
+
* Original LLaMA: https://github.com/facebookresearch/llama/pull/73
|
73 |
+
* Chinese-LLaMA-Plus-13B
|
74 |
+
|
75 |
+
* [ziqingyang/chinese-llama-plus-lora-13b · Hugging Face](https://huggingface.co/ziqingyang/chinese-llama-plus-lora-13b)
|
76 |
+
* [chinese_llama_plus_lora_13b.zip_免费高速下载|百度网盘-分享无限制](https://pan.baidu.com/s/1VGpNlrLx5zHuNzLOcTG-xw?pwd=8cvd)
|
77 |
+
* Chinese-Alpaca-Plus-13B
|
78 |
+
|
79 |
+
* [ziqingyang/chinese-alpaca-plus-lora-13b · Hugging Face](https://huggingface.co/ziqingyang/chinese-alpaca-plus-lora-13b)
|
80 |
+
* [chinese_alpaca_plus_lora_13b.zip_免费高速下载|百度网盘-分享无限制](https://pan.baidu.com/s/1Mew4EjBlejWBBB6_WW6vig?pwd=mf5w)
|
81 |
+
2. Convert LLaMA to HuggingFace (HF) format with `convert_llama_weights_to_hf.py`
|
82 |
+
|
83 |
+
```bash
|
84 |
+
wget https://github.com/huggingface/transformers/raw/main/src/transformers/models/llama/convert_llama_weights_to_hf.py
|
85 |
+
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python \
|
86 |
+
python convert_llama_weights_to_hf.py \
|
87 |
+
--input_dir ./llama \
|
88 |
+
--model_size 13B \
|
89 |
+
--output_dir ./llama-13b-hf
|
90 |
+
```
|
91 |
+
3. Merge `Chinese-LLaMA-Plus-13B` and `Chinese-Alpaca-Plus-13B` into LLaMA with `merge_llama_with_chinese_lora.py`
|
92 |
+
|
93 |
+
```bash
|
94 |
+
wget https://github.com/ymcui/Chinese-LLaMA-Alpaca/raw/main/scripts/merge_llama_with_chinese_lora.py
|
95 |
+
python merge_llama_with_chinese_lora.py \
|
96 |
+
--base_model ./llama-13b-hf \
|
97 |
+
--lora_model ./Chinese-LLaMA-Plus-LoRA-13B,./Chinese-Alpaca-Plus-LoRA-13B \
|
98 |
+
--output_type huggingface \
|
99 |
+
--output_dir ./Chinese-Alpaca-Plus-13B
|
100 |
+
```
|
101 |
+
4. Quantise the model with `GPTQ-for-LLaMa`
|
102 |
+
|
103 |
+
```bash
|
104 |
+
mkdir -p Chinese-Alpaca-Plus-13B-GPTQ
|
105 |
+
git clone https://github.com/qwopqwop200/GPTQ-for-LLaMa.git
|
106 |
+
cd GPTQ-for-LLaMa
|
107 |
+
# export CUDA_VISIBLE_DEVICES=0
|
108 |
+
python llama.py ../Chinese-Alpaca-Plus-13B c4 --wbits 4 --true-sequential --act-order --groupsize 128 --save_safetensors ../Chinese-Alpaca-Plus-13B-GPTQ/Chinese-Alpaca-Plus-13B-GPTQ-4bit-128g.safetensors
|
109 |
+
```
|
110 |
+
|
111 |
+
## Citation
|
112 |
+
|
113 |
+
**BibTeX:**
|
114 |
+
|
115 |
+
```tex
|
116 |
+
@article{chinese-llama-alpaca,
|
117 |
+
title={Efficient and Effective Text Encoding for Chinese LLaMA and Alpaca},
|
118 |
+
author={Cui, Yiming and Yang, Ziqing and Yao, Xin},
|
119 |
+
journal={arXiv preprint arXiv:2304.08177},
|
120 |
+
url={https://arxiv.org/abs/2304.08177},
|
121 |
+
year={2023}
|
122 |
+
}
|
123 |
+
```
|