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

segfault in simple.cpp #3753

Closed
MarcusDunn opened this issue Oct 23, 2023 · 1 comment
Closed

segfault in simple.cpp #3753

MarcusDunn opened this issue Oct 23, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@MarcusDunn
Copy link
Contributor

MarcusDunn commented Oct 23, 2023

Expected Behavior

./simple.cpp with TheBloke's Llama-2-7b-Chat-GGUF should run without issue.

Current Behavior

./simple ~/.cache/huggingface/hub/models--TheBloke--Llama-2-7b-Chat-GGUF/blobs/08a5566d61d7cb6b420c3e4387a39e0078e1f2fe5f055f3a03887385304d4bfa

(https://huggingface.co/TheBloke/Llama-2-7b-Chat-GGUF)

results in
Hello my name isSegmentation fault (core dumped)

The model works fine with main.

I'm running ubuntu latest with everything up to date. compiled with make (no cuda, etc.).

The line that fails is

llama.cpp: 1453 (llama_kv_cache_find_slot)

cache.cells[cache.head + i].seq_id.insert(batch.seq_id[i][j]);

The initilization of llama_batch::seq_id in simple.cpp seems suspect - but I'm not nearly knowlegeable about what seq_id should be to fix it.

    llama_batch batch = llama_batch_init(512, 0, 1);

    // evaluate the initial prompt
    batch.n_tokens = tokens_list.size();

    for (int32_t i = 0; i < batch.n_tokens; i++) {
        batch.token[i]  = tokens_list[i];
        batch.pos[i]    = i;
        batch.seq_id[i] = 0;
        batch.logits[i] = false;
    }

    // llama_decode will output logits only for the last token of the prompt
    batch.logits[batch.n_tokens - 1] = true;

Time permitting I may take a stab at porting whatever seems to be working for main over.

@MarcusDunn MarcusDunn added the bug Something isn't working label Oct 23, 2023
@KerfuffleV2
Copy link
Collaborator

Should be fixed by #3803

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants