intel-analytics / ipex-llm

Accelerate local LLM inference and finetuning (LLaMA, Mistral, ChatGLM, Qwen, Mixtral, Gemma, Phi, MiniCPM, Qwen-VL, MiniCPM-V, etc.) on Intel XPU (e.g., local PC with iGPU and NPU, discrete GPU such as Arc, Flex and Max); seamlessly integrate with llama.cpp, Ollama, HuggingFace, LangChain, LlamaIndex, vLLM, GraphRAG, DeepSpeed, Axolotl, etc
Apache License 2.0
6.76k stars 1.27k forks source link

GGML_ASSERT error using IPEX-LLM llama.cpp in Solar 10.7B model #10731

Closed ktjylsj closed 7 months ago

ktjylsj commented 7 months ago

Dear IPEX team.

GGML_ASSERT occurs when running the Solar 10.7b model in llama-cpp. Here's the output when running the model. I've tested the below models by llama-cpp and same GGML_ASSERT occured. https://huggingface.co/TheBloke/SOLAR-10.7B-Instruct-v1.0-GGUF/blob/main/solar-10.7b-instruct-v1.0.Q6_K.gguf https://huggingface.co/upstage/SOLAR-10.7B-Instruct-v1.0

Log start main: build = 1 (206c630) main: built with IntelLLVM 2024.0.0 for main: seed = 1712795148 llama_model_loader: loaded meta data with 24 key-value pairs and 435 tensors from solar-10.7b-instruct-q6_k.gguf (version GGUF V3 (latest)) llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output. llama_model_loader: - kv 0: general.architecture str = llama llama_model_loader: - kv 1: general.name str = models llama_model_loader: - kv 2: llama.context_length u32 = 16384 llama_model_loader: - kv 3: llama.embedding_length u32 = 4096 llama_model_loader: - kv 4: llama.block_count u32 = 48 llama_model_loader: - kv 5: llama.feed_forward_length u32 = 14336 llama_model_loader: - kv 6: llama.rope.dimension_count u32 = 128 llama_model_loader: - kv 7: llama.attention.head_count u32 = 32 llama_model_loader: - kv 8: llama.attention.head_count_kv u32 = 8 llama_model_loader: - kv 9: llama.attention.layer_norm_rms_epsilon f32 = 0.000010 llama_model_loader: - kv 10: llama.rope.freq_base f32 = 10000.000000 llama_model_loader: - kv 11: general.file_type u32 = 18 llama_model_loader: - kv 12: tokenizer.ggml.model str = llama llama_model_loader: - kv 13: tokenizer.ggml.tokens arr[str,32000] = ["", "", "", "<0x00>", "<... llama_model_loader: - kv 14: tokenizer.ggml.scores arr[f32,32000] = [0.000000, 0.000000, 0.000000, 0.0000... llama_model_loader: - kv 15: tokenizer.ggml.token_type arr[i32,32000] = [2, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, ... llama_model_loader: - kv 16: tokenizer.ggml.bos_token_id u32 = 1 llama_model_loader: - kv 17: tokenizer.ggml.eos_token_id u32 = 2 llama_model_loader: - kv 18: tokenizer.ggml.unknown_token_id u32 = 0 llama_model_loader: - kv 19: tokenizer.ggml.padding_token_id u32 = 2 llama_model_loader: - kv 20: tokenizer.ggml.add_bos_token bool = true llama_model_loader: - kv 21: tokenizer.ggml.add_eos_token bool = false llama_model_loader: - kv 22: tokenizer.chat_template str = {% for message in messages %}{% if me... llama_model_loader: - kv 23: general.quantization_version u32 = 2 llama_model_loader: - type f32: 97 tensors llama_model_loader: - type q6_K: 338 tensors llm_load_vocab: special tokens definition check successful ( 259/32000 ). llm_load_print_meta: format = GGUF V3 (latest) llm_load_print_meta: arch = llama llm_load_print_meta: vocab type = SPM llm_load_print_meta: n_vocab = 32000 llm_load_print_meta: n_merges = 0 llm_load_print_meta: n_ctx_train = 16384 llm_load_print_meta: n_embd = 4096 llm_load_print_meta: n_head = 32 llm_load_print_meta: n_head_kv = 8 llm_load_print_meta: n_layer = 48 llm_load_print_meta: n_rot = 128 llm_load_print_meta: n_embd_head_k = 128 llm_load_print_meta: n_embd_head_v = 128 llm_load_print_meta: n_gqa = 4 llm_load_print_meta: n_embd_k_gqa = 1024 llm_load_print_meta: n_embd_v_gqa = 1024 llm_load_print_meta: f_norm_eps = 0.0e+00 llm_load_print_meta: f_norm_rms_eps = 1.0e-05 llm_load_print_meta: f_clamp_kqv = 0.0e+00 llm_load_print_meta: f_max_alibi_bias = 0.0e+00 llm_load_print_meta: f_logit_scale = 0.0e+00 llm_load_print_meta: n_ff = 14336 llm_load_print_meta: n_expert = 0 llm_load_print_meta: n_expert_used = 0 llm_load_print_meta: causal attn = 1 llm_load_print_meta: pooling type = 0 llm_load_print_meta: rope type = 0 llm_load_print_meta: rope scaling = linear llm_load_print_meta: freq_base_train = 10000.0 llm_load_print_meta: freq_scale_train = 1 llm_load_print_meta: n_yarn_orig_ctx = 16384 llm_load_print_meta: rope_finetuned = unknown llm_load_print_meta: ssm_d_conv = 0 llm_load_print_meta: ssm_d_inner = 0 llm_load_print_meta: ssm_d_state = 0 llm_load_print_meta: ssm_dt_rank = 0 llm_load_print_meta: model type = 34B llm_load_print_meta: model ftype = Q6_K llm_load_print_meta: model params = 10.73 B llm_load_print_meta: model size = 8.20 GiB (6.56 BPW) llm_load_print_meta: general.name = models llm_load_print_meta: BOS token = 1 '' llm_load_print_meta: EOS token = 2 '' llm_load_print_meta: UNK token = 0 '' llm_load_print_meta: PAD token = 2 '' llm_load_print_meta: LF token = 13 '<0x0A>' [SYCL] call ggml_init_sycl ggml_init_sycl: GGML_SYCL_DEBUG: 0 ggml_init_sycl: GGML_SYCL_F16: no found 8 SYCL devices: Compute Max compute Max work Max sub ID Device Type Name capability units group group Global mem size
0 [level_zero:gpu:0] Intel(R) Arc(TM) A770 Graphics 1.3 512 1024 32 3819835392
1 [level_zero:gpu:1] Intel(R) UHD Graphics 770 1.3 32 512 32 758784000
2 [opencl:gpu:0] Intel(R) Arc(TM) A770 Graphics 3.0 512 1024 32 3819835392
3 [opencl:gpu:1] Intel(R) UHD Graphics 770 3.0 32 512 32 758784000
4 [opencl:cpu:0] 13th Gen Intel(R) Core(TM) i5-13500 3.0 20 8192 64 4044451840
5 [opencl:cpu:1] 13th Gen Intel(R) Core(TM) i5-13500 3.0 20 8192 64 4044451840
6 [opencl:acc:0] Intel(R) FPGA Emulation Device 1.2 20 67108864 64 4044451840
7 [opencl:acc:1] Intel(R) FPGA Emulation Device 1.2 20 67108864 64 4044451840

ggml_backend_sycl_set_mul_device_mode: true detect 1 SYCL GPUs: [0] with top Max compute units:512 llm_load_tensors: ggml ctx size = 0.33 MiB llm_load_tensors: offloading 33 repeating layers to GPU llm_load_tensors: offloaded 33/49 layers to GPU llm_load_tensors: SYCL0 buffer size = 5631.66 MiB llm_load_tensors: CPU buffer size = 8396.59 MiB .................................................................................................... llama_new_context_with_model: n_ctx = 512 llama_new_context_with_model: n_batch = 512 llama_new_context_with_model: n_ubatch = 512 llama_new_context_with_model: freq_base = 10000.0 llama_new_context_with_model: freq_scale = 1 llama_kv_cache_init: SYCL0 KV buffer size = 66.00 MiB llama_kv_cache_init: SYCL_Host KV buffer size = 30.00 MiB llama_new_context_with_model: KV self size = 96.00 MiB, K (f16): 48.00 MiB, V (f16): 48.00 MiB llama_new_context_with_model: SYCL_Host output buffer size = 0.12 MiB llama_new_context_with_model: SYCL0 compute buffer size = 173.04 MiB llama_new_context_with_model: SYCL_Host compute buffer size = 9.01 MiB llama_new_context_with_model: graph nodes = 1590 llama_new_context_with_model: graph splits = 169

system_info: n_threads = 8 / 20 | AVX = 1 | AVX_VNNI = 0 | AVX2 = 1 | AVX512 = 0 | AVX512_VBMI = 0 | AVX512_VNNI = 0 | FMA = 1 | NEON = 0 | ARM_FMA = 0 | F16C = 1 | FP16_VA = 0 | WASM_SIMD = 0 | BLAS = 1 | SSE3 = 1 | SSSE3 = 1 | VSX = 0 | MATMUL_INT8 = 0 | sampling: repeat_last_n = 64, repeat_penalty = 1.000, frequency_penalty = 0.000, presence_penalty = 0.000 top_k = 40, tfs_z = 1.000, top_p = 0.950, min_p = 0.050, typical_p = 1.000, temp = 0.800 mirostat = 0, mirostat_lr = 0.100, mirostat_ent = 5.000 sampling order: CFG -> Penalties -> top_k -> tfs_z -> typical_p -> top_p -> min_p -> temperature generate: n_ctx = 512, n_batch = 2048, n_predict = 32, n_keep = 1

Once upon a time, there existed a little girl who liked to have adventures. She wanted to go to places and meet new people, and have fun.GGML_ASSERT: C:\Users\Administrator\actions-runner\bigdl-core-cpp-release_work\llm.cpp\llm.cpp\llama-cpp-bigdl\ggml.c:14154: ne1 == N

rnwang04 commented 7 months ago

Hi @ktjylsj , we have reproduced your error. This error is triggered by llm_load_tensors: offloaded 33/49 layers to GPU:

But as for now, one simple way to solve this error is just set -ngl 49 or bigger numbers 😊

ktjylsj commented 7 months ago

Hi @ktjylsj , we have reproduced your error. This error is triggered by llm_load_tensors: offloaded 33/49 layers to GPU:

  • Solar 10.7b has 49 model layers, and you just transfer 33 layers to GPU by setting -ngl 33
  • our latest code (ipex-llm[cpp] > 2.5.0b20240401) has bug with this case, we will try to fix it

But as for now, one simple way to solve this error is just set -ngl 49 or bigger numbers 😊

Thank you for prompt reply. Well noted on the layer setting. -ngl 49 setting solved.