TheBloke commited on
Commit
8a43cdd
·
1 Parent(s): 0e53cd3

Upload new GPTQs with varied parameters

Browse files
Files changed (1) hide show
  1. README.md +258 -89
README.md CHANGED
@@ -1,14 +1,16 @@
1
  ---
2
- license: other
3
  inference: false
 
 
4
  ---
 
5
  <!-- header start -->
6
  <div style="width: 100%;">
7
  <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
8
  </div>
9
  <div style="display: flex; justify-content: space-between; width: 100%;">
10
  <div style="display: flex; flex-direction: column; align-items: flex-start;">
11
- <p><a href="https://discord.gg/Jq4vkcDakD">Chat & support: my new Discord server</a></p>
12
  </div>
13
  <div style="display: flex; flex-direction: column; align-items: flex-end;">
14
  <p><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
@@ -18,129 +20,149 @@ inference: false
18
 
19
  # OpenAssistant LLaMA 30B SFT 7 GPTQ
20
 
21
- This in a repo of GPTQ format 4bit quantised models for [OpenAssistant's LLaMA 30B SFT 7](https://huggingface.co/OpenAssistant/oasst-sft-7-llama-30b-xor).
22
 
23
- It is the result of merging the XORs from the above repo with the original Llama 30B weights, and then quantising to 4bit GPU inference using [GPTQ-for-LLaMa](https://github.com/qwopqwop200/GPTQ-for-LLaMa).
24
 
25
- This is epoch 7 of OpenAssistant's training of their Llama 30B model.
26
-
27
- **Please note that these models will need 24GB VRAM or greater to use effectively**
28
 
29
  ## Repositories available
30
 
31
- * [4bit GPTQ models for GPU inference](https://huggingface.co/TheBloke/OpenAssistant-SFT-7-Llama-30B-GPTQ).
32
- * [4bit and 5bit GGML models for CPU inference](https://huggingface.co/TheBloke/OpenAssistant-SFT-7-Llama-30B-GGML).
33
- * [Unquantised 16bit model in HF format](https://huggingface.co/TheBloke/OpenAssistant-SFT-7-Llama-30B-HF).
34
-
35
- ## PROMPT TEMPLATE
36
 
37
- This model requires the following prompt template:
38
 
39
  ```
40
- <|prompter|> prompt goes here
41
- <|assistant|>:
42
  ```
43
 
44
- ## CHOICE OF MODELS
45
-
46
- Three sets of models are provided:
47
 
48
- * Groupsize = None
49
- * Should work reliably in 24GB VRAM
50
- * Uses --act-order for the best possible inference quality given its lack of group_size.
51
- * Groupsize = 1024
52
- * Theoretically higher inference accuracy
53
- * May OOM on long context lengths in 24GB VRAM
54
- * Groupsize = 128
55
- * Optimal setting for highest inference quality
56
- * Will definitely need more than 24GB VRAM on longer context lengths (1000-1500+ tokens returned)
57
 
58
- For the 128g and 1024g models, two versions are available:
59
- * `compat.no-act-order.safetensor`
60
- * Works with all versions of GPTQ-for-LLaMa, including the version in text-generation-webui one-click-installers
61
- * `latest.act-order.safetensors`
62
- * uses `--act-order` for higher inference quality
63
- * requires more recent GPTQ-for-LLaMa code, therefore will not currently work with one-click-installers
64
 
65
- ## HOW TO CHOOSE YOUR MODEL
 
 
 
 
 
 
 
 
 
66
 
67
- I have used branches to separate the models. This means you can clone the branch you want and not got model files you don't need.
68
 
69
- If you have 24GB VRAM you are strongly recommended to use the file in `main`, with group_size = None. This is fully compatible, and won't OOM.
70
-
71
- * Branch: **main** = groupsize None, `OpenAssistant-SFT-7-Llama-30B-GPTQ-4bit.safetensors` file
72
- * Branch: **1024-compat** = groupsize 1024, `compat.no-act-order.safetensors` file
73
- * Branch: **1024-latest** = groupsize 1024, `latest.act-order.safetensors` file
74
- * Branch: **128-compat** = groupsize 128, `compat.no-act-order.safetensors` file
75
- * Branch: **128-latest** = groupsize 128, `latest.act-order.safetensors` file
76
 
77
- ![branches](https://i.imgur.com/PdiHnLxm.png)
78
 
79
- ## How to easily download and run the 1024g compat model in text-generation-webui
80
 
81
- Open the text-generation-webui UI as normal.
82
 
83
  1. Click the **Model tab**.
84
  2. Under **Download custom model or LoRA**, enter `TheBloke/OpenAssistant-SFT-7-Llama-30B-GPTQ`.
 
 
85
  3. Click **Download**.
86
- 4. Wait until it says it's finished downloading.
87
- 5. Click the **Refresh** icon next to **Model** in the top left.
88
- 6. In the **Model drop-down**: choose the model you just downloaded, `OpenAssistant-SFT-7-Llama-30B-GPTQ`.
89
- 7. If you see an error in the bottom right, ignore it - it's temporary.
90
- 8. Fill out the `GPTQ parameters` on the right: `Bits = 4`, `Groupsize = None`, `model_type = Llama`
91
- 9. Click **Save settings for this model** in the top right.
92
- 10. Click **Reload the Model** in the top right.
93
- 11. Once it says it's loaded, click the **Text Generation tab** and enter a prompt!
94
 
95
- ## Manual instructions for `text-generation-webui`
96
 
97
- The `compat.no-act-order.safetensors` files can be loaded the same as any other GPTQ file, without requiring any updates to [oobaboogas text-generation-webui](https://github.com/oobabooga/text-generation-webui).
98
 
99
- [Instructions on using GPTQ 4bit files in text-generation-webui are here](https://github.com/oobabooga/text-generation-webui/wiki/GPTQ-models-\(4-bit-mode\)).
100
 
101
- The `latest.act-order.safetensors` files were created using `--act-order` to give the maximum possible quantisation quality, but this means it requires that the latest GPTQ-for-LLaMa is used inside the UI.
102
 
103
- If you want to use the act-order `safetensors` files and need to update the Triton branch of GPTQ-for-LLaMa, here are the commands I used to clone the Triton branch of GPTQ-for-LLaMa, clone text-generation-webui, and install GPTQ into the UI:
104
- ```
105
- # Clone text-generation-webui, if you don't already have it
106
- git clone https://github.com/oobabooga/text-generation-webui
107
- # Make a repositories directory
108
- mkdir text-generation-webui/repositories
109
- cd text-generation-webui/repositories
110
- # Clone the latest GPTQ-for-LLaMa code inside text-generation-webui
111
- git clone https://github.com/qwopqwop200/GPTQ-for-LLaMa
112
- ```
113
 
114
- Then install this model into `text-generation-webui/models` and launch the UI as follows:
115
- ```
116
- cd text-generation-webui
117
- python server.py --model OpenAssistant-SFT-7-Llama-30B-GPTQ --wbits 4 --groupsize 128 --model_type Llama # add any other command line args you want
118
- ```
119
 
120
- To update the CUDA branch of GPTQ-for-LLaMa, you can do the following. **This requires a C/C++ compiler and the CUDA toolkit installed!**
121
- ```
122
- # Clone text-generation-webui, if you don't already have it
123
- git clone https://github.com/oobabooga/text-generation-webui
124
- # Make a repositories directory
125
- mkdir text-generation-webui/repositories
126
- cd text-generation-webui/repositories
127
- # Clone the latest GPTQ-for-LLaMa code inside text-generation-webui
128
- git clone -b cuda https://github.com/qwopqwop200/GPTQ-for-LLaMa
129
- cd GPTQ-for-LLaMa
130
- pip uninstall quant-cuda # uninstall existing CUDA version
131
- python setup_cuda.py install # install latest version
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  ```
133
 
134
- The above commands assume you have installed all dependencies for GPTQ-for-LLaMa and text-generation-webui. Please see their respective repositories for further information.
 
 
135
 
136
- If you can't update GPTQ-for-LLaMa or don't want to, please use a `compat.no-act-order.safetensor` file.
137
 
138
  <!-- footer start -->
139
  ## Discord
140
 
141
  For further support, and discussions on these models and AI in general, join us at:
142
 
143
- [TheBloke AI's Discord server](https://discord.gg/Jq4vkcDakD)
144
 
145
  ## Thanks, and how to contribute.
146
 
@@ -155,11 +177,158 @@ Donaters will get priority support on any and all AI/LLM/model questions and req
155
  * Patreon: https://patreon.com/TheBlokeAI
156
  * Ko-Fi: https://ko-fi.com/TheBlokeAI
157
 
158
- **Patreon special mentions**: Aemon Algiz, Dmitriy Samsonov, Nathan LeClaire, Trenton Dambrowitz, Mano Prime, David Flickinger, vamX, Nikolai Manek, senxiiz, Khalefa Al-Ahmad, Illia Dulskyi, Jonathan Leane, Talal Aujan, V. Lukas, Joseph William Delisle, Pyrater, Oscar Rangel, Lone Striker, Luke Pendergrass, Eugene Pentland, Sebastain Graf, Johann-Peter Hartman.
 
 
159
 
160
  Thank you to all my generous patrons and donaters!
 
161
  <!-- footer end -->
162
- # Original model card
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
 
164
  ```
165
  llama-30b-sft-7:
 
1
  ---
 
2
  inference: false
3
+ license: other
4
+ model_type: llama
5
  ---
6
+
7
  <!-- header start -->
8
  <div style="width: 100%;">
9
  <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
10
  </div>
11
  <div style="display: flex; justify-content: space-between; width: 100%;">
12
  <div style="display: flex; flex-direction: column; align-items: flex-start;">
13
+ <p><a href="https://discord.gg/theblokeai">Chat & support: my new Discord server</a></p>
14
  </div>
15
  <div style="display: flex; flex-direction: column; align-items: flex-end;">
16
  <p><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
 
20
 
21
  # OpenAssistant LLaMA 30B SFT 7 GPTQ
22
 
23
+ These files are GPTQ model files for [OpenAssistant LLaMA 30B SFT 7](https://huggingface.co/OpenAssistant/oasst-sft-7-llama-30b-xor).
24
 
25
+ 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.
26
 
27
+ These models were quantised using hardware kindly provided by [Latitude.sh](https://www.latitude.sh/accelerate).
 
 
28
 
29
  ## Repositories available
30
 
31
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/OpenAssistant-SFT-7-Llama-30B-GPTQ)
32
+ * [2, 3, 4, 5, 6 and 8-bit GGML models for CPU+GPU inference](https://huggingface.co/TheBloke/OpenAssistant-SFT-7-Llama-30B-GGML)
33
+ * [Unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/TheBloke/OpenAssistant-SFT-7-Llama-30B-HF)
 
 
34
 
35
+ ## Prompt template: OpenAssistant
36
 
37
  ```
38
+ <|prompter|>{prompt}<|endoftext|><|assistant|>
 
39
  ```
40
 
41
+ ## Provided files
 
 
42
 
43
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
 
 
 
 
 
 
 
 
44
 
45
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
 
 
 
 
 
46
 
47
+ | Branch | Bits | Group Size | Act Order (desc_act) | File Size | ExLlama Compatible? | Made With | Description |
48
+ | ------ | ---- | ---------- | -------------------- | --------- | ------------------- | --------- | ----------- |
49
+ | main | 4 | None | True | 16.94 GB | True | GPTQ-for-LLaMa | Most compatible option. Good inference speed in AutoGPTQ and GPTQ-for-LLaMa. Lower inference quality than other options. |
50
+ | gptq-4bit-32g-actorder_True | 4 | 32 | True | 19.44 GB | True | AutoGPTQ | 4-bit, with Act Order and group size. 32g gives highest possible inference quality, with maximum VRAM usage. Poor AutoGPTQ CUDA speed. |
51
+ | gptq-4bit-64g-actorder_True | 4 | 64 | True | 18.18 GB | True | AutoGPTQ | 4-bit, with Act Order and group size. 64g uses less VRAM, but with slightly lower accuracy. Poor AutoGPTQ CUDA speed. |
52
+ | gptq-4bit-128g-actorder_True | 4 | 128 | True | 17.55 GB | True | AutoGPTQ | 4-bit, with Act Order and group size. 128g uses even less VRAM, but with slightly lower accuracy. Poor AutoGPTQ CUDA speed. |
53
+ | gptq-8bit--1g-actorder_True | 8 | None | True | 32.99 GB | False | AutoGPTQ | 8-bit, with Act Order. No group size, to lower VRAM requirements and to improve AutoGPTQ speed. |
54
+ | gptq-8bit-128g-actorder_False | 8 | 128 | False | 33.73 GB | False | AutoGPTQ | 8-bit, with group size 128g for higher inference quality and without Act Order to improve AutoGPTQ speed. |
55
+ | gptq-3bit--1g-actorder_True | 3 | None | True | 12.92 GB | False | AutoGPTQ | 3-bit, with Act Order and no group size. Lowest possible VRAM requirements. May be lower quality than 3-bit 128g. |
56
+ | gptq-3bit-128g-actorder_False | 3 | 128 | False | 13.51 GB | False | AutoGPTQ | 3-bit, with group size 128g but no act-order. Slightly higher VRAM requirements than 3-bit None. |
57
 
58
+ ## How to download from branches
59
 
60
+ - In text-generation-webui, you can add `:branch` to the end of the download name, eg `TheBloke/OpenAssistant-SFT-7-Llama-30B-GPTQ:gptq-4bit-32g-actorder_True`
61
+ - With Git, you can clone a branch with:
62
+ ```
63
+ git clone --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/OpenAssistant-SFT-7-Llama-30B-GPTQ`
64
+ ```
65
+ - In Python Transformers code, the branch is the `revision` parameter; see below.
 
66
 
67
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
68
 
69
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
70
 
71
+ It is strongly recommended to use the text-generation-webui one-click-installers unless you know how to make a manual install.
72
 
73
  1. Click the **Model tab**.
74
  2. Under **Download custom model or LoRA**, enter `TheBloke/OpenAssistant-SFT-7-Llama-30B-GPTQ`.
75
+ - To download from a specific branch, enter for example `TheBloke/OpenAssistant-SFT-7-Llama-30B-GPTQ:gptq-4bit-32g-actorder_True`
76
+ - see Provided Files above for the list of branches for each option.
77
  3. Click **Download**.
78
+ 4. The model will start downloading. Once it's finished it will say "Done"
79
+ 5. In the top left, click the refresh icon next to **Model**.
80
+ 6. In the **Model** dropdown, choose the model you just downloaded: `OpenAssistant-SFT-7-Llama-30B-GPTQ`
81
+ 7. The model will automatically load, and is now ready for use!
82
+ 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.
83
+ * Note that you do not need to set GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
84
+ 9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
 
85
 
86
+ ## How to use this GPTQ model from Python code
87
 
88
+ First make sure you have [AutoGPTQ](https://github.com/PanQiWei/AutoGPTQ) installed:
89
 
90
+ `GITHUB_ACTIONS=true pip install auto-gptq`
91
 
92
+ Then try the following example code:
93
 
94
+ ```python
95
+ from transformers import AutoTokenizer, pipeline, logging
96
+ from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
 
 
 
 
 
 
 
97
 
98
+ model_name_or_path = "TheBloke/OpenAssistant-SFT-7-Llama-30B-GPTQ"
99
+ model_basename = "OpenAssistant-SFT-7-Llama-30B-GPTQ-4bit--1g.act.order"
 
 
 
100
 
101
+ use_triton = False
102
+
103
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
104
+
105
+ model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
106
+ model_basename=model_basename
107
+ use_safetensors=True,
108
+ trust_remote_code=False,
109
+ device="cuda:0",
110
+ use_triton=use_triton,
111
+ quantize_config=None)
112
+
113
+ """
114
+ To download from a specific branch, use the revision parameter, as in this example:
115
+
116
+ model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
117
+ revision="gptq-4bit-32g-actorder_True",
118
+ model_basename=model_basename,
119
+ use_safetensors=True,
120
+ trust_remote_code=False,
121
+ device="cuda:0",
122
+ quantize_config=None)
123
+ """
124
+
125
+ prompt = "Tell me about AI"
126
+ prompt_template=f'''<|prompter|>{prompt}<|endoftext|><|assistant|>
127
+ '''
128
+
129
+ print("\n\n*** Generate:")
130
+
131
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
132
+ output = model.generate(inputs=input_ids, temperature=0.7, max_new_tokens=512)
133
+ print(tokenizer.decode(output[0]))
134
+
135
+ # Inference can also be done using transformers' pipeline
136
+
137
+ # Prevent printing spurious transformers error when using pipeline with AutoGPTQ
138
+ logging.set_verbosity(logging.CRITICAL)
139
+
140
+ print("*** Pipeline:")
141
+ pipe = pipeline(
142
+ "text-generation",
143
+ model=model,
144
+ tokenizer=tokenizer,
145
+ max_new_tokens=512,
146
+ temperature=0.7,
147
+ top_p=0.95,
148
+ repetition_penalty=1.15
149
+ )
150
+
151
+ print(pipe(prompt_template)[0]['generated_text'])
152
  ```
153
 
154
+ ## Compatibility
155
+
156
+ The files provided will work with AutoGPTQ (CUDA and Triton modes), GPTQ-for-LLaMa (only CUDA has been tested), and Occ4m's GPTQ-for-LLaMa fork.
157
 
158
+ ExLlama works with Llama models in 4-bit. Please see the Provided Files table above for per-file compatibility.
159
 
160
  <!-- footer start -->
161
  ## Discord
162
 
163
  For further support, and discussions on these models and AI in general, join us at:
164
 
165
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
166
 
167
  ## Thanks, and how to contribute.
168
 
 
177
  * Patreon: https://patreon.com/TheBlokeAI
178
  * Ko-Fi: https://ko-fi.com/TheBlokeAI
179
 
180
+ **Special thanks to**: Luke from CarbonQuill, Aemon Algiz.
181
+
182
+ **Patreon special mentions**: Space Cruiser, Nikolai Manek, Sam, Chris McCloskey, Rishabh Srivastava, Kalila, Spiking Neurons AB, Khalefa Al-Ahmad, WelcomeToTheClub, Chadd, Lone Striker, Viktor Bowallius, Edmond Seymore, Ai Maven, Chris Smitley, Dave, Alexandros Triantafyllidis, Luke @flexchar, Elle, ya boyyy, Talal Aujan, Alex , Jonathan Leane, Deep Realms, Randy H, subjectnull, Preetika Verma, Joseph William Delisle, Michael Levine, chris gileta, K, Oscar Rangel, LangChain4j, Trenton Dambrowitz, Eugene Pentland, Johann-Peter Hartmann, Femi Adebogun, Illia Dulskyi, senxiiz, Daniel P. Andersen, Sean Connelly, Artur Olbinski, RoA, Mano Prime, Derek Yates, Raven Klaugh, David Flickinger, Willem Michiel, Pieter, Willian Hasse, vamX, Luke Pendergrass, webtim, Ghost , Rainer Wilmers, Nathan LeClaire, Will Dee, Cory Kujawski, John Detwiler, Fred von Graf, biorpg, Iucharbius , Imad Khwaja, Pierre Kircher, terasurfer , Asp the Wyvern, John Villwock, theTransient, zynix , Gabriel Tamborski, Fen Risland, Gabriel Puliatti, Matthew Berman, Pyrater, SuperWojo, Stephen Murray, Karl Bernard, Ajan Kanaga, Greatston Gnanesh, Junyu Yang.
183
 
184
  Thank you to all my generous patrons and donaters!
185
+
186
  <!-- footer end -->
187
+
188
+ # Original model card: OpenAssistant LLaMA 30B SFT 7
189
+
190
+
191
+ # OpenAssistant LLaMA 30B SFT 7
192
+
193
+ Due to the license attached to LLaMA models by Meta AI it is not possible to directly distribute LLaMA-based models. Instead we provide XOR weights for the OA models.
194
+
195
+ Thanks to Mick for writing the `xor_codec.py` script which enables this process
196
+
197
+ ## The Process
198
+
199
+ Note: This process applies to `oasst-sft-7-llama-30b` model. The same process can be applied to other models in future, but the checksums will be different..
200
+
201
+ **This process is tested only on Linux (specifically Ubuntu). Some users have reported that the process does not work on Windows. We recommend using WSL if you only have a Windows machine.**
202
+
203
+ To use OpenAssistant LLaMA-Based Models, you should have a copy of the original LLaMA model weights and add them to a `llama` subdirectory here. If you cannot obtain the original LLaMA, see the note in italic below for a possible alternative.
204
+
205
+ Ensure your LLaMA 30B checkpoint matches the correct md5sums:
206
+
207
+ ```
208
+ f856e9d99c30855d6ead4d00cc3a5573 consolidated.00.pth
209
+ d9dbfbea61309dc1e087f5081e98331a consolidated.01.pth
210
+ 2b2bed47912ceb828c0a37aac4b99073 consolidated.02.pth
211
+ ea0405cdb5bc638fee12de614f729ebc consolidated.03.pth
212
+ 4babdbd05b8923226a9e9622492054b6 params.json
213
+ ```
214
+
215
+ *If you do not have a copy of the original LLaMA weights and cannot obtain one, you may still be able to complete this process. Some users have reported that [this model](https://huggingface.co/elinas/llama-30b-hf-transformers-4.29) can be used as a base for the XOR conversion. This will also allow you to skip to Step 7. However, we only support conversion starting from LLaMA original checkpoint and cannot provide support if you experience issues with this alternative approach.*
216
+
217
+ **Important: Follow these exact steps to convert your original LLaMA checkpoint to a HuggingFace Transformers-compatible format. If you use the wrong versions of any dependency, you risk ending up with weights which are not compatible with the XOR files.**
218
+
219
+ 1. Create a clean Python **3.10** virtual environment & activate it:
220
+
221
+ ```
222
+ python3.10 -m venv xor_venv
223
+ source xor_venv/bin/activate
224
+ ```
225
+
226
+ 2. Clone transformers repo and switch to tested version:
227
+
228
+ ```
229
+ git clone https://github.com/huggingface/transformers.git
230
+ cd transformers
231
+ git checkout d04ec99bec8a0b432fc03ed60cea9a1a20ebaf3c
232
+ pip install .
233
+ ```
234
+
235
+ 3. Install **exactly** these dependency versions:
236
+
237
+ ```
238
+ pip install torch==1.13.1 accelerate==0.18.0 sentencepiece==0.1.98 protobuf==3.20.1
239
+ ```
240
+
241
+ 4. Check `pip freeze` output:
242
+
243
+ ```
244
+ accelerate==0.18.0
245
+ certifi==2022.12.7
246
+ charset-normalizer==3.1.0
247
+ filelock==3.12.0
248
+ huggingface-hub==0.13.4
249
+ idna==3.4
250
+ numpy==1.24.2
251
+ nvidia-cublas-cu11==11.10.3.66
252
+ nvidia-cuda-nvrtc-cu11==11.7.99
253
+ nvidia-cuda-runtime-cu11==11.7.99
254
+ nvidia-cudnn-cu11==8.5.0.96
255
+ packaging==23.1
256
+ protobuf==3.20.1
257
+ psutil==5.9.5
258
+ PyYAML==6.0
259
+ regex==2023.3.23
260
+ requests==2.28.2
261
+ sentencepiece==0.1.98
262
+ tokenizers==0.13.3
263
+ torch==1.13.1
264
+ tqdm==4.65.0
265
+ transformers @ file:///mnt/data/koepf/transformers
266
+ typing_extensions==4.5.0
267
+ urllib3==1.26.15
268
+ ```
269
+
270
+ 5. While in `transformers` repo root, run HF LLaMA conversion script:
271
+
272
+ ```
273
+ python src/transformers/models/llama/convert_llama_weights_to_hf.py --input_dir <input_path_llama_base> --output_dir <output_path_llama30b_hf> --model_size 30B
274
+ ```
275
+
276
+ 6. Run `find . -type f -exec md5sum "{}" +` in the conversion target directory (`output_dir`). This should produce exactly the following checksums if your files are correct:
277
+
278
+ ```
279
+ 462a2d07f65776f27c0facfa2affb9f9 ./pytorch_model-00007-of-00007.bin
280
+ e1dc8c48a65279fb1fbccff14562e6a3 ./pytorch_model-00003-of-00007.bin
281
+ 9cffb1aeba11b16da84b56abb773d099 ./pytorch_model-00001-of-00007.bin
282
+ aee09e21813368c49baaece120125ae3 ./generation_config.json
283
+ 92754d6c6f291819ffc3dfcaf470f541 ./pytorch_model-00005-of-00007.bin
284
+ 3eddc6fc02c0172d38727e5826181adb ./pytorch_model-00004-of-00007.bin
285
+ eeec4125e9c7560836b4873b6f8e3025 ./tokenizer.model
286
+ 99762d59efa6b96599e863893cf2da02 ./pytorch_model-00006-of-00007.bin
287
+ 598538f18fed1877b41f77de034c0c8a ./config.json
288
+ fdb311c39b8659a5d5c1991339bafc09 ./tokenizer.json
289
+ fecfda4fba7bfd911e187a85db5fa2ef ./pytorch_model.bin.index.json
290
+ edd1a5897748864768b1fab645b31491 ./tokenizer_config.json
291
+ 6b2e0a735969660e720c27061ef3f3d3 ./special_tokens_map.json
292
+ 5cfcb78b908ffa02e681cce69dbe4303 ./pytorch_model-00002-of-00007.bin
293
+ ```
294
+
295
+ **Important: You should now have the correct LLaMA weights and be ready to apply the XORs. If the checksums above do not match yours, there is a problem.**
296
+
297
+ 7. Once you have LLaMA weights in the correct format, you can apply the XOR decoding:
298
+
299
+ ```
300
+ python xor_codec.py oasst-sft-7-llama-30b/ oasst-sft-7-llama-30b-xor/ llama30b_hf/
301
+ ```
302
+
303
+ You should **expect to see one warning message** during execution:
304
+
305
+ `Exception when processing 'added_tokens.json'`
306
+
307
+ This is normal. **If similar messages appear for other files, something has gone wrong**.
308
+
309
+ 8. Now run `find . -type f -exec md5sum "{}" +` in the output directory (here `oasst-sft-6-llama-30b`). You should get a file with exactly these checksums:
310
+
311
+ ```
312
+ 8ae4537c64a1ef202d1d82eb0d356703 ./pytorch_model-00007-of-00007.bin
313
+ d84f99d23369e159e50cb0597b6c9673 ./pytorch_model-00003-of-00007.bin
314
+ f7de50a725d678eb65cc3dced727842f ./pytorch_model-00001-of-00007.bin
315
+ 27b0dc092f99aa2efaf467b2d8026c3f ./added_tokens.json
316
+ aee09e21813368c49baaece120125ae3 ./generation_config.json
317
+ 31a2b04b139f4af043ad04478f1497f5 ./pytorch_model-00005-of-00007.bin
318
+ a16a2dfacbde77a1659a7c9df7966d0a ./pytorch_model-00004-of-00007.bin
319
+ eeec4125e9c7560836b4873b6f8e3025 ./tokenizer.model
320
+ baa778a8679d47b085446faf97b72758 ./pytorch_model-00006-of-00007.bin
321
+ b2d64f2198ab7b53e3b8d12fbcadeb3c ./config.json
322
+ deb33dd4ffc3d2baddcce275a00b7c1b ./tokenizer.json
323
+ 76d47e4f51a8df1d703c6f594981fcab ./pytorch_model.bin.index.json
324
+ ed59bfee4e87b9193fea5897d610ab24 ./tokenizer_config.json
325
+ 704373f0c0d62be75e5f7d41d39a7e57 ./special_tokens_map.json
326
+ e836168cdbbb74db51d04f25ed6408ce ./pytorch_model-00002-of-00007.bin
327
+ ```
328
+
329
+ If so you have successfully decoded the weights and should be able to use the model with HuggingFace Transformers. **If your checksums do not match those above, there is a problem.**
330
+
331
+ ### Configuration
332
 
333
  ```
334
  llama-30b-sft-7: