ggerganov / llama.cpp

LLM inference in C/C++
MIT License
64.94k stars 9.31k forks source link

Bug: Failed to convert minicpm-v2.5 #9098

Open apepkuss opened 3 weeks ago

apepkuss commented 3 weeks ago

What happened?

Follow the steps in README-minicpmv2.5.md#usage to convert minicpm v2.5. The conversion process fails while running the command: python ./convert_hf_to_gguf.py ../MiniCPM-Llama3-V-2_5/model. Specifically, the error happened after input y to answer the question Do you wish to run the custom code? [y/N].

Name and Version

version: 3604 (1b6ff90f) built with cc (Ubuntu 11.2.0-19ubuntu1) 11.2.0 for x86_64-linux-gnu

What operating system are you seeing the problem on?

Linux

Relevant log output

azureuser@sam-llm:/data/sam/llama.cpp$ python ./convert_hf_to_gguf.py /data1/sam/models/MiniCPM-Llama3-V-2_5/model
INFO:hf-to-gguf:Loading model: model
INFO:gguf.gguf_writer:gguf: This GGUF file is for Little Endian only
INFO:hf-to-gguf:Exporting model...
INFO:hf-to-gguf:gguf: loading model weight map from 'model.safetensors.index.json'
INFO:hf-to-gguf:gguf: loading model part 'model-00001-of-00007.safetensors'
INFO:hf-to-gguf:token_embd.weight,           torch.float32 --> F16, shape = {4096, 128256}
INFO:hf-to-gguf:blk.0.attn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.0.ffn_down.weight,       torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.0.ffn_gate.weight,       torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.0.ffn_up.weight,         torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.0.ffn_norm.weight,       torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.0.attn_k.weight,         torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.0.attn_output.weight,    torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.0.attn_q.weight,         torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.0.attn_v.weight,         torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.1.attn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.1.ffn_down.weight,       torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.1.ffn_gate.weight,       torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.1.ffn_up.weight,         torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.1.ffn_norm.weight,       torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.1.attn_k.weight,         torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.1.attn_output.weight,    torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.1.attn_q.weight,         torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.1.attn_v.weight,         torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.2.attn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.2.ffn_down.weight,       torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.2.ffn_gate.weight,       torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.2.ffn_up.weight,         torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.2.ffn_norm.weight,       torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.2.attn_k.weight,         torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.2.attn_output.weight,    torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.2.attn_q.weight,         torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.2.attn_v.weight,         torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.3.attn_k.weight,         torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.3.attn_output.weight,    torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.3.attn_q.weight,         torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.3.attn_v.weight,         torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:gguf: loading model part 'model-00002-of-00007.safetensors'
INFO:hf-to-gguf:blk.3.attn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.3.ffn_down.weight,       torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.3.ffn_gate.weight,       torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.3.ffn_up.weight,         torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.3.ffn_norm.weight,       torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.4.attn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.4.ffn_down.weight,       torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.4.ffn_gate.weight,       torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.4.ffn_up.weight,         torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.4.ffn_norm.weight,       torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.4.attn_k.weight,         torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.4.attn_output.weight,    torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.4.attn_q.weight,         torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.4.attn_v.weight,         torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.5.attn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.5.ffn_down.weight,       torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.5.ffn_gate.weight,       torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.5.ffn_up.weight,         torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.5.ffn_norm.weight,       torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.5.attn_k.weight,         torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.5.attn_output.weight,    torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.5.attn_q.weight,         torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.5.attn_v.weight,         torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.6.attn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.6.ffn_down.weight,       torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.6.ffn_gate.weight,       torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.6.ffn_up.weight,         torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.6.ffn_norm.weight,       torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.6.attn_k.weight,         torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.6.attn_output.weight,    torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.6.attn_q.weight,         torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.6.attn_v.weight,         torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.7.attn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.7.ffn_down.weight,       torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.7.ffn_gate.weight,       torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.7.ffn_up.weight,         torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.7.ffn_norm.weight,       torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.7.attn_k.weight,         torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.7.attn_output.weight,    torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.7.attn_q.weight,         torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.7.attn_v.weight,         torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.8.ffn_gate.weight,       torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.8.ffn_up.weight,         torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.8.attn_k.weight,         torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.8.attn_output.weight,    torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.8.attn_q.weight,         torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.8.attn_v.weight,         torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:gguf: loading model part 'model-00003-of-00007.safetensors'
INFO:hf-to-gguf:blk.10.attn_norm.weight,     torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.10.ffn_down.weight,      torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.10.ffn_gate.weight,      torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.10.ffn_up.weight,        torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.10.ffn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.10.attn_k.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.10.attn_output.weight,   torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.10.attn_q.weight,        torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.10.attn_v.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.11.attn_norm.weight,     torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.11.ffn_down.weight,      torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.11.ffn_gate.weight,      torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.11.ffn_up.weight,        torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.11.ffn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.11.attn_k.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.11.attn_output.weight,   torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.11.attn_q.weight,        torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.11.attn_v.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.12.attn_norm.weight,     torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.12.ffn_down.weight,      torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.12.ffn_gate.weight,      torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.12.ffn_up.weight,        torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.12.ffn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.12.attn_k.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.12.attn_output.weight,   torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.12.attn_q.weight,        torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.12.attn_v.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.13.attn_norm.weight,     torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.13.ffn_down.weight,      torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.13.ffn_gate.weight,      torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.13.ffn_up.weight,        torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.13.ffn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.13.attn_k.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.13.attn_output.weight,   torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.13.attn_q.weight,        torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.13.attn_v.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.14.ffn_gate.weight,      torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.14.attn_k.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.14.attn_output.weight,   torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.14.attn_q.weight,        torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.14.attn_v.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.8.attn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.8.ffn_down.weight,       torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.8.ffn_norm.weight,       torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.9.attn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.9.ffn_down.weight,       torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.9.ffn_gate.weight,       torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.9.ffn_up.weight,         torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.9.ffn_norm.weight,       torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.9.attn_k.weight,         torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.9.attn_output.weight,    torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.9.attn_q.weight,         torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.9.attn_v.weight,         torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:gguf: loading model part 'model-00004-of-00007.safetensors'
INFO:hf-to-gguf:blk.14.attn_norm.weight,     torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.14.ffn_down.weight,      torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.14.ffn_up.weight,        torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.14.ffn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.15.attn_norm.weight,     torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.15.ffn_down.weight,      torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.15.ffn_gate.weight,      torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.15.ffn_up.weight,        torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.15.ffn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.15.attn_k.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.15.attn_output.weight,   torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.15.attn_q.weight,        torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.15.attn_v.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.16.attn_norm.weight,     torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.16.ffn_down.weight,      torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.16.ffn_gate.weight,      torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.16.ffn_up.weight,        torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.16.ffn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.16.attn_k.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.16.attn_output.weight,   torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.16.attn_q.weight,        torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.16.attn_v.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.17.attn_norm.weight,     torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.17.ffn_down.weight,      torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.17.ffn_gate.weight,      torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.17.ffn_up.weight,        torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.17.ffn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.17.attn_k.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.17.attn_output.weight,   torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.17.attn_q.weight,        torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.17.attn_v.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.18.attn_norm.weight,     torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.18.ffn_down.weight,      torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.18.ffn_gate.weight,      torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.18.ffn_up.weight,        torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.18.ffn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.18.attn_k.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.18.attn_output.weight,   torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.18.attn_q.weight,        torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.18.attn_v.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.19.attn_norm.weight,     torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.19.ffn_down.weight,      torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.19.ffn_gate.weight,      torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.19.ffn_up.weight,        torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.19.ffn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.19.attn_k.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.19.attn_output.weight,   torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.19.attn_q.weight,        torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.19.attn_v.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.20.attn_k.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.20.attn_output.weight,   torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.20.attn_q.weight,        torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.20.attn_v.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:gguf: loading model part 'model-00005-of-00007.safetensors'
INFO:hf-to-gguf:blk.20.attn_norm.weight,     torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.20.ffn_down.weight,      torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.20.ffn_gate.weight,      torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.20.ffn_up.weight,        torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.20.ffn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.21.attn_norm.weight,     torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.21.ffn_down.weight,      torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.21.ffn_gate.weight,      torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.21.ffn_up.weight,        torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.21.ffn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.21.attn_k.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.21.attn_output.weight,   torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.21.attn_q.weight,        torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.21.attn_v.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.22.attn_norm.weight,     torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.22.ffn_down.weight,      torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.22.ffn_gate.weight,      torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.22.ffn_up.weight,        torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.22.ffn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.22.attn_k.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.22.attn_output.weight,   torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.22.attn_q.weight,        torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.22.attn_v.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.23.attn_norm.weight,     torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.23.ffn_down.weight,      torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.23.ffn_gate.weight,      torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.23.ffn_up.weight,        torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.23.ffn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.23.attn_k.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.23.attn_output.weight,   torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.23.attn_q.weight,        torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.23.attn_v.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.24.attn_norm.weight,     torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.24.ffn_down.weight,      torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.24.ffn_gate.weight,      torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.24.ffn_up.weight,        torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.24.ffn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.24.attn_k.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.24.attn_output.weight,   torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.24.attn_q.weight,        torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.24.attn_v.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.25.ffn_gate.weight,      torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.25.ffn_up.weight,        torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.25.attn_k.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.25.attn_output.weight,   torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.25.attn_q.weight,        torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.25.attn_v.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:gguf: loading model part 'model-00006-of-00007.safetensors'
INFO:hf-to-gguf:blk.25.attn_norm.weight,     torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.25.ffn_down.weight,      torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.25.ffn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.26.attn_norm.weight,     torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.26.ffn_down.weight,      torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.26.ffn_gate.weight,      torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.26.ffn_up.weight,        torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.26.ffn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.26.attn_k.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.26.attn_output.weight,   torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.26.attn_q.weight,        torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.26.attn_v.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.27.attn_norm.weight,     torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.27.ffn_down.weight,      torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.27.ffn_gate.weight,      torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.27.ffn_up.weight,        torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.27.ffn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.27.attn_k.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.27.attn_output.weight,   torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.27.attn_q.weight,        torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.27.attn_v.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.28.attn_norm.weight,     torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.28.ffn_down.weight,      torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.28.ffn_gate.weight,      torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.28.ffn_up.weight,        torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.28.ffn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.28.attn_k.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.28.attn_output.weight,   torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.28.attn_q.weight,        torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.28.attn_v.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.29.attn_norm.weight,     torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.29.ffn_down.weight,      torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.29.ffn_gate.weight,      torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.29.ffn_up.weight,        torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.29.ffn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.29.attn_k.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.29.attn_output.weight,   torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.29.attn_q.weight,        torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.29.attn_v.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.30.attn_norm.weight,     torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.30.ffn_down.weight,      torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.30.ffn_gate.weight,      torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.30.ffn_up.weight,        torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.30.ffn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.30.attn_k.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.30.attn_output.weight,   torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.30.attn_q.weight,        torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.30.attn_v.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.31.ffn_gate.weight,      torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.31.attn_k.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:blk.31.attn_output.weight,   torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.31.attn_q.weight,        torch.float32 --> F16, shape = {4096, 4096}
INFO:hf-to-gguf:blk.31.attn_v.weight,        torch.float32 --> F16, shape = {4096, 1024}
INFO:hf-to-gguf:gguf: loading model part 'model-00007-of-00007.safetensors'
INFO:hf-to-gguf:output.weight,               torch.float32 --> F16, shape = {4096, 128256}
INFO:hf-to-gguf:blk.31.attn_norm.weight,     torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:blk.31.ffn_down.weight,      torch.float32 --> F16, shape = {14336, 4096}
INFO:hf-to-gguf:blk.31.ffn_up.weight,        torch.float32 --> F16, shape = {4096, 14336}
INFO:hf-to-gguf:blk.31.ffn_norm.weight,      torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:output_norm.weight,          torch.float32 --> F32, shape = {4096}
INFO:hf-to-gguf:Set meta model
INFO:hf-to-gguf:Set model parameters
INFO:hf-to-gguf:gguf: context length = 8192
INFO:hf-to-gguf:gguf: embedding length = 4096
INFO:hf-to-gguf:gguf: feed forward length = 14336
INFO:hf-to-gguf:gguf: head count = 32
INFO:hf-to-gguf:gguf: key-value head count = 8
INFO:hf-to-gguf:gguf: rope theta = 500000.0
INFO:hf-to-gguf:gguf: rms norm epsilon = 1e-05
INFO:hf-to-gguf:gguf: file type = 1
INFO:hf-to-gguf:Set model tokenizer
The repository for /data1/sam/models/MiniCPM-Llama3-V-2_5/model contains custom code which must be executed to correctly load the model. You can inspect the repository content at https://hf.co//data1/sam/models/MiniCPM-Llama3-V-2_5/model.
You can avoid this prompt in future by passing the argument `trust_remote_code=True`.

Do you wish to run the custom code? [y/N] Traceback (most recent call last):
  File "/data/sam/llama.cpp/./convert_hf_to_gguf.py", line 1466, in set_vocab
    self._set_vocab_sentencepiece()
  File "/data/sam/llama.cpp/./convert_hf_to_gguf.py", line 689, in _set_vocab_sentencepiece
    tokens, scores, toktypes = self._create_vocab_sentencepiece()
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/sam/llama.cpp/./convert_hf_to_gguf.py", line 706, in _create_vocab_sentencepiece
    raise FileNotFoundError(f"File not found: {tokenizer_path}")
FileNotFoundError: File not found: /data1/sam/models/MiniCPM-Llama3-V-2_5/model/tokenizer.model

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/sam/llama.cpp/./convert_hf_to_gguf.py", line 1469, in set_vocab
    self._set_vocab_llama_hf()
  File "/data/sam/llama.cpp/./convert_hf_to_gguf.py", line 781, in _set_vocab_llama_hf
    vocab = gguf.LlamaHfVocab(self.dir_model)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/sam/llama.cpp/gguf-py/gguf/vocab.py", line 368, in __init__
    raise FileNotFoundError('Cannot find Llama BPE tokenizer')
FileNotFoundError: Cannot find Llama BPE tokenizer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/sam/miniconda3/envs/facet/lib/python3.11/site-packages/transformers/dynamic_module_utils.py", line 613, in resolve_trust_remote_code
    answer = input(
             ^^^^^^
  File "/data/sam/miniconda3/envs/facet/lib/python3.11/site-packages/transformers/dynamic_module_utils.py", line 594, in _raise_timeout_error
    raise ValueError(
ValueError: Loading this model requires you to execute custom code contained in the model repository on your local machine. Please set the option `trust_remote_code=True` to permit loading of this model.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/sam/llama.cpp/./convert_hf_to_gguf.py", line 4074, in <module>
    main()
  File "/data/sam/llama.cpp/./convert_hf_to_gguf.py", line 4068, in main
    model_instance.write()
  File "/data/sam/llama.cpp/./convert_hf_to_gguf.py", line 388, in write
    self.prepare_metadata(vocab_only=False)
  File "/data/sam/llama.cpp/./convert_hf_to_gguf.py", line 381, in prepare_metadata
    self.set_vocab()
  File "/data/sam/llama.cpp/./convert_hf_to_gguf.py", line 1472, in set_vocab
    self._set_vocab_gpt2()
  File "/data/sam/llama.cpp/./convert_hf_to_gguf.py", line 625, in _set_vocab_gpt2
    tokens, toktypes, tokpre = self.get_vocab_base()
                               ^^^^^^^^^^^^^^^^^^^^^
  File "/data/sam/llama.cpp/./convert_hf_to_gguf.py", line 465, in get_vocab_base
    tokenizer = AutoTokenizer.from_pretrained(self.dir_model)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/sam/miniconda3/envs/facet/lib/python3.11/site-packages/transformers/models/auto/tokenization_auto.py", line 869, in from_pretrained
    trust_remote_code = resolve_trust_remote_code(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/sam/miniconda3/envs/facet/lib/python3.11/site-packages/transformers/dynamic_module_utils.py", line 626, in resolve_trust_remote_code
    raise ValueError(
ValueError: The repository for /data1/sam/models/MiniCPM-Llama3-V-2_5/model contains custom code which must be executed to correctly load the model. You can inspect the repository content at https://hf.co//data1/sam/models/MiniCPM-Llama3-V-2_5/model.
Please pass the argument `trust_remote_code=True` to allow custom code to be run.
fairydreaming commented 3 weeks ago

I confirm the problem. There are two reasons why the tokenized chktxt hash doesn't match the llama-3 one:

fairydreaming commented 3 weeks ago

@apepkuss If you want, you can try this quick fix:

diff --git a/convert_hf_to_gguf.py b/convert_hf_to_gguf.py
index 6a1a3a93..f1f145b6 100755
--- a/convert_hf_to_gguf.py
+++ b/convert_hf_to_gguf.py
@@ -599,6 +599,8 @@ class Model:
         if chkhsh == "4e2b24cc4770243d65a2c9ec19770a72f08cffc161adbb73fcbb6b7dd45a0aae":
             # ref: https://huggingface.co/LGAI-EXAONE/EXAONE-3.0-7.8B-Instruct
             res = "exaone"
+        if chkhsh == "1baddeb572cd9de2a6d36f2ad0c361490bf5447dafca20afbac625e9d37f18a5":
+            res = "llama-bpe"

         if res is None:
             logger.warning("\n")

But from my quick check it looks like the model doesn't work:

(llama.cpp) phm@epyc:~/projects/llama.cpp$ ./llama-minicpmv-cli -m models/MiniCPM-V-2_5/Model-8.0B-F16.gguf --mmproj models/MiniCPM-V-2_5/mmproj-model-f16.gguf -c 4096 --temp 0.7 --top-p 0.8 --top-k 100 --repeat-penalty 1.05 --image /home/phm/Downloads/demo-2.jpg -p "What is in the image?"
Log start
clip_model_load: description:  image encoder for MiniCPM-V
clip_model_load: GGUF version: 3
clip_model_load: alignment:    32
clip_model_load: n_tensors:    455
clip_model_load: n_kv:         19
clip_model_load: ftype:        f16

clip_model_load: loaded meta data with 19 key-value pairs and 455 tensors from models/MiniCPM-V-2_5/mmproj-model-f16.gguf
clip_model_load: Dumping metadata keys/values. Note: KV overrides do not apply in this output.
clip_model_load: - kv   0:                       general.architecture str              = clip
clip_model_load: - kv   1:                      clip.has_text_encoder bool             = false
clip_model_load: - kv   2:                    clip.has_vision_encoder bool             = true
clip_model_load: - kv   3:                clip.has_minicpmv_projector bool             = true
clip_model_load: - kv   4:                          general.file_type u32              = 1
clip_model_load: - kv   5:                        general.description str              = image encoder for MiniCPM-V
clip_model_load: - kv   6:                        clip.projector_type str              = resampler
clip_model_load: - kv   7:                      clip.minicpmv_version i32              = 3
clip_model_load: - kv   8:                     clip.vision.image_size u32              = 448
clip_model_load: - kv   9:                     clip.vision.patch_size u32              = 14
clip_model_load: - kv  10:               clip.vision.embedding_length u32              = 1152
clip_model_load: - kv  11:            clip.vision.feed_forward_length u32              = 4304
clip_model_load: - kv  12:                 clip.vision.projection_dim u32              = 0
clip_model_load: - kv  13:           clip.vision.attention.head_count u32              = 16
clip_model_load: - kv  14:   clip.vision.attention.layer_norm_epsilon f32              = 0.000001
clip_model_load: - kv  15:                    clip.vision.block_count u32              = 26
clip_model_load: - kv  16:                     clip.vision.image_mean arr[f32,3]       = [0.500000, 0.500000, 0.500000]
clip_model_load: - kv  17:                      clip.vision.image_std arr[f32,3]       = [0.500000, 0.500000, 0.500000]
clip_model_load: - kv  18:                              clip.use_gelu bool             = true
clip_model_load: - type  f32:  285 tensors
clip_model_load: - type  f16:  170 tensors
clip_model_load: CLIP using CPU backend
clip_model_load: text_encoder:   0
clip_model_load: vision_encoder: 1
clip_model_load: llava_projector:  0
clip_model_load: minicpmv_projector:  1
clip_model_load: model size:     1044.86 MB
clip_model_load: metadata size:  0.16 MB
clip_model_load: params backend buffer size =  1044.86 MB (455 tensors)
key clip.vision.image_grid_pinpoints not found in file
key clip.vision.mm_patch_merge_type not found in file
key clip.vision.image_crop_resolution not found in file
clip_image_build_graph: 448 448
ggml/src/ggml.c:4484: GGML_ASSERT(ggml_can_repeat(b, a)) failed
Could not attach to process.  If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user.  For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.
No stack.
The program is not being run.
Aborted (core dumped)

I don't know, maybe adding support for MiniCPM-V2.6 broke support for MiniCPM-V2.5.

fairydreaming commented 3 weeks ago

I think I found the culprit, this line overrides minicpmv_version value set in the command line (--minicpmv_version 2), remove it and everything starts working correctly:

diff --git a/examples/llava/minicpmv-convert-image-encoder-to-gguf.py b/examples/llava/minicpmv-convert-image-encoder-to-gguf.py
index ea773742..b44d1082 100644
--- a/examples/llava/minicpmv-convert-image-encoder-to-gguf.py
+++ b/examples/llava/minicpmv-convert-image-encoder-to-gguf.py
@@ -587,7 +587,6 @@ elif args.minicpmv_projector is not None:
     fname_middle = "mmproj-"
     has_text_encoder = False
     has_minicpmv_projector = True
-    minicpmv_version = 3
 elif args.vision_only:
     fname_middle = "vision-"
     has_text_encoder = False
gardner commented 1 week ago

The command line option --minicpmv_version 2 is specified in the README here:

https://github.com/ggerganov/llama.cpp/blob/8f1d81a0b6f50b9bad72db0b6fcd299ad9ecd48c/examples/llava/README-minicpmv2.5.md?plain=1#L19