mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-04-22 23:42:06 +00:00
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,6 +223,17 @@ class Weights:
|
|||||||
return bits, groupsize
|
return bits, groupsize
|
||||||
|
|
||||||
def _set_gptq_params(self, model_id):
|
def _set_gptq_params(self, model_id):
|
||||||
|
filename = "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["quantization_config"]["bits"]
|
||||||
|
self.gptq_groupsize = data["quantization_config"]["group_size"]
|
||||||
|
except Exception:
|
||||||
filename = "quantize_config.json"
|
filename = "quantize_config.json"
|
||||||
try:
|
try:
|
||||||
if os.path.exists(os.path.join(model_id, filename)):
|
if os.path.exists(os.path.join(model_id, filename)):
|
||||||
|
Loading…
Reference in New Issue
Block a user