Load quantize_config.json from local path

This commit is contained in:
Antoni Baum 2023-07-27 18:03:04 -07:00 committed by GitHub
parent 9f18f4c006
commit 987b0fff3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -220,9 +220,13 @@ class Weights:
return bits, groupsize
def _set_gptq_params(self, model_id):
def _set_gptq_params(self, model_id: str):
try:
filename = hf_hub_download(model_id, filename="quantize_config.json")
potential_local_path = Path(model_id, "quantize_config.json")
if potential_local_path.exists():
filename = potential_local_path
else:
filename = hf_hub_download(model_id, filename="quantize_config.json")
with open(filename, "r") as f:
data = json.load(f)
self.gptq_bits = data["bits"]