Skip to content

build/bin/llama-cli throws SIGSEGV, Segmentation fault when using a TL2 GGUF model #631

Description

@hbaastrup

To reproduce on a x86 architecture:

  1. python3 setup_env.py --hf-repo HF1BitLLM/Llama3-8B-1.58-100B-tokens -q tl2
  2. python3 run_inference.py -m models/bitnet_b1_58-large/ggml-model-tl2.gguf -p "Hi are you a LLM?" -n 6 -temp 0

Result:
Loading model... |Error occurred while running command: Command '['build/bin/llama-cli', '-m', 'models/bitnet_b1_58-large/ggml-model-tl2.gguf', '-n', '6', '-t', '2', '-p', 'Hi are you a LLM?', '-ngl', '0', '-c', '2048', '--temp', '0.0']' died with <Signals.SIGSEGV: 11>.

Compiling llama.cpp in debug and run llama-cli in gdb I get this back trace:
#0 0x0000000000000000 in ?? ()
#1 0x00007ffff5e0bde9 in ggml_compute_forward_mul_mat_one_chunk (params=0x7ffffffee9a0, dst=0x23f0730, type=GGML_TYPE_TL2, num_rows_per_vec_dot=0,
ir0_start=0, ir0_end=16, ir1_start=0, ir1_end=2) at /home/hbaastrup/bitnet/BitNet.debug/3rdparty/llama.cpp/ggml/src/ggml-cpu/ggml-cpu.c:1295
#2 0x00007ffff5e0ad40 in ggml_compute_forward_mul_mat (params=0x7ffffffee9a0, dst=0x23f0730)
at /home/hbaastrup/bitnet/BitNet.debug/3rdparty/llama.cpp/ggml/src/ggml-cpu/ggml-cpu.c:1608
...

When I take a better look at the file 3rdparty/llama.cpp/ggml/src/ggml-cpu/ggml-cpu.c, I see the type_traits_cpu array does not have an value for the index of GGML_TYPE_TL2 (42), which means; when the program try to lookup the vec_dot reference, it get a 0 (null) there will provoke a SIGSEGV when vec_dot is called.

Is there a quick fix for this?

Note
I don't use the I2_S format as llama-quantize does not support this format any longer. I get:
llama_quantize: invalid ftype 'I2_S'
when I run python3 setup_env.py --hf-repo HF1BitLLM/Llama3-8B-1.58-100B-tokens -q i2_s

Looking in the file 3rdparty/llama.cpp/tools/quantize/quantize.cpp I can see the std::vector QUANT_OPTIONS missing an index for I2_S

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions