mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-12-28 12:24:35 +00:00
Update convert-llama-h5-to-gguf.py
This commit is contained in:
parent
4f5b6224be
commit
6b3a7b9f4f
@ -47,6 +47,12 @@ if len(sys.argv) > 2:
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
fname_out = sys.argv[1] + "/ggml-model-" + ftype_str[ftype] + ".gguf"
|
fname_out = sys.argv[1] + "/ggml-model-" + ftype_str[ftype] + ".gguf"
|
||||||
|
|
||||||
|
if hparams["architectures"][0] != "LlamaForCausalLM":
|
||||||
|
print("Model architecture not supported: " + hparams["architectures"][0] )
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
with open(dir_model + "/config.json", "r", encoding="utf-8") as f:
|
||||||
|
hparams = json.load(f)
|
||||||
|
|
||||||
model = AutoModelForCausalLM.from_pretrained(dir_model, low_cpu_mem_usage=True, trust_remote_code=True)
|
model = AutoModelForCausalLM.from_pretrained(dir_model, low_cpu_mem_usage=True, trust_remote_code=True)
|
||||||
list_vars = model.state_dict()
|
list_vars = model.state_dict()
|
||||||
@ -61,9 +67,6 @@ for name in list_vars.keys():
|
|||||||
|
|
||||||
gguf_writer = gguf.GGUFWriter.open(fname_out)
|
gguf_writer = gguf.GGUFWriter.open(fname_out)
|
||||||
|
|
||||||
with open(dir_model + "/config.json", "r", encoding="utf-8") as f:
|
|
||||||
hparams = json.load(f)
|
|
||||||
|
|
||||||
# This must be changed when adding/deleting kv
|
# This must be changed when adding/deleting kv
|
||||||
kv_count = 13
|
kv_count = 13
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user