Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android port error #963

Closed
NoNamedCat opened this issue Apr 14, 2023 · 8 comments · Fixed by #1017
Closed

Android port error #963

NoNamedCat opened this issue Apr 14, 2023 · 8 comments · Fixed by #1017

Comments

@NoNamedCat
Copy link

NoNamedCat commented Apr 14, 2023

$ ./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

@ghost
Copy link

ghost commented Apr 16, 2023

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

@slaren
Copy link
Member

slaren commented Apr 16, 2023

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?

@ghost
Copy link

ghost commented Apr 16, 2023

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.

@slaren
Copy link
Member

slaren commented Apr 16, 2023

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*.

@BartlomiejLewandowski
Copy link

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

@slaren
Copy link
Member

slaren commented Apr 16, 2023

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

@ghost
Copy link

ghost commented Apr 16, 2023

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.

@NoNamedCat
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants