add transformers gptq support (#963)

Proposal to fix
https://github.com/huggingface/text-generation-inference/issues/962
This commit is contained in:
Florian Zimmermeister 2023-09-07 10:19:42 +02:00 committed by GitHub
parent 935a77fb74
commit b03d2621a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 4 deletions

View File

@ -223,7 +223,7 @@ class Weights:
return bits, groupsize
def _set_gptq_params(self, model_id):
filename = "quantize_config.json"
filename = "config.json"
try:
if os.path.exists(os.path.join(model_id, filename)):
filename = os.path.join(model_id, filename)
@ -231,7 +231,18 @@ class Weights:
filename = hf_hub_download(model_id, filename=filename)
with open(filename, "r") as f:
data = json.load(f)
self.gptq_bits = data["bits"]
self.gptq_groupsize = data["group_size"]
self.gptq_bits = data["quantization_config"]["bits"]
self.gptq_groupsize = data["quantization_config"]["group_size"]
except Exception:
pass
filename = "quantize_config.json"
try:
if os.path.exists(os.path.join(model_id, filename)):
filename = os.path.join(model_id, filename)
else:
filename = hf_hub_download(model_id, filename=filename)
with open(filename, "r") as f:
data = json.load(f)
self.gptq_bits = data["bits"]
self.gptq_groupsize = data["group_size"]
except Exception:
pass