Initial GPTQ model commit.
Browse files- README.md +183 -0
- config.json +24 -0
- generation_config.json +7 -0
- gpt4-alpaca-lora_mlp-65B-GPTQ-4bit.safetensors +3 -0
- quantize_config.json +5 -0
- special_tokens_map.json +23 -0
- tokenizer.json +0 -0
- tokenizer.model +3 -0
- tokenizer_config.json +33 -0
README.md
CHANGED
@@ -1,3 +1,186 @@
|
|
1 |
---
|
2 |
license: other
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: other
|
3 |
+
datasets:
|
4 |
+
- c-s-ale/alpaca-gpt4-data
|
5 |
+
pipeline_tag: text2text-generation
|
6 |
---
|
7 |
+
|
8 |
+
## GPT4-Alpaca-LoRA_MLP-65B GPTQ
|
9 |
+
|
10 |
+
These files are the result of merging the [LoRA weights of chtan's gpt4-alpaca-lora_mlp-65B](https://huggingface.co/chtan/gpt4-alpaca-lora_mlp-65b) with the original Llama 65B model.
|
11 |
+
|
12 |
+
It is the result of quantising to 4bit using [GPTQ-for-LLaMa](https://github.com/qwopqwop200/GPTQ-for-LLaMa).
|
13 |
+
|
14 |
+
## Repositories available
|
15 |
+
|
16 |
+
* [4bit GPTQ models for GPU inference](https://huggingface.co/TheBloke/gpt4-alpaca-lora_mlp-65B-GPTQ)
|
17 |
+
* [4bit and 5bit GGML models for CPU inference in llama.cpp](https://huggingface.co/TheBloke/gpt4-alpaca-lora_mlp-65B-GGML)
|
18 |
+
* [float16 unquantised model for GPU inference and further conversions](https://huggingface.co/TheBloke/gpt4-alpaca-lora_mlp-65B-HF)
|
19 |
+
|
20 |
+
## VRAM
|
21 |
+
|
22 |
+
I tested this model with 2 x 24GB 4090 GPUs, and it was able to return 1500 tokens before one card went OOM.
|
23 |
+
|
24 |
+
So you may need to preload a few layers on to CPU RAM, or else run on a system with more than 48GB VRAM.
|
25 |
+
|
26 |
+
Or, if you can limit responses to <1500 tokens (eg for single prompts rather than chats), you should be fine with 48GB VRAM.
|
27 |
+
|
28 |
+
## How to easily download and use this model in text-generation-webui
|
29 |
+
|
30 |
+
Open the text-generation-webui UI as normal.
|
31 |
+
|
32 |
+
1. Click the **Model tab**.
|
33 |
+
2. Under **Download custom model or LoRA**, enter `TheBloke/gpt4-alpaca-lora_mlp-65B-GPTQ`.
|
34 |
+
3. Click **Download**.
|
35 |
+
4. Wait until it says it's finished downloading.
|
36 |
+
5. Click the **Refresh** icon next to **Model** in the top left.
|
37 |
+
6. In the **Model drop-down**: choose the model you just downloaded, `gpt4-alpaca-lora_mlp-65B-GPTQ`.
|
38 |
+
7. If you see an error in the bottom right, ignore it - it's temporary.
|
39 |
+
8. Fill out the `GPTQ parameters` on the right: `Bits = 4`, `Groupsize = None`, `model_type = Llama`
|
40 |
+
9. Click **Save settings for this model** in the top right.
|
41 |
+
10. Click **Reload the Model** in the top right.
|
42 |
+
11. Once it says it's loaded, click the **Text Generation tab** and enter a prompt!
|
43 |
+
|
44 |
+
## Provided files
|
45 |
+
|
46 |
+
**`gpt4-alpaca-lora_mlp-65B-GPTQ-4bit.safetensors`**
|
47 |
+
|
48 |
+
You will need at least 48GB VRAM to use this model, either on one GPU or multiple.
|
49 |
+
|
50 |
+
This will work with all versions of GPTQ-for-LLaMa. It has maximum compatibility.
|
51 |
+
|
52 |
+
It was created with `--act-order` to increase quantisation quality, but without groupsize so as to reduce VRAM requirements.
|
53 |
+
|
54 |
+
* `gpt4-alpaca-lora_mlp-65B-GPTQ-4bit.safetensors`
|
55 |
+
* Works with all versions of GPTQ-for-LLaMa code, both Triton and CUDA branches
|
56 |
+
* Works with text-generation-webui one-click-installers
|
57 |
+
* Parameters: Groupsize = None. act-order.
|
58 |
+
* Command used to create the GPTQ:
|
59 |
+
```
|
60 |
+
python llama.py gpt4-alpaca-lora_mlp-65B/HF/ c4 --wbits 4 --true-sequential --act-order --save_safetensors gpt4-alpaca-lora_mlp-65B/gptq/gpt4-alpaca-lora_mlp-65B-GPTQ-4bit.safetensors
|
61 |
+
```
|
62 |
+
|
63 |
+
# Original model card
|
64 |
+
|
65 |
+
This repo provides the training checkpoint of LLaMA on the alpaca_data_gpt4 dataset via LoRA [MLP] on 8xA100(80G).
|
66 |
+
|
67 |
+
He et al. 2022 gave an insight that FFN can better utilize modification at larger capacities.
|
68 |
+
|
69 |
+
The codes is provided by [tloen/alpaca-lora: Instruct-tune LLaMA on consumer hardware (github.com)](https://github.com/tloen/alpaca-lora).
|
70 |
+
|
71 |
+
We modify the running scripts to
|
72 |
+
```bash
|
73 |
+
torchrun --nproc_per_node=8 finetune.py \
|
74 |
+
--base_model '/cache1/chtan/large_models/llama-hf/llama-65b' \
|
75 |
+
--data_path './alpaca_data_gpt4.json' \
|
76 |
+
--output_dir './gpt4-alpaca-lora_mlp-65b' \
|
77 |
+
--batch_size 128 \
|
78 |
+
--micro_batch_size 2 \
|
79 |
+
--num_epochs 10 \
|
80 |
+
--learning_rate 1e-4 \
|
81 |
+
--cutoff_len 512 \
|
82 |
+
--val_set_size 2000 \
|
83 |
+
--lora_r 16 \
|
84 |
+
--lora_alpha 16 \
|
85 |
+
--lora_dropout 0.05 \
|
86 |
+
--lora_target_modules '[gate_proj,down_proj,up_proj]' \
|
87 |
+
--train_on_inputs \
|
88 |
+
--group_by_length
|
89 |
+
```
|
90 |
+
|
91 |
+
### Examples
|
92 |
+
|
93 |
+
**Instruction**: Tell me about alpacas.
|
94 |
+
|
95 |
+
**gpt4-alpaca-lora_mlp-65b**:
|
96 |
+
|
97 |
+
Alpacas are small, domesticated mammals that are closely related to llamas. They are native to the Andes Mountains of South America, primarily in Peru, Bolivia, and Chile. These animals have been domesticated for thousands of years and were used by the Incas for their fleece, meat, and as pack animals.
|
98 |
+
|
99 |
+
Alpacas are known for their soft and warm fleece, which comes in over 22 natural colors. Their fleece is highly valued and is used in the textile industry to make clothing and other products. Alpacas are also known for their friendly and gentle nature, making them popular pets and great additions to farms.
|
100 |
+
|
101 |
+
These animals are social and live in herds, typically with one dominant male. They communicate through a series of hums, clucks, and other vocalizations. Alpacas are also known for their distinctive "humming" sound, which they make when they are content or curious.
|
102 |
+
|
103 |
+
In terms of physical appearance, alpacas have a small, stocky build, with an average height of around 36 inches at the withers. They have large, expressive eyes, and their ears are perked forward. Alpacas are herbivores and primarily eat grasses and other vegetation. They are also known for their efficient digestive system, which allows them to thrive on a diet of low-quality forage.
|
104 |
+
|
105 |
+
Overall, alpacas are unique and fascinating animals that have been an important part of Andean culture for centuries. They continue to be valued for their fleece, meat, and as pets, and their popularity continues to grow around the world.
|
106 |
+
|
107 |
+
**Alpaca-LoRA**: Alpacas are members of the camelid family and are native to the Andes Mountains of South America. They are known for their soft, luxurious fleece, which is used to make clothing, blankets, and other items. Alpacas are herbivores and graze on grasses and other plants. They are social animals and live in herds of up to 20 individuals.
|
108 |
+
|
109 |
+
**Stanford Alpaca**: Alpacas are small, fluffy animals related to camels and llamas. They are native to Peru and Bolivia, and were first domesticated around 5,000 years ago. They are kept mainly for their fine, soft fleece, which is used to make knitwear and other garments. Alpacas are herd animals and live in small family groups, led by an older male. They are highly social animals and can form strong bonds with their owners.
|
110 |
+
|
111 |
+
**text-davinci-003**: Alpacas are a domesticated species of South American camelid, similar to llamas. They are native to the Andes Mountains in South America and are kept as livestock for their soft, luxurious wool. Alpacas are social animals and live in herds of up to 20 individuals. They are typically kept in small herds of two to five animals, and are relatively easy to care for. Alpacas are herbivores and feed on grass, hay, and other vegetation. They are also known for their gentle and friendly nature, making them popular as pets.
|
112 |
+
|
113 |
+
---
|
114 |
+
|
115 |
+
**Instruction**: Write a Python program that prints the first 10 Fibonacci numbers.
|
116 |
+
|
117 |
+
**gpt4-alpaca-lora_mlp-65b**:
|
118 |
+
|
119 |
+
Here is a Python program that prints the first 10 Fibonacci numbers:
|
120 |
+
|
121 |
+
```python
|
122 |
+
# initialize variables
|
123 |
+
a = 0
|
124 |
+
b = 1
|
125 |
+
|
126 |
+
# loop to print the first 10 Fibonacci numbers
|
127 |
+
for i in range(10):
|
128 |
+
print(a, end=" ")
|
129 |
+
a, b = b, a + b
|
130 |
+
```
|
131 |
+
|
132 |
+
In this program, we initialize two variables `a` and `b` with the first two Fibonacci numbers, which are 0 and 1. Then, we use a for loop to iterate 10 times. In each iteration, we print the current value of `a` and update the values of `a` and `b` using the formula `a = b` and `b = a + b`. This formula is the definition of the Fibonacci sequence.
|
133 |
+
|
134 |
+
**Alpaca-LoRA**:
|
135 |
+
|
136 |
+
```python
|
137 |
+
def fibonacci(n):
|
138 |
+
if n == 0:
|
139 |
+
return 0
|
140 |
+
elif n == 1:
|
141 |
+
return 1
|
142 |
+
else:
|
143 |
+
return fibonacci(n-1) + fibonacci(n-2)
|
144 |
+
|
145 |
+
print(fibonacci(10))
|
146 |
+
```
|
147 |
+
|
148 |
+
**Stanford Alpaca**:
|
149 |
+
|
150 |
+
```python
|
151 |
+
numbers = [0, 1]
|
152 |
+
|
153 |
+
for i in range(2, 11):
|
154 |
+
numbers.append(numbers[i-2] + numbers[i-1])
|
155 |
+
|
156 |
+
print(numbers)
|
157 |
+
# Output: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
|
158 |
+
```
|
159 |
+
|
160 |
+
**text-davinci-003**:
|
161 |
+
|
162 |
+
```python
|
163 |
+
# Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and characterized by the fact that every number after the first two is the sum of the two preceding ones.
|
164 |
+
|
165 |
+
# Fibonacci sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ...
|
166 |
+
|
167 |
+
# Program:
|
168 |
+
|
169 |
+
# Initialize the first two numbers of the Fibonacci sequence
|
170 |
+
a = 0
|
171 |
+
b = 1
|
172 |
+
|
173 |
+
# Print the first 10 numbers of the Fibonacci sequence
|
174 |
+
print(a)
|
175 |
+
print(b)
|
176 |
+
|
177 |
+
for i in range(2,10):
|
178 |
+
c = a + b
|
179 |
+
a = b
|
180 |
+
b = c
|
181 |
+
print(c)
|
182 |
+
```
|
183 |
+
|
184 |
+
---
|
185 |
+
|
186 |
+
> [1] Junxian He, Chunting Zhou, Xuezhe Ma, Taylor Berg-Kirkpatrick, Graham Neubig: Towards a Unified View of Parameter-Efficient Transfer Learning. ICLR 2022
|
config.json
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "/workspace/models/huggyllama_llama-65b",
|
3 |
+
"architectures": [
|
4 |
+
"LlamaForCausalLM"
|
5 |
+
],
|
6 |
+
"bos_token_id": 1,
|
7 |
+
"eos_token_id": 2,
|
8 |
+
"hidden_act": "silu",
|
9 |
+
"hidden_size": 8192,
|
10 |
+
"initializer_range": 0.02,
|
11 |
+
"intermediate_size": 22016,
|
12 |
+
"max_position_embeddings": 2048,
|
13 |
+
"max_sequence_length": 2048,
|
14 |
+
"model_type": "llama",
|
15 |
+
"num_attention_heads": 64,
|
16 |
+
"num_hidden_layers": 80,
|
17 |
+
"pad_token_id": 0,
|
18 |
+
"rms_norm_eps": 1e-05,
|
19 |
+
"tie_word_embeddings": false,
|
20 |
+
"torch_dtype": "float16",
|
21 |
+
"transformers_version": "4.28.1",
|
22 |
+
"use_cache": true,
|
23 |
+
"vocab_size": 32000
|
24 |
+
}
|
generation_config.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"bos_token_id": 1,
|
4 |
+
"eos_token_id": 2,
|
5 |
+
"pad_token_id": 0,
|
6 |
+
"transformers_version": "4.28.1"
|
7 |
+
}
|
gpt4-alpaca-lora_mlp-65B-GPTQ-4bit.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:072e471cd025a2e9d804481375550567afe07d82307e955c7bce40da4a5f458b
|
3 |
+
size 33489332352
|
quantize_config.json
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bits": 4,
|
3 |
+
"desc_act": true,
|
4 |
+
"group_size": -1
|
5 |
+
}
|
special_tokens_map.json
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"bos_token": {
|
3 |
+
"content": "<s>",
|
4 |
+
"lstrip": false,
|
5 |
+
"normalized": true,
|
6 |
+
"rstrip": false,
|
7 |
+
"single_word": false
|
8 |
+
},
|
9 |
+
"eos_token": {
|
10 |
+
"content": "</s>",
|
11 |
+
"lstrip": false,
|
12 |
+
"normalized": true,
|
13 |
+
"rstrip": false,
|
14 |
+
"single_word": false
|
15 |
+
},
|
16 |
+
"unk_token": {
|
17 |
+
"content": "<unk>",
|
18 |
+
"lstrip": false,
|
19 |
+
"normalized": true,
|
20 |
+
"rstrip": false,
|
21 |
+
"single_word": false
|
22 |
+
}
|
23 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9e556afd44213b6bd1be2b850ebbbd98f5481437a8021afaf58ee7fb1818d347
|
3 |
+
size 499723
|
tokenizer_config.json
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_bos_token": true,
|
3 |
+
"add_eos_token": false,
|
4 |
+
"bos_token": {
|
5 |
+
"__type": "AddedToken",
|
6 |
+
"content": "<s>",
|
7 |
+
"lstrip": false,
|
8 |
+
"normalized": true,
|
9 |
+
"rstrip": false,
|
10 |
+
"single_word": false
|
11 |
+
},
|
12 |
+
"clean_up_tokenization_spaces": false,
|
13 |
+
"eos_token": {
|
14 |
+
"__type": "AddedToken",
|
15 |
+
"content": "</s>",
|
16 |
+
"lstrip": false,
|
17 |
+
"normalized": true,
|
18 |
+
"rstrip": false,
|
19 |
+
"single_word": false
|
20 |
+
},
|
21 |
+
"model_max_length": 2048,
|
22 |
+
"pad_token": null,
|
23 |
+
"sp_model_kwargs": {},
|
24 |
+
"tokenizer_class": "LlamaTokenizer",
|
25 |
+
"unk_token": {
|
26 |
+
"__type": "AddedToken",
|
27 |
+
"content": "<unk>",
|
28 |
+
"lstrip": false,
|
29 |
+
"normalized": true,
|
30 |
+
"rstrip": false,
|
31 |
+
"single_word": false
|
32 |
+
}
|
33 |
+
}
|