Update README.md
Browse files
README.md
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
---
|
2 |
library_name: peft
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
4 |
-
## Training procedure
|
5 |
|
|
|
6 |
|
7 |
-
|
8 |
-
- load_in_8bit: False
|
9 |
-
- load_in_4bit: True
|
10 |
-
- llm_int8_threshold: 6.0
|
11 |
-
- llm_int8_skip_modules: None
|
12 |
-
- llm_int8_enable_fp32_cpu_offload: False
|
13 |
-
- llm_int8_has_fp16_weight: False
|
14 |
-
- bnb_4bit_quant_type: nf4
|
15 |
-
- bnb_4bit_use_double_quant: True
|
16 |
-
- bnb_4bit_compute_dtype: bfloat16
|
17 |
|
18 |
The following `bitsandbytes` quantization config was used during training:
|
|
|
19 |
- load_in_8bit: False
|
20 |
-
-
|
21 |
- llm_int8_threshold: 6.0
|
22 |
- llm_int8_skip_modules: None
|
23 |
- llm_int8_enable_fp32_cpu_offload: False
|
@@ -25,8 +25,66 @@ The following `bitsandbytes` quantization config was used during training:
|
|
25 |
- bnb_4bit_quant_type: nf4
|
26 |
- bnb_4bit_use_double_quant: True
|
27 |
- bnb_4bit_compute_dtype: bfloat16
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
### Framework versions
|
29 |
|
30 |
- PEFT 0.4.0.dev0
|
31 |
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
library_name: peft
|
3 |
+
license: apache-2.0
|
4 |
+
datasets:
|
5 |
+
- Abirate/english_quotes
|
6 |
+
language:
|
7 |
+
- en
|
8 |
+
pipeline_tag: text-generation
|
9 |
+
tags:
|
10 |
+
- text-generation-inference
|
11 |
---
|
|
|
12 |
|
13 |
+
# hipnologo/GPT-Neox-20b-QLoRA-FineTune-english_quotes_dataset
|
14 |
|
15 |
+
## Training procedure
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
The following `bitsandbytes` quantization config was used during training:
|
18 |
+
|
19 |
- load_in_8bit: False
|
20 |
+
- load_in-4bit: True
|
21 |
- llm_int8_threshold: 6.0
|
22 |
- llm_int8_skip_modules: None
|
23 |
- llm_int8_enable_fp32_cpu_offload: False
|
|
|
25 |
- bnb_4bit_quant_type: nf4
|
26 |
- bnb_4bit_use_double_quant: True
|
27 |
- bnb_4bit_compute_dtype: bfloat16
|
28 |
+
|
29 |
+
## Model description
|
30 |
+
|
31 |
+
This model is a fine-tuned version of the `EleutherAI/gpt-neox-20b` model using the QLoRa library and the PEFT library.
|
32 |
+
|
33 |
+
#### How to use
|
34 |
+
|
35 |
+
The code below performs the following steps:
|
36 |
+
|
37 |
+
1. Imports the necessary libraries: `torch` and classes from the `transformers` library.
|
38 |
+
2. Specifies the `model_id` as "hipnologo/GPT-Neox-20b-QLoRA-FineTune-english_quotes_dataset".
|
39 |
+
3. Defines a `BitsAndBytesConfig` object named `bnb_config` with the following configuration:
|
40 |
+
- `load_in_4bit` set to `True`
|
41 |
+
- `bnb_4bit_use_double_quant` set to `True`
|
42 |
+
- `bnb_4bit_quant_type` set to "nf4"
|
43 |
+
- `bnb_4bit_compute_dtype` set to `torch.bfloat16`
|
44 |
+
4. Initializes an `AutoTokenizer` object named `tokenizer` by loading the tokenizer for the specified `model_id`.
|
45 |
+
5. Initializes an `AutoModelForCausalLM` object named `model` by loading the pre-trained model for the specified `model_id` and providing the `quantization_config` as `bnb_config`. The model is loaded on device `cuda:0`.
|
46 |
+
6. Defines a variable `text` with the value "Twenty years from now".
|
47 |
+
7. Defines a variable `device` with the value "cuda:0", representing the device on which the model will be executed.
|
48 |
+
8. Encodes the `text` using the `tokenizer` and converts it to a PyTorch tensor, assigning it to the `inputs` variable. The tensor is moved to the specified `device`.
|
49 |
+
9. Generates text using the `model.generate` method by passing the `inputs` tensor and setting the `max_new_tokens` parameter to 20. The generated output is assigned to the `outputs` variable.
|
50 |
+
10. Decodes the `outputs` tensor using the `tokenizer` to obtain the generated text without special tokens, and assigns it to the `generated_text` variable.
|
51 |
+
11. Prints the `generated_text`.
|
52 |
+
|
53 |
+
```python
|
54 |
+
import torch
|
55 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
56 |
+
|
57 |
+
model_id = "hipnologo/GPT-Neox-20b-QLoRA-FineTune-english_quotes_dataset"
|
58 |
+
bnb_config = BitsAndBytesConfig(
|
59 |
+
load_in_4bit=True,
|
60 |
+
bnb_4bit_use_double_quant=True,
|
61 |
+
bnb_4bit_quant_type="nf4",
|
62 |
+
bnb_4bit_compute_dtype=torch.bfloat16
|
63 |
+
)
|
64 |
+
|
65 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
66 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=bnb_config, device_map={"":0})
|
67 |
+
|
68 |
+
text = "Twenty years from now"
|
69 |
+
device = "cuda:0"
|
70 |
+
inputs = tokenizer(text, return_tensors="pt").to(device)
|
71 |
+
|
72 |
+
outputs = model.generate(**inputs, max_new_tokens=20)
|
73 |
+
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
74 |
+
print(generated_text)
|
75 |
+
```
|
76 |
+
|
77 |
### Framework versions
|
78 |
|
79 |
- PEFT 0.4.0.dev0
|
80 |
|
81 |
+
## Training procedure
|
82 |
+
|
83 |
+
- Trainable params: 8650752
|
84 |
+
- all params: 10597552128
|
85 |
+
- trainable%: 0.08162971878329976
|
86 |
+
|
87 |
+
|
88 |
+
## License
|
89 |
+
|
90 |
+
This model is licensed under Apache 2.0. Please see the [LICENSE](https://www.apache.org/licenses/LICENSE-2.0) for more information.
|