add transformers gptq support (#963)
Proposal to fix https://github.com/huggingface/text-generation-inference/issues/962
This commit is contained in:
parent
935a77fb74
commit
b03d2621a7
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue