Views
No views yet

System: A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions.
Human: {prompt}
Assistant:
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 | None | Yes | 0.1 | wikitext | 4096 | 9.95 GB | No | 4-bit, with Act Order. No group size, to lower VRAM requirements. |
| gptq-4bit-128g-actorder_True | 4 | 128 | Yes | 0.1 | wikitext | 4096 | 10.00 GB | No | 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 | wikitext | 4096 | 10.00 GB | No | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
| gptq-3bit-128g-actorder_True | 3 | 128 | Yes | 0.1 | wikitext | 4096 | 9.99 GB | No | 3-bit, with group size 128g and act-order. Higher quality than 128g-False. |
| gptq-8bit--1g-actorder_True | 8 | None | Yes | 0.1 | wikitext | 4096 | 9.98 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
| gptq-3bit-32g-actorder_True | 3 | 32 | Yes | 0.1 | wikitext | 4096 | 10.00 GB | No | 3-bit, with group size 64g and act-order. Highest quality 3-bit option. |
| gptq-8bit-128g-actorder_True | 8 | 128 | Yes | 0.1 | wikitext | 4096 | 9.94 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
main branch, enter TheBloke/AquilaChat2-34B-GPTQ in the "Download model" box.:branchname to the end of the download name, eg TheBloke/AquilaChat2-34B-GPTQ:gptq-4bit-128g-actorder_Truehuggingface-hub Python library:pip3 install huggingface-hubmain branch to a folder called AquilaChat2-34B-GPTQ:1mkdir AquilaChat2-34B-GPTQ
2huggingface-cli download TheBloke/AquilaChat2-34B-GPTQ --local-dir AquilaChat2-34B-GPTQ --local-dir-use-symlinks False--revision parameter:1mkdir AquilaChat2-34B-GPTQ
2huggingface-cli download TheBloke/AquilaChat2-34B-GPTQ --revision gptq-4bit-128g-actorder_True --local-dir AquilaChat2-34B-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 AquilaChat2-34B-GPTQ
2HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/AquilaChat2-34B-GPTQ --local-dir AquilaChat2-34B-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-128g-actorder_True https://huggingface.co/TheBloke/AquilaChat2-34B-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/AquilaChat2-34B-GPTQ.TheBloke/AquilaChat2-34B-GPTQ:gptq-4bit-128g-actorder_TrueAquilaChat2-34B-GPTQquantize_config.json.ghcr.io/huggingface/text-generation-inference:1.1.0--model-id TheBloke/AquilaChat2-34B-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'''System: A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions.
7Human: {prompt}
8Assistant:
9'''
10
11client = InferenceClient(endpoint_url)
12response = client.text_generation(prompt,
13 max_new_tokens=128,
14 do_sample=True,
15 temperature=0.7,
16 top_p=0.95,
17 top_k=40,
18 repetition_penalty=1.1)
19
20print(f"Model output: {response}")1pip3 install transformers optimum
2pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # Use cu117 if on CUDA 11.71pip3 uninstall -y auto-gptq
2git clone https://github.com/PanQiWei/AutoGPTQ
3cd AutoGPTQ
4git checkout v0.4.2
5pip3 install .1from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
2
3model_name_or_path = "TheBloke/AquilaChat2-34B-GPTQ"
4# To use a different branch, change revision
5# For example: revision="gptq-4bit-128g-actorder_True"
6model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
7 device_map="auto",
8 trust_remote_code=True,
9 revision="main")
10
11tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
12
13prompt = "Tell me about AI"
14prompt_template=f'''System: A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions.
15Human: {prompt}
16Assistant:
17'''
18
19print("\n\n*** Generate:")
20
21input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
22output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
23print(tokenizer.decode(output[0]))
24
25# Inference can also be done using transformers' pipeline
26
27print("*** Pipeline:")
28pipe = pipeline(
29 "text-generation",
30 model=model,
31 tokenizer=tokenizer,
32 max_new_tokens=512,
33 do_sample=True,
34 temperature=0.7,
35 top_p=0.95,
36 top_k=40,
37 repetition_penalty=1.1
38)
39
40print(pipe(prompt_template)[0]['generated_text'])
1from transformers import AutoTokenizer, AutoModelForCausalLM
2from transformers import BitsAndBytesConfig
3import torch
4
5device = torch.device("cuda:0")
6model_info = "BAAI/AquilaChat2-34B"
7tokenizer = AutoTokenizer.from_pretrained(model_info, trust_remote_code=True)
8quantization_config=BitsAndBytesConfig(
9 load_in_4bit=True,
10 bnb_4bit_use_double_quant=True,
11 bnb_4bit_quant_type="nf4",
12 bnb_4bit_compute_dtype=torch.bfloat16,
13 )
14model = AutoModelForCausalLM.from_pretrained(model_info, trust_remote_code=True, torch_dtype=torch.bfloat16,
15 # quantization_config=quantization_config, # Uncomment this line for 4bit quantization
16 )
17model.eval()
18model.to(device)
19text = "请给出10个要到北京旅游的理由。"
20from predict import predict
21out = predict(model, text, tokenizer=tokenizer, max_gen_len=200, top_p=0.9,
22 seed=123, topk=15, temperature=1.0, sft=True, device=device,
23 model_name="AquilaChat2-34B")
24print(out)