TheBloke commited on
Commit
1e7ad87
1 Parent(s): 60beaf9

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +501 -0
README.md ADDED
@@ -0,0 +1,501 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: allenai/digital-socrates-7b
3
+ inference: false
4
+ language: en
5
+ library_name: transformers
6
+ license: apache-2.0
7
+ model_creator: Allen Institute for AI
8
+ model_name: Digital Socrates 7B
9
+ model_type: llama
10
+ prompt_template: '[INST] <<SYS>>
11
+
12
+ {system_message}
13
+
14
+ <</SYS>>
15
+
16
+ {prompt} [/INST]
17
+
18
+ '
19
+ quantized_by: TheBloke
20
+ ---
21
+ <!-- markdownlint-disable MD041 -->
22
+
23
+ <!-- header start -->
24
+ <!-- 200823 -->
25
+ <div style="width: auto; margin-left: auto; margin-right: auto">
26
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
27
+ </div>
28
+ <div style="display: flex; justify-content: space-between; width: 100%;">
29
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
30
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
31
+ </div>
32
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
33
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
34
+ </div>
35
+ </div>
36
+ <div style="text-align:center; margin-top: 0em; margin-bottom: 0em"><p style="margin-top: 0.25em; margin-bottom: 0em;">TheBloke's LLM work is generously supported by a grant from <a href="https://a16z.com">andreessen horowitz (a16z)</a></p></div>
37
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
38
+ <!-- header end -->
39
+
40
+ # Digital Socrates 7B - GPTQ
41
+ - Model creator: [Allen Institute for AI](https://huggingface.co/allenai)
42
+ - Original model: [Digital Socrates 7B](https://huggingface.co/allenai/digital-socrates-7b)
43
+
44
+ <!-- description start -->
45
+ # Description
46
+
47
+ This repo contains GPTQ model files for [Allen Institute for AI's Digital Socrates 7B](https://huggingface.co/allenai/digital-socrates-7b).
48
+
49
+ 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.
50
+
51
+ These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
52
+
53
+ <!-- description end -->
54
+ <!-- repositories-available start -->
55
+ ## Repositories available
56
+
57
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/digital-socrates-7B-AWQ)
58
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/digital-socrates-7B-GPTQ)
59
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/digital-socrates-7B-GGUF)
60
+ * [Allen Institute for AI's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/allenai/digital-socrates-7b)
61
+ <!-- repositories-available end -->
62
+
63
+ <!-- prompt-template start -->
64
+ ## Prompt template: Llama-2-Chat
65
+
66
+ ```
67
+ [INST] <<SYS>>
68
+ {system_message}
69
+ <</SYS>>
70
+ {prompt} [/INST]
71
+
72
+ ```
73
+
74
+ <!-- prompt-template end -->
75
+ <!-- licensing start -->
76
+ ## Licensing
77
+
78
+ The creator of the source model has listed its license as `apache-2.0`, and this quantization has therefore used that same license.
79
+
80
+ As this model is based on Llama 2, it is also subject to the Meta Llama 2 license terms, and the license files for that are additionally included. It should therefore be considered as being claimed to be licensed under both licenses. I contacted Hugging Face for clarification on dual licensing but they do not yet have an official position. Should this change, or should Meta provide any feedback on this situation, I will update this section accordingly.
81
+
82
+ In the meantime, any questions regarding licensing, and in particular how these two licenses might interact, should be directed to the original model repository: [Allen Institute for AI's Digital Socrates 7B](https://huggingface.co/allenai/digital-socrates-7b).
83
+ <!-- licensing end -->
84
+
85
+ <!-- README_GPTQ.md-compatible clients start -->
86
+ ## Known compatible clients / servers
87
+
88
+ These GPTQ models are known to work in the following inference servers/webuis.
89
+
90
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
91
+ - [KoboldAI United](https://github.com/henk717/koboldai)
92
+ - [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui)
93
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
94
+
95
+ This may not be a complete list; if you know of others, please let me know!
96
+ <!-- README_GPTQ.md-compatible clients end -->
97
+
98
+ <!-- README_GPTQ.md-provided-files start -->
99
+ ## Provided files, and GPTQ parameters
100
+
101
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
102
+
103
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
104
+
105
+ Most GPTQ files are made with AutoGPTQ. Mistral models are currently made with Transformers.
106
+
107
+ <details>
108
+ <summary>Explanation of GPTQ parameters</summary>
109
+
110
+ - Bits: The bit size of the quantised model.
111
+ - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
112
+ - Act Order: True or False. Also known as `desc_act`. True results in better quantisation accuracy. Some GPTQ clients have had issues with models that use Act Order plus Group Size, but this is generally resolved now.
113
+ - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
114
+ - GPTQ dataset: The calibration dataset used during quantisation. Using a dataset more appropriate to the model's training can improve quantisation accuracy. Note that the GPTQ calibration dataset is not the same as the dataset used to train the model - please refer to the original model repo for details of the training dataset(s).
115
+ - Sequence Length: The length of the dataset sequences used for quantisation. Ideally this is the same as the model sequence length. For some very long sequence models (16+K), a lower sequence length may have to be used. Note that a lower sequence length does not limit the sequence length of the quantised model. It only impacts the quantisation accuracy on longer inference sequences.
116
+ - ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama and Mistral models in 4-bit.
117
+
118
+ </details>
119
+
120
+ | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
121
+ | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
122
+ | [main](https://huggingface.co/TheBloke/digital-socrates-7B-GPTQ/tree/main) | 4 | 128 | Yes | 0.1 | [open-instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 3.90 GB | Yes | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. |
123
+ | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/digital-socrates-7B-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [open-instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 4.28 GB | Yes | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
124
+ | [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/digital-socrates-7B-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [open-instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 7.01 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
125
+ | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/digital-socrates-7B-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [open-instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 7.16 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
126
+ | [gptq-8bit-32g-actorder_True](https://huggingface.co/TheBloke/digital-socrates-7B-GPTQ/tree/gptq-8bit-32g-actorder_True) | 8 | 32 | Yes | 0.1 | [open-instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 7.62 GB | No | 8-bit, with group size 32g and Act Order for maximum inference quality. |
127
+ | [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/digital-socrates-7B-GPTQ/tree/gptq-4bit-64g-actorder_True) | 4 | 64 | Yes | 0.1 | [open-instruct](https://huggingface.co/datasets/VMware/open-instruct/viewer/) | 4096 | 4.02 GB | Yes | 4-bit, with Act Order and group size 64g. Uses less VRAM than 32g, but with slightly lower accuracy. |
128
+
129
+ <!-- README_GPTQ.md-provided-files end -->
130
+
131
+ <!-- README_GPTQ.md-download-from-branches start -->
132
+ ## How to download, including from branches
133
+
134
+ ### In text-generation-webui
135
+
136
+ To download from the `main` branch, enter `TheBloke/digital-socrates-7B-GPTQ` in the "Download model" box.
137
+
138
+ To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/digital-socrates-7B-GPTQ:gptq-4bit-32g-actorder_True`
139
+
140
+ ### From the command line
141
+
142
+ I recommend using the `huggingface-hub` Python library:
143
+
144
+ ```shell
145
+ pip3 install huggingface-hub
146
+ ```
147
+
148
+ To download the `main` branch to a folder called `digital-socrates-7B-GPTQ`:
149
+
150
+ ```shell
151
+ mkdir digital-socrates-7B-GPTQ
152
+ huggingface-cli download TheBloke/digital-socrates-7B-GPTQ --local-dir digital-socrates-7B-GPTQ --local-dir-use-symlinks False
153
+ ```
154
+
155
+ To download from a different branch, add the `--revision` parameter:
156
+
157
+ ```shell
158
+ mkdir digital-socrates-7B-GPTQ
159
+ huggingface-cli download TheBloke/digital-socrates-7B-GPTQ --revision gptq-4bit-32g-actorder_True --local-dir digital-socrates-7B-GPTQ --local-dir-use-symlinks False
160
+ ```
161
+
162
+ <details>
163
+ <summary>More advanced huggingface-cli download usage</summary>
164
+
165
+ If you remove the `--local-dir-use-symlinks False` parameter, the files will instead be stored in the central Hugging Face cache directory (default location on Linux is: `~/.cache/huggingface`), and symlinks will be added to the specified `--local-dir`, pointing to their real location in the cache. This allows for interrupted downloads to be resumed, and allows you to quickly clone the repo to multiple places on disk without triggering a download again. The downside, and the reason why I don't list that as the default option, is that the files are then hidden away in a cache folder and it's harder to know where your disk space is being used, and to clear it up if/when you want to remove a download model.
166
+
167
+ The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
168
+
169
+ For more documentation on downloading with `huggingface-cli`, please see: [HF -> Hub Python Library -> Download files -> Download from the CLI](https://huggingface.co/docs/huggingface_hub/guides/download#download-from-the-cli).
170
+
171
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
172
+
173
+ ```shell
174
+ pip3 install hf_transfer
175
+ ```
176
+
177
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
178
+
179
+ ```shell
180
+ mkdir digital-socrates-7B-GPTQ
181
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/digital-socrates-7B-GPTQ --local-dir digital-socrates-7B-GPTQ --local-dir-use-symlinks False
182
+ ```
183
+
184
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
185
+ </details>
186
+
187
+ ### With `git` (**not** recommended)
188
+
189
+ To clone a specific branch with `git`, use a command like this:
190
+
191
+ ```shell
192
+ git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/digital-socrates-7B-GPTQ
193
+ ```
194
+
195
+ Note that using Git with HF repos is strongly discouraged. It will be much slower than using `huggingface-hub`, and will use twice as much disk space as it has to store the model files twice (it stores every byte both in the intended target folder, and again in the `.git` folder as a blob.)
196
+
197
+ <!-- README_GPTQ.md-download-from-branches end -->
198
+ <!-- README_GPTQ.md-text-generation-webui start -->
199
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
200
+
201
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
202
+
203
+ It is strongly recommended to use the text-generation-webui one-click-installers unless you're sure you know how to make a manual install.
204
+
205
+ 1. Click the **Model tab**.
206
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/digital-socrates-7B-GPTQ`.
207
+
208
+ - To download from a specific branch, enter for example `TheBloke/digital-socrates-7B-GPTQ:gptq-4bit-32g-actorder_True`
209
+ - see Provided Files above for the list of branches for each option.
210
+
211
+ 3. Click **Download**.
212
+ 4. The model will start downloading. Once it's finished it will say "Done".
213
+ 5. In the top left, click the refresh icon next to **Model**.
214
+ 6. In the **Model** dropdown, choose the model you just downloaded: `digital-socrates-7B-GPTQ`
215
+ 7. The model will automatically load, and is now ready for use!
216
+ 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.
217
+
218
+ - Note that you do not need to and should not set manual GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
219
+
220
+ 9. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
221
+
222
+ <!-- README_GPTQ.md-text-generation-webui end -->
223
+
224
+ <!-- README_GPTQ.md-use-from-tgi start -->
225
+ ## Serving this model from Text Generation Inference (TGI)
226
+
227
+ It's recommended to use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
228
+
229
+ Example Docker parameters:
230
+
231
+ ```shell
232
+ --model-id TheBloke/digital-socrates-7B-GPTQ --port 3000 --quantize gptq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
233
+ ```
234
+
235
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
236
+
237
+ ```shell
238
+ pip3 install huggingface-hub
239
+ ```
240
+
241
+ ```python
242
+ from huggingface_hub import InferenceClient
243
+
244
+ endpoint_url = "https://your-endpoint-url-here"
245
+
246
+ prompt = "Tell me about AI"
247
+ prompt_template=f'''[INST] <<SYS>>
248
+ {system_message}
249
+ <</SYS>>
250
+ {prompt} [/INST]
251
+ '''
252
+
253
+ client = InferenceClient(endpoint_url)
254
+ response = client.text_generation(prompt,
255
+ max_new_tokens=128,
256
+ do_sample=True,
257
+ temperature=0.7,
258
+ top_p=0.95,
259
+ top_k=40,
260
+ repetition_penalty=1.1)
261
+
262
+ print(f"Model output: {response}")
263
+ ```
264
+ <!-- README_GPTQ.md-use-from-tgi end -->
265
+ <!-- README_GPTQ.md-use-from-python start -->
266
+ ## Python code example: inference from this GPTQ model
267
+
268
+ ### Install the necessary packages
269
+
270
+ Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
271
+
272
+ ```shell
273
+ pip3 install --upgrade transformers optimum
274
+ # If using PyTorch 2.1 + CUDA 12.x:
275
+ pip3 install --upgrade auto-gptq
276
+ # or, if using PyTorch 2.1 + CUDA 11.x:
277
+ pip3 install --upgrade auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/
278
+ ```
279
+
280
+ If you are using PyTorch 2.0, you will need to install AutoGPTQ from source. Likewise if you have problems with the pre-built wheels, you should try building from source:
281
+
282
+ ```shell
283
+ pip3 uninstall -y auto-gptq
284
+ git clone https://github.com/PanQiWei/AutoGPTQ
285
+ cd AutoGPTQ
286
+ git checkout v0.5.1
287
+ pip3 install .
288
+ ```
289
+
290
+ ### Example Python code
291
+
292
+ ```python
293
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
294
+
295
+ model_name_or_path = "TheBloke/digital-socrates-7B-GPTQ"
296
+ # To use a different branch, change revision
297
+ # For example: revision="gptq-4bit-32g-actorder_True"
298
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
299
+ device_map="auto",
300
+ trust_remote_code=False,
301
+ revision="main")
302
+
303
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
304
+
305
+ prompt = "Tell me about AI"
306
+ prompt_template=f'''[INST] <<SYS>>
307
+ {system_message}
308
+ <</SYS>>
309
+ {prompt} [/INST]
310
+ '''
311
+
312
+ print("\n\n*** Generate:")
313
+
314
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
315
+ output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
316
+ print(tokenizer.decode(output[0]))
317
+
318
+ # Inference can also be done using transformers' pipeline
319
+
320
+ print("*** Pipeline:")
321
+ pipe = pipeline(
322
+ "text-generation",
323
+ model=model,
324
+ tokenizer=tokenizer,
325
+ max_new_tokens=512,
326
+ do_sample=True,
327
+ temperature=0.7,
328
+ top_p=0.95,
329
+ top_k=40,
330
+ repetition_penalty=1.1
331
+ )
332
+
333
+ print(pipe(prompt_template)[0]['generated_text'])
334
+ ```
335
+ <!-- README_GPTQ.md-use-from-python end -->
336
+
337
+ <!-- README_GPTQ.md-compatibility start -->
338
+ ## Compatibility
339
+
340
+ The files provided are tested to work with Transformers. For non-Mistral models, AutoGPTQ can also be used directly.
341
+
342
+ [ExLlama](https://github.com/turboderp/exllama) is compatible with Llama and Mistral models in 4-bit. Please see the Provided Files table above for per-file compatibility.
343
+
344
+ For a list of clients/servers, please see "Known compatible clients / servers", above.
345
+ <!-- README_GPTQ.md-compatibility end -->
346
+
347
+ <!-- footer start -->
348
+ <!-- 200823 -->
349
+ ## Discord
350
+
351
+ For further support, and discussions on these models and AI in general, join us at:
352
+
353
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
354
+
355
+ ## Thanks, and how to contribute
356
+
357
+ Thanks to the [chirper.ai](https://chirper.ai) team!
358
+
359
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
360
+
361
+ I've had a lot of people ask if they can contribute. I enjoy providing models and helping people, and would love to be able to spend even more time doing it, as well as expanding into new projects like fine tuning/training.
362
+
363
+ If you're able and willing to contribute it will be most gratefully received and will help me to keep providing more models, and to start work on new AI projects.
364
+
365
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
366
+
367
+ * Patreon: https://patreon.com/TheBlokeAI
368
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
369
+
370
+ **Special thanks to**: Aemon Algiz.
371
+
372
+ **Patreon special mentions**: Brandon Frisco, LangChain4j, Spiking Neurons AB, transmissions 11, Joseph William Delisle, Nitin Borwankar, Willem Michiel, Michael Dempsey, vamX, Jeffrey Morgan, zynix, jjj, Omer Bin Jawed, Sean Connelly, jinyuan sun, Jeromy Smith, Shadi, Pawan Osman, Chadd, Elijah Stavena, Illia Dulskyi, Sebastain Graf, Stephen Murray, terasurfer, Edmond Seymore, Celu Ramasamy, Mandus, Alex, biorpg, Ajan Kanaga, Clay Pascal, Raven Klaugh, 阿明, K, ya boyyy, usrbinkat, Alicia Loh, John Villwock, ReadyPlayerEmma, Chris Smitley, Cap'n Zoog, fincy, GodLy, S_X, sidney chen, Cory Kujawski, OG, Mano Prime, AzureBlack, Pieter, Kalila, Spencer Kim, Tom X Nguyen, Stanislav Ovsiannikov, Michael Levine, Andrey, Trailburnt, Vadim, Enrico Ros, Talal Aujan, Brandon Phillips, Jack West, Eugene Pentland, Michael Davis, Will Dee, webtim, Jonathan Leane, Alps Aficionado, Rooh Singh, Tiffany J. Kim, theTransient, Luke @flexchar, Elle, Caitlyn Gatomon, Ari Malik, subjectnull, Johann-Peter Hartmann, Trenton Dambrowitz, Imad Khwaja, Asp the Wyvern, Emad Mostaque, Rainer Wilmers, Alexandros Triantafyllidis, Nicholas, Pedro Madruga, SuperWojo, Harry Royden McLaughlin, James Bentley, Olakabola, David Ziegler, Ai Maven, Jeff Scroggin, Nikolai Manek, Deo Leter, Matthew Berman, Fen Risland, Ken Nordquist, Manuel Alberto Morcote, Luke Pendergrass, TL, Fred von Graf, Randy H, Dan Guido, NimbleBox.ai, Vitor Caleffi, Gabriel Tamborski, knownsqashed, Lone Striker, Erik Bjäreholt, John Detwiler, Leonard Tan, Iucharbius
373
+
374
+
375
+ Thank you to all my generous patrons and donaters!
376
+
377
+ And thank you again to a16z for their generous grant.
378
+
379
+ <!-- footer end -->
380
+
381
+ # Original model card: Allen Institute for AI's Digital Socrates 7B
382
+
383
+
384
+ This is the Digital Socrates 7B (DS-7B) model described in our paper: <b>Digital Socrates: Evaluating LLMs through explanation critiques</b> (arXiv link: https://arxiv.org/abs/2311.09613).
385
+
386
+ The recommended, better performing 13B model can be found at https://huggingface.co/allenai/digital-socrates-13b
387
+
388
+ The DS-7B model is a fine-tuned version of [Llama-2-7b-Chat](https://huggingface.co/meta-llama/Llama-2-7b-chat), please
389
+ review its [guidelines](https://huggingface.co/meta-llama/Llama-2-7b-chat/blob/main/USE_POLICY.md) and
390
+ [licensing](https://huggingface.co/meta-llama/Llama-2-7b-chat#model-details) before use.
391
+
392
+
393
+
394
+ # What is Digital Socrates?
395
+ Digital Socrates is an open-source, automatic explanation-critiquing model. It is useful for revealing insights about student
396
+ models by examining their reasoning chains. The use of Digital Socrates allows for nuanced, interpretable automatic
397
+ evaluation of explanations without expensive API calls or human annotations.
398
+
399
+ While LLMs can provide reasoned explanations along with their answers, the nature and
400
+ quality of those explanations are still poorly understood. In response, our goal is to define a detailed way of characterizing the
401
+ explanation capabilities of modern models and to create a nuanced, interpretable explanation
402
+ evaluation tool that can generate such characterizations automatically.
403
+
404
+ Given a **question** (together with the multiple-choice options and gold answer),
405
+ ```commandline
406
+ When Dennis operates his lawnmower, he notices the engine makes a lot of noise. He also notices that the engine gets very hot. Which best describes the heat and noise generated from the lawnmower?
407
+ (A) a change in phase
408
+ (B) thermal expansion
409
+ (C) an increase in entropy
410
+ (D) mechanical advantage
411
+
412
+ Answer sheet: (C)
413
+ ```
414
+ as well as a student model explanation and answer,
415
+ ```
416
+ 1) The question states that the lawnmower engine makes a lot of noise.
417
+ 2) The question states that the lawnmower engine gets very hot.
418
+ 3) Noise and heat are both forms of energy.
419
+ 4) The noise and heat generated from the lawnmower are a result of the conversion of energy from the fuel to mechanical energy.
420
+
421
+ Answer: (D)
422
+ ```
423
+
424
+ Digital Socrates gives a **critique of the model-generated explanation** that provides localized feedback on the
425
+ most significant flaw (if any) in the explanation, suggestions to address the identified flaw, as well as a numeric rating indicating the explanation quality:
426
+ ```
427
+ The explanation states or suggests the following:
428
+ * Main flaw (standalone statement): "The noise and heat generated from the lawnmower are a result of the conversion of energy from the fuel to mechanical energy."
429
+ * Dimension: incorrect_information
430
+
431
+ Consider these points for revising the explanation:
432
+ * General: Remember that noise and heat are not forms of energy. They are byproducts of energy conversion.
433
+ * Specific: In this case, the noise and heat generated by the lawnmower are not a result of the conversion of energy from the fuel to mechanical energy. They are byproducts of the combustion process.
434
+
435
+ Explanation score: 2
436
+ ```
437
+
438
+
439
+ Remarkably, despite being orders of magnitude smaller than GPT-4, our Digital Socrates models are
440
+ capable of generating critiques close to GPT-4 critiques in terms of human rating and other
441
+ quantitative measures (correlation of explanation scores given and error category matches).
442
+ Through quantitative and qualitative analysis, we demonstrate how Digital Socrates is useful for
443
+ revealing insights about student models by examining their reasoning chains.
444
+
445
+ We invite you to try out Digital Socrates for your own application!
446
+
447
+
448
+
449
+ # How to use Digital Socrates?
450
+ We provide a quick example of how you can try out Digital Socrates with just a few lines of code:
451
+
452
+ 'DSCritiqueBank-V1' used below can be downloaded from our [dataset page](https://allenai.org/data/digital-socrates).
453
+ ```
454
+ import json
455
+ from transformers import AutoTokenizer, AutoModelForCausalLM
456
+ # Load model and tokenizer
457
+ model_path = "allenai/digital-socrates-7b"
458
+ model = AutoModelForCausalLM.from_pretrained(model_path).to("cuda:0")
459
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
460
+
461
+ # Define input data
462
+ question = "When Dennis operates his lawnmower, he notices the engine makes a lot of noise. He also notices that the engine gets very hot. Which best describes the heat and noise generated from the lawnmower? (A) a change in phase (B) thermal expansion (C) an increase in entropy (D) mechanical advantage"
463
+ explanation = "1) The question states that the lawnmower engine makes a lot of noise.\n2) The question states that the lawnmower engine gets very hot.\n3) Noise and heat are both forms of energy.\n4) The noise and heat generated from the lawnmower are a result of the conversion of energy from the fuel to mechanical energy."
464
+ answerkey = "C"
465
+ predictedanswer = "D"
466
+
467
+ # construct prompt (Llama conventions)
468
+ with open("../DSCritiqueBank-V1/DSCB-prompts.json") as file:
469
+ prompts = json.load(file)
470
+
471
+ system_prompt = prompts['digital_socrates_v1']['system']
472
+ user_prompt = prompts['digital_socrates_v1']['main'].replace("[[QUESTION]]", question).replace("[[EXPLANATION]]", explanation).replace("[[PREDICTEDANSWER]]", predictedanswer).replace("[[ANSWERKEY]]", answerkey)
473
+
474
+ full_prompt = f"[INST] <<SYS>>\n{system_prompt}\n<</SYS>{user_prompt} [/INST]\n\n"
475
+
476
+ # Run model
477
+ input_ids = tokenizer.encode(full_prompt, return_tensors="pt").to("cuda:0")
478
+ output = model.generate(input_ids, max_new_tokens=512, temperature=0)
479
+ res = tokenizer.batch_decode(output, skip_special_tokens=True)
480
+ ```
481
+ Print the output:
482
+ ```
483
+ >>> print(res[0].split("[/INST]")[-1])
484
+
485
+ The explanation states or suggests the following:
486
+ * Main flaw (standalone statement): "The noise and heat generated from the lawnmower are a result of the conversion of energy from the fuel to mechanical energy."
487
+ * Dimension: incorrect_information
488
+
489
+ Consider these points for revising the explanation:
490
+ * General: Remember that noise and heat are not forms of energy. They are byproducts of energy conversion.
491
+ * Specific: In this case, the noise and heat generated by the lawnmower are not a result of the conversion of energy from the fuel to mechanical energy. They are byproducts of the combustion process.
492
+
493
+ Explanation score: 2
494
+ ```
495
+
496
+
497
+
498
+ # More details about Digital Socrates ...
499
+ For more details about Digital Socrates, please refer to our:
500
+ * 📄Paper: https://arxiv.org/abs/2311.09613
501
+ * 💻Dataset: https://allenai.org/data/digital-socrates