TheBloke commited on
Commit
ecfb868
1 Parent(s): 98ff6c4

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +140 -0
README.md ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - tiiuae/falcon-refinedweb
4
+ language:
5
+ - en
6
+ inference: false
7
+ ---
8
+
9
+ <div style="width: 100%;">
10
+ <img src="https://i.imgur.com/Kghdi6q.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 800px; display: block; margin: auto;">
11
+ </div>
12
+ <div style="display: flex; justify-content: space-between; width: 100%;">
13
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
14
+ <p style="margin-bottom: 0.1em;">For support & chat, join TheBloke's new Discord Server:</p>
15
+ <p><a href="https://discord.gg/UBgz4VXf">https://discord.gg/UBgz4VXf</a></p>
16
+ </div>
17
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
18
+ <p style="margin-bottom: 0.1em;">Want to contribute and get priority support? TheBloke AI's Patreon page</p>
19
+ <p><a href="https://www.patreon.com/TheBlokeAI">https://www.patreon.com/TheBlokeAI</a></p>
20
+ </div>
21
+ </div>
22
+
23
+ # Falcon-7B-Instruct GPTQ
24
+
25
+ This repo contains an experimantal GPTQ 4bit model for [Falcon-7B-Instruct](https://huggingface.co/tiiuae/falcon-7b-instruct).
26
+
27
+ It is the result of quantising to 4bit using [AutoGPTQ](https://github.com/PanQiWei/AutoGPTQ).
28
+
29
+ ## Need support? Want to discuss? I now have a Discord!
30
+
31
+ Join me at: https://discord.gg/UBgz4VXf
32
+
33
+ ## EXPERIMENTAL
34
+
35
+ Please note this is an experimental first model. Support for it is currently quite limited.
36
+
37
+ To use it you will require:
38
+
39
+ 1. AutoGPTQ, from the latest `main` branch and compiled with `pip install .`
40
+ 2. `pip install einops`
41
+
42
+ You can then use it immediately from Python code - see example code below
43
+
44
+ ## text-generation-webui
45
+
46
+ There is also provisional AutoGPTQ support in text-generation-webui.
47
+
48
+ However at the time I'm writing this, a commit is needed to text-generation-webui to enable it to load this model.
49
+
50
+ I have [opened a PR here](https://github.com/oobabooga/text-generation-webui/pull/2374); once this is merged, text-generation-webui will support this GPTQ model.
51
+
52
+ To get it working before the PR is merged, you will need to:
53
+ 1. Edit `text-generation-webui/modules/AutoGPTQ_loader.py`
54
+ 2. Make the following change:
55
+
56
+ Find the line that says:
57
+ ```
58
+ 'use_safetensors': use_safetensors,
59
+ ```
60
+
61
+ And after it, add:
62
+ ```
63
+ 'trust_remote_code': shared.args.trust_remote_code,
64
+ ```
65
+
66
+ [Once you are done the file should look like this](https://github.com/oobabooga/text-generation-webui/blob/473a57e35219c063d2fc230cfc7b5a118b448b38/modules/AutoGPTQ_loader.py#L33-L39)
67
+
68
+ 3. Then save and close the file, and launch text-generation-webui as described below
69
+
70
+ ## How to download and use this model in text-generation-webui
71
+
72
+ 1. Launch text-generation-webui with the following command-line arguments: `--autogptq --trust_remote_code`
73
+ 2. Click the **Model tab**.
74
+ 3. Under **Download custom model or LoRA**, enter `TheBloke/falcon-7B-instruct-GPTQ`.
75
+ 4. Click **Download**.
76
+ 5. Wait until it says it's finished downloading.
77
+ 6. Click the **Refresh** icon next to **Model** in the top left.
78
+ 7. In the **Model drop-down**: choose the model you just downloaded, `falcon-7B-instruct-GPTQ`.
79
+ 8. Once it says it's loaded, click the **Text Generation tab** and enter a prompt!
80
+
81
+ ## About `trust_remote_code`
82
+
83
+ Please be aware that this command line argument causes Python code provided by Falcon to be executed on your machine.
84
+
85
+ This code is required at the moment because Falcon is too new to be supported by Hugging Face transformers. At some point in the future transformers will support the model natively, and then `trust_remote_code` will no longer be needed.
86
+
87
+ In this repo you can see two `.py` files - these are the files that get executed. They are copied from the base repo at [Falcon-7B-Instruct](https://huggingface.co/tiiuae/falcon-7b-instruct).
88
+
89
+ ## Simple Python example code
90
+
91
+ To run this code you need to install AutoGPTQ from source:
92
+ ```
93
+ git clone https://github.com/PanQiWei/AutoGPTQ
94
+ cd AutoGPTQ
95
+ pip install . # This step requires CUDA toolkit installed
96
+ ```
97
+ And install einops:
98
+ ```
99
+ pip install einops
100
+ ```
101
+
102
+ You can then run this example code:
103
+ ```python
104
+ import torch
105
+ from transformers import AutoTokenizer
106
+ from auto_gptq import AutoGPTQForCausalLM
107
+
108
+ # Download the model from HF and store it locally, then reference its location here:
109
+ quantized_model_dir = "/path/to/falcon7b-instruct-gptq"
110
+
111
+ from transformers import AutoTokenizer
112
+ tokenizer = AutoTokenizer.from_pretrained(quantized_model_dir, use_fast=False)
113
+
114
+ model = AutoGPTQForCausalLM.from_quantized(quantized_model_dir, device="cuda:0", use_triton=False, use_safetensors=True, torch_dtype=torch.float32, trust_remote_code=True)
115
+
116
+ prompt = "Write a story about llamas"
117
+ prompt_template = f"### Instruction: {prompt}\n### Response:"
118
+
119
+ tokens = tokenizer(prompt_template, return_tensors="pt").to("cuda:0").input_ids
120
+ output = model.generate(input_ids=tokens, max_new_tokens=100, do_sample=True, temperature=0.8)
121
+ print(tokenizer.decode(output[0]))
122
+ ```
123
+
124
+ ## Provided files
125
+
126
+ **gptq_model-4bit-64g.safetensors**
127
+
128
+ This will work with AutoGPTQ as of commit `3cb1bf5` (`3cb1bf5a6d43a06dc34c6442287965d1838303d3`)
129
+
130
+ It was created with groupsize 64 to give higher inference quality, and without `desc_act` (act-order) to increase inference speed.
131
+
132
+ * `gptq_model-4bit-64g.safetensors`
133
+ * Works only with latest AutoGPTQ CUDA, compiled from source as of commit `3cb1bf5`
134
+ * At this time it does not work with AutoGPTQ Triton, but support will hopefully be added in time.
135
+ * Works with text-generation-webui using `--autogptq --trust_remote_code`
136
+ * At this time it does NOT work with one-click-installers
137
+ * Does not work with any version of GPTQ-for-LLaMa
138
+ * Parameters: Groupsize = 64. No act-order.
139
+
140
+ # ✨ Original model card: Falcon-40B-Instruct