Views
No views yet

[INST] <<SYS>>
{system_message}
<</SYS>>
{prompt} [/INST]
apache-2.0, and this quantization has therefore used that same license.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.| Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
|---|---|---|---|---|---|---|---|---|---|
| main | 4 | 128 | Yes | 0.1 | open-instruct | 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. |
| gptq-4bit-32g-actorder_True | 4 | 32 | Yes | 0.1 | open-instruct | 4096 | 4.28 GB | Yes | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
| gptq-8bit--1g-actorder_True | 8 | None | Yes | 0.1 | open-instruct | 4096 | 7.01 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
| gptq-8bit-128g-actorder_True | 8 | 128 | Yes | 0.1 | open-instruct | 4096 | 7.16 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
| gptq-8bit-32g-actorder_True | 8 | 32 | Yes | 0.1 | open-instruct | 4096 | 7.62 GB | No | 8-bit, with group size 32g and Act Order for maximum inference quality. |
| gptq-4bit-64g-actorder_True | 4 | 64 | Yes | 0.1 | open-instruct | 4096 | 4.02 GB | Yes | 4-bit, with Act Order and group size 64g. Uses less VRAM than 32g, but with slightly lower accuracy. |
main branch, enter TheBloke/digital-socrates-7B-GPTQ in the "Download model" box.:branchname to the end of the download name, eg TheBloke/digital-socrates-7B-GPTQ:gptq-4bit-32g-actorder_Truehuggingface-hub Python library:pip3 install huggingface-hubmain branch to a folder called digital-socrates-7B-GPTQ:1mkdir digital-socrates-7B-GPTQ
2huggingface-cli download TheBloke/digital-socrates-7B-GPTQ --local-dir digital-socrates-7B-GPTQ --local-dir-use-symlinks False--revision parameter:1mkdir digital-socrates-7B-GPTQ
2huggingface-cli download TheBloke/digital-socrates-7B-GPTQ --revision gptq-4bit-32g-actorder_True --local-dir digital-socrates-7B-GPTQ --local-dir-use-symlinks False--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.HF_HOME environment variable, and/or the --cache-dir parameter to huggingface-cli.huggingface-cli, please see: HF -> Hub Python Library -> Download files -> Download from the CLI.hf_transfer:pip3 install hf_transferHF_HUB_ENABLE_HF_TRANSFER to 1:1mkdir digital-socrates-7B-GPTQ
2HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/digital-socrates-7B-GPTQ --local-dir digital-socrates-7B-GPTQ --local-dir-use-symlinks Falseset HF_HUB_ENABLE_HF_TRANSFER=1 before the download command.git (not recommended)git, use a command like this:git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/digital-socrates-7B-GPTQhuggingface-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.)TheBloke/digital-socrates-7B-GPTQ.TheBloke/digital-socrates-7B-GPTQ:gptq-4bit-32g-actorder_Truedigital-socrates-7B-GPTQquantize_config.json.ghcr.io/huggingface/text-generation-inference:1.1.0--model-id TheBloke/digital-socrates-7B-GPTQ --port 3000 --quantize gptq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096pip3 install huggingface-hub1from huggingface_hub import InferenceClient
2
3endpoint_url = "https://your-endpoint-url-here"
4
5prompt = "Tell me about AI"
6prompt_template=f'''[INST] <<SYS>>
7{system_message}
8<</SYS>>
9{prompt} [/INST]
10'''
11
12client = InferenceClient(endpoint_url)
13response = client.text_generation(prompt,
14 max_new_tokens=128,
15 do_sample=True,
16 temperature=0.7,
17 top_p=0.95,
18 top_k=40,
19 repetition_penalty=1.1)
20
21print(f"Model output: {response}")1pip3 install --upgrade transformers optimum
2# If using PyTorch 2.1 + CUDA 12.x:
3pip3 install --upgrade auto-gptq
4# or, if using PyTorch 2.1 + CUDA 11.x:
5pip3 install --upgrade auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/1pip3 uninstall -y auto-gptq
2git clone https://github.com/PanQiWei/AutoGPTQ
3cd AutoGPTQ
4git checkout v0.5.1
5pip3 install .1from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
2
3model_name_or_path = "TheBloke/digital-socrates-7B-GPTQ"
4# To use a different branch, change revision
5# For example: revision="gptq-4bit-32g-actorder_True"
6model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
7 device_map="auto",
8 trust_remote_code=False,
9 revision="main")
10
11tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
12
13prompt = "Tell me about AI"
14prompt_template=f'''[INST] <<SYS>>
15{system_message}
16<</SYS>>
17{prompt} [/INST]
18'''
19
20print("\n\n*** Generate:")
21
22input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
23output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
24print(tokenizer.decode(output[0]))
25
26# Inference can also be done using transformers' pipeline
27
28print("*** Pipeline:")
29pipe = pipeline(
30 "text-generation",
31 model=model,
32 tokenizer=tokenizer,
33 max_new_tokens=512,
34 do_sample=True,
35 temperature=0.7,
36 top_p=0.95,
37 top_k=40,
38 repetition_penalty=1.1
39)
40
41print(pipe(prompt_template)[0]['generated_text'])1When 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?
2(A) a change in phase
3(B) thermal expansion
4(C) an increase in entropy
5(D) mechanical advantage
6
7Answer sheet: (C)1) The question states that the lawnmower engine makes a lot of noise.
2) The question states that the lawnmower engine gets very hot.
3) Noise and heat are both forms of energy.
4) The noise and heat generated from the lawnmower are a result of the conversion of energy from the fuel to mechanical energy.
Answer: (D)The explanation states or suggests the following:
* 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."
* Dimension: incorrect_information
Consider these points for revising the explanation:
* General: Remember that noise and heat are not forms of energy. They are byproducts of energy conversion.
* 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.
Explanation score: 2import json
from transformers import AutoTokenizer, AutoModelForCausalLM
# Load model and tokenizer
model_path = "allenai/digital-socrates-7b"
model = AutoModelForCausalLM.from_pretrained(model_path).to("cuda:0")
tokenizer = AutoTokenizer.from_pretrained(model_path)
# Define input data
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"
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."
answerkey = "C"
predictedanswer = "D"
# construct prompt (Llama conventions)
with open("../DSCritiqueBank-V1/DSCB-prompts.json") as file:
prompts = json.load(file)
system_prompt = prompts['digital_socrates_v1']['system']
user_prompt = prompts['digital_socrates_v1']['main'].replace("[[QUESTION]]", question).replace("[[EXPLANATION]]", explanation).replace("[[PREDICTEDANSWER]]", predictedanswer).replace("[[ANSWERKEY]]", answerkey)
full_prompt = f"[INST] <<SYS>>\n{system_prompt}\n<</SYS>{user_prompt} [/INST]\n\n"
# Run model
input_ids = tokenizer.encode(full_prompt, return_tensors="pt").to("cuda:0")
output = model.generate(input_ids, max_new_tokens=512, temperature=0)
res = tokenizer.batch_decode(output, skip_special_tokens=True)>>> print(res[0].split("[/INST]")[-1])
The explanation states or suggests the following:
* 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."
* Dimension: incorrect_information
Consider these points for revising the explanation:
* General: Remember that noise and heat are not forms of energy. They are byproducts of energy conversion.
* 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.
Explanation score: 2