Views
No views yet

{prompt}
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 | Evol Instruct Code | 8192 | 3.36 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 | Evol Instruct Code | 8192 | 3.68 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 | Evol Instruct Code | 8192 | 5.98 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
| gptq-8bit-128g-actorder_True | 8 | 128 | Yes | 0.1 | Evol Instruct Code | 8192 | 6.10 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 | Evol Instruct Code | 8192 | 6.48 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 | Evol Instruct Code | 8192 | 3.47 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/deepseek-coder-5.7bmqa-base-GPTQ in the "Download model" box.:branchname to the end of the download name, eg TheBloke/deepseek-coder-5.7bmqa-base-GPTQ:gptq-4bit-32g-actorder_Truehuggingface-hub Python library:pip3 install huggingface-hubmain branch to a folder called deepseek-coder-5.7bmqa-base-GPTQ:1mkdir deepseek-coder-5.7bmqa-base-GPTQ
2huggingface-cli download TheBloke/deepseek-coder-5.7bmqa-base-GPTQ --local-dir deepseek-coder-5.7bmqa-base-GPTQ --local-dir-use-symlinks False--revision parameter:1mkdir deepseek-coder-5.7bmqa-base-GPTQ
2huggingface-cli download TheBloke/deepseek-coder-5.7bmqa-base-GPTQ --revision gptq-4bit-32g-actorder_True --local-dir deepseek-coder-5.7bmqa-base-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 deepseek-coder-5.7bmqa-base-GPTQ
2HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/deepseek-coder-5.7bmqa-base-GPTQ --local-dir deepseek-coder-5.7bmqa-base-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/deepseek-coder-5.7bmqa-base-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/deepseek-coder-5.7bmqa-base-GPTQ.TheBloke/deepseek-coder-5.7bmqa-base-GPTQ:gptq-4bit-32g-actorder_Truedeepseek-coder-5.7bmqa-base-GPTQquantize_config.json.ghcr.io/huggingface/text-generation-inference:1.1.0--model-id TheBloke/deepseek-coder-5.7bmqa-base-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'''{prompt}
7'''
8
9client = InferenceClient(endpoint_url)
10response = client.text_generation(prompt,
11 max_new_tokens=128,
12 do_sample=True,
13 temperature=0.7,
14 top_p=0.95,
15 top_k=40,
16 repetition_penalty=1.1)
17
18print(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/deepseek-coder-5.7bmqa-base-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'''{prompt}
15'''
16
17print("\n\n*** Generate:")
18
19input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
20output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
21print(tokenizer.decode(output[0]))
22
23# Inference can also be done using transformers' pipeline
24
25print("*** Pipeline:")
26pipe = pipeline(
27 "text-generation",
28 model=model,
29 tokenizer=tokenizer,
30 max_new_tokens=512,
31 do_sample=True,
32 temperature=0.7,
33 top_p=0.95,
34 top_k=40,
35 repetition_penalty=1.1
36)
37
38print(pipe(prompt_template)[0]['generated_text'])
1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
3tokenizer = AutoTokenizer.from_pretrained("deepseek-ai/deepseek-coder-5.7bmqa-base", trust_remote_code=True)
4model = AutoModelForCausalLM.from_pretrained("deepseek-ai/deepseek-coder-5.7bmqa-base", trust_remote_code=True).cuda()
5input_text = "#write a quick sort algorithm"
6inputs = tokenizer(input_text, return_tensors="pt").to(model.device)
7outputs = model.generate(**inputs, max_length=128)
8print(tokenizer.decode(outputs[0], skip_special_tokens=True))1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
3tokenizer = AutoTokenizer.from_pretrained("deepseek-ai/deepseek-coder-5.7bmqa-base", trust_remote_code=True)
4model = AutoModelForCausalLM.from_pretrained("deepseek-ai/deepseek-coder-5.7bmqa-base", trust_remote_code=True).cuda()
5input_text = """<|fim▁begin|>def quick_sort(arr):
6 if len(arr) <= 1:
7 return arr
8 pivot = arr[0]
9 left = []
10 right = []
11<|fim▁hole|>
12 if arr[i] < pivot:
13 left.append(arr[i])
14 else:
15 right.append(arr[i])
16 return quick_sort(left) + [pivot] + quick_sort(right)<|fim▁end|>"""
17inputs = tokenizer(input_text, return_tensors="pt").to(model.device)
18outputs = model.generate(**inputs, max_length=128)
19print(tokenizer.decode(outputs[0], skip_special_tokens=True)[len(input_text):])1from transformers import AutoTokenizer, AutoModelForCausalLM
2tokenizer = AutoTokenizer.from_pretrained("deepseek-ai/deepseek-coder-5.7bmqa-base", trust_remote_code=True)
3model = AutoModelForCausalLM.from_pretrained("deepseek-ai/deepseek-coder-5.7bmqa-base", trust_remote_code=True).cuda()
4
5input_text = """#utils.py
6import torch
7from sklearn import datasets
8from sklearn.model_selection import train_test_split
9from sklearn.preprocessing import StandardScaler
10from sklearn.metrics import accuracy_score
11
12def load_data():
13 iris = datasets.load_iris()
14 X = iris.data
15 y = iris.target
16
17 # Standardize the data
18 scaler = StandardScaler()
19 X = scaler.fit_transform(X)
20
21 X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42)
22
23 # Convert numpy data to PyTorch tensors
24 X_train = torch.tensor(X_train, dtype=torch.float32)
25 X_test = torch.tensor(X_test, dtype=torch.float32)
26 y_train = torch.tensor(y_train, dtype=torch.int64)
27 y_test = torch.tensor(y_test, dtype=torch.int64)
28
29 return X_train, X_test, y_train, y_test
30
31def evaluate_predictions(y_test, y_pred):
32 return accuracy_score(y_test, y_pred)
33#model.py
34import torch
35import torch.nn as nn
36import torch.optim as optim
37from torch.utils.data import DataLoader, TensorDataset
38
39class IrisClassifier(nn.Module):
40 def __init__(self):
41 super(IrisClassifier, self).__init__()
42 self.fc = nn.Sequential(
43 nn.Linear(4, 16),
44 nn.ReLU(),
45 nn.Linear(16, 3)
46 )
47
48 def forward(self, x):
49 return self.fc(x)
50
51 def train_model(self, X_train, y_train, epochs, lr, batch_size):
52 criterion = nn.CrossEntropyLoss()
53 optimizer = optim.Adam(self.parameters(), lr=lr)
54
55 # Create DataLoader for batches
56 dataset = TensorDataset(X_train, y_train)
57 dataloader = DataLoader(dataset, batch_size=batch_size, shuffle=True)
58
59 for epoch in range(epochs):
60 for batch_X, batch_y in dataloader:
61 optimizer.zero_grad()
62 outputs = self(batch_X)
63 loss = criterion(outputs, batch_y)
64 loss.backward()
65 optimizer.step()
66
67 def predict(self, X_test):
68 with torch.no_grad():
69 outputs = self(X_test)
70 _, predicted = outputs.max(1)
71 return predicted.numpy()
72#main.py
73from utils import load_data, evaluate_predictions
74from model import IrisClassifier as Classifier
75
76def main():
77 # Model training and evaluation
78"""
79inputs = tokenizer(input_text, return_tensors="pt").to(model.device)
80outputs = model.generate(**inputs, max_new_tokens=140)
81print(tokenizer.decode(outputs[0]))