llama.cpp icon indicating copy to clipboard operation
llama.cpp copied to clipboard

Android port error

Open NoNamedCat opened this issue 1 year ago • 4 comments

$ ./llama -m vicuna.bin main: seed = 1681462772 llama.cpp: loading model from vicuna.bin llama_model_load_internal: format = ggjt v1 (latest) llama_model_load_internal: n_vocab = 32001 llama_model_load_internal: n_ctx = 512 llama_model_load_internal: n_embd = 4096 llama_model_load_internal: n_mult = 256 llama_model_load_internal: n_head = 32 llama_model_load_internal: n_layer = 32 llama_model_load_internal: n_rot = 128 llama_model_load_internal: ftype = 2 (mostly Q4_0) llama_model_load_internal: n_ff = 11008 llama_model_load_internal: n_parts = 1 llama_model_load_internal: model size = 7B llama_model_load_internal: ggml ctx size = 59.11 KB llama_model_load_internal: mem required = 5809.33 MB (+ 1026.00 MB per state) afdsan: attempted to close file descriptor 3, expected to be unowned, actually owned by FILE* 0x7e73c0a018 Aborted

Don't know what is happening

NoNamedCat avatar Apr 14 '23 09:04 NoNamedCat

I'm having the same problem. The only method that works for me is to use an outdated 7b llama model.

Here's what happens when I try and run anything different:

~/llama.cpp $ ./main main: seed = 1681658496 llama.cpp: loading model from models/llama-7B/ggml-model.bin llama_model_load_internal: format = ggjt v1 (latest) llama_model_load_internal: n_vocab = 32000 llama_model_load_internal: n_ctx = 512 llama_model_load_internal: n_embd = 4096 llama_model_load_internal: n_mult = 256 llama_model_load_internal: n_head = 32 llama_model_load_internal: n_layer = 32 llama_model_load_internal: n_rot = 128 llama_model_load_internal: ftype = 2 (mostly Q4_0) llama_model_load_internal: n_ff = 11008 llama_model_load_internal: n_parts = 1 llama_model_load_internal: model size = 7B llama_model_load_internal: ggml ctx size = 59.11 KB llama_model_load_internal: mem required = 5809.32 MB (+ 1026.00 MB per state) fdsan: attempted to close file descriptor 3, expected to be unowned, actually owned by FILE* 0x758a3a7888 Aborted

ghost avatar Apr 16 '23 15:04 ghost

The only method that works for me is to use an outdated 7b llama model.

Seems like this could be problem with mmap. Can you see if using --no-mmap works with new models?

slaren avatar Apr 16 '23 15:04 slaren

The only method that works for me is to use an outdated 7b llama model.

Seems like this could be problem with mmap. Can you see if using --no-mmap works with new models?

Wow, I searched for days and you pinned down the problem right away.

--no-mmap allowed my newer 7b llama model to run. Thank you.

ghost avatar Apr 16 '23 16:04 ghost

I suspect this is the problem: https://github.com/ggerganov/llama.cpp/blob/3173a62eb9f90b94fb3184131032c1c8b7aa8d86/llama_util.h#L173-L179

@comex can you confirm is this is an error? Looks like the fd shouldn't be closed since it is owned by the FILE*.

slaren avatar Apr 16 '23 16:04 slaren

I can confirm the same issue on android, --no-map is a valid work around.

BartlomiejLewandowski avatar Apr 16 '23 18:04 BartlomiejLewandowski

Can you check if removing the line with close(fd) in llama_util.h line 179 fixes the issue?

slaren avatar Apr 16 '23 18:04 slaren

Can you check if removing the line with close(fd) in llama_util.h line 179 fixes the issue?

Hi, removing the lines close(fd) from llama_util.h allowed my newer models to run without the -no-mmap.

Thank you.

ghost avatar Apr 16 '23 18:04 ghost

For me is working now removing that line from the code. Now we can close this?

NoNamedCat avatar Apr 17 '23 00:04 NoNamedCat