hipudding / llama.cpp

LLM inference in C/C++
MIT License
10 stars 1 forks source link

Baichuan2-7B-Chat-ggml-model-f16.gguf模型回答不正确而且重复 #7

Closed z778520016 closed 3 months ago

z778520016 commented 3 months ago

你好,我想请教下我使用llama.cpp,用昇腾910B推理时出现两个问题,想请问下可能是什么原因造成的。

  1. 模型回答不正确而且重复
  2. 推理速度只有3.36 tokens per second,而我看支持的模型情形中,Baichuan2-7B-Chat-ggml-model-f16速度是11.02 tokens per second
  3. Hermes-2-Pro-Llama-3-8B-f16.gguf另外我也尝试了这个模型,回答十分详细,但是仍然有重复回答的情况。

环境:

  1. cpu:鲲鹏920
  2. os:EulerOS 2.0
  3. CANN:8.0.RC2.alpha001 npu:910B4
  4. llama版本:commit id: 268c5660062270a2c19a36fc655168aa287aaec2
  5. 模型:Baichuan2-7B-Chat-ggml-model-f16.gguf
  6. 执行命令:./bin/llama-cli -m /data/zyx/gguf/Baichuan2-7B-Chat-ggml-model-f16.gguf -p "how to build a website in 10 steps:" -ngl 32 -c 512 -b 256
  7. 编译类型:release

具体回答如下: [root build]$./bin/llama-cli -m /data/zyx/gguf/Baichuan2-7B-Chat-ggml-model-f16.gguf -p "how to build a website in 10 steps:" -ngl 32 -c 512 -b 256 warning: not compiled with GPU offload support, --gpu-layers option will be ignored warning: see main README.md for information on enabling GPU BLAS support Log start main: build = 3494 (268c5660) main: built with cc (GCC) 9.4.0 for aarch64-unknown-linux-gnu main: seed = 1722423730 llama_model_loader: loaded meta data with 18 key-value pairs and 291 tensors from /data/zyx/gguf/Baichuan2-7B-Chat-ggml-model-f16.gguf (version GGUF V2) llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output. llama_model_loader: - kv 0: general.architecture str = baichuan llama_model_loader: - kv 1: general.name str = Baichuan2-7B-Chat llama_model_loader: - kv 2: baichuan.tensor_data_layout str = Meta AI original pth llama_model_loader: - kv 3: baichuan.context_length u32 = 4096 llama_model_loader: - kv 4: baichuan.embedding_length u32 = 4096 llama_model_loader: - kv 5: baichuan.block_count u32 = 32 llama_model_loader: - kv 6: baichuan.feed_forward_length u32 = 11008 llama_model_loader: - kv 7: baichuan.rope.dimension_count u32 = 128 llama_model_loader: - kv 8: baichuan.attention.head_count u32 = 32 llama_model_loader: - kv 9: baichuan.attention.head_count_kv u32 = 32 llama_model_loader: - kv 10: baichuan.attention.layer_norm_rms_epsilon f32 = 0.000001 llama_model_loader: - kv 11: tokenizer.ggml.model str = llama llama_model_loader: - kv 12: tokenizer.ggml.tokens arr[str,125696] = ["", "", "", "", "<C... llama_model_loader: - kv 13: tokenizer.ggml.scores arr[f32,125696] = [0.000000, 0.000000, 0.000000, 0.0000... llama_model_loader: - kv 14: tokenizer.ggml.token_type arr[i32,125696] = [2, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, ... llama_model_loader: - kv 15: tokenizer.ggml.bos_token_id u32 = 1 llama_model_loader: - kv 16: tokenizer.ggml.eos_token_id u32 = 2 llama_model_loader: - kv 17: tokenizer.ggml.padding_token_id u32 = 0 llama_model_loader: - type f32: 65 tensors llama_model_loader: - type f16: 226 tensors llm_load_vocab: special tokens cache size = 3 llm_load_vocab: token to piece cache size = 0.7589 MB llm_load_print_meta: format = GGUF V2 llm_load_print_meta: arch = baichuan llm_load_print_meta: vocab type = SPM llm_load_print_meta: n_vocab = 125696 llm_load_print_meta: n_merges = 0 llm_load_print_meta: vocab_only = 0 llm_load_print_meta: n_ctx_train = 4096 llm_load_print_meta: n_embd = 4096 llm_load_print_meta: n_layer = 32 llm_load_print_meta: n_head = 32 llm_load_print_meta: n_head_kv = 32 llm_load_print_meta: n_rot = 128 llm_load_print_meta: n_swa = 0 llm_load_print_meta: n_embd_head_k = 128 llm_load_print_meta: n_embd_head_v = 128 llm_load_print_meta: n_gqa = 1 llm_load_print_meta: n_embd_k_gqa = 4096 llm_load_print_meta: n_embd_v_gqa = 4096 llm_load_print_meta: f_norm_eps = 0.0e+00 llm_load_print_meta: f_norm_rms_eps = 1.0e-06 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 = 11008 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_ctx_orig_yarn = 4096 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 = 7B llm_load_print_meta: model ftype = F16 (guessed) llm_load_print_meta: model params = 7.51 B llm_load_print_meta: model size = 13.98 GiB (16.00 BPW) llm_load_print_meta: general.name = Baichuan2-7B-Chat 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 = 0 '' llm_load_print_meta: LF token = 1099 '<0x0A>' llm_load_print_meta: max token length = 96 llm_load_tensors: ggml ctx size = 0.27 MiB llm_load_tensors: CPU buffer size = 11245.02 MiB llm_load_tensors: CANN buffer size = 12353.00 MiB ......................................................................................... llama_new_context_with_model: n_ctx = 512 llama_new_context_with_model: n_batch = 256 llama_new_context_with_model: n_ubatch = 256 llama_new_context_with_model: flash_attn = 0 llama_new_context_with_model: freq_base = 10000.0 llama_new_context_with_model: freq_scale = 1 llama_kv_cache_init: CANN KV buffer size = 256.00 MiB llama_new_context_with_model: KV self size = 256.00 MiB, K (f16): 128.00 MiB, V (f16): 128.00 MiB llama_new_context_with_model: CPU output buffer size = 0.48 MiB llama_new_context_with_model: CANN compute buffer size = 1108.75 MiB llama_new_context_with_model: CPU compute buffer size = 4.50 MiB llama_new_context_with_model: graph nodes = 1030 llama_new_context_with_model: graph splits = 4

system_info: n_threads = 192 / 192 | AVX = 0 | AVX_VNNI = 0 | AVX2 = 0 | AVX512 = 0 | AVX512_VBMI = 0 | AVX512_VNNI = 0 | AVX512_BF16 = 0 | FMA = 0 | NEON = 1 | SVE = 0 | ARM_FMA = 1 | F16C = 0 | FP16_VA = 0 | WASM_SIMD = 0 | BLAS = 0 | SSE3 = 0 | SSSE3 = 0 | VSX = 0 | MATMUL_INT8 = 0 | LLAMAFILE = 1 | 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 = 256, n_predict = -1, n_keep = 1

how to build a website in 10 steps: Building a website isn't as complicated as it once was thanks to modern web development tools like HTML5,… Continue reading Building a Website Step by Step Guide [2022] – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W3Schools Blog – W

llama_print_timings: load time = 51768.84 ms llama_print_timings: sample time = 44.11 ms / 184 runs ( 0.24 ms per token, 4171.58 tokens per second) llama_print_timings: prompt eval time = 189.97 ms / 12 tokens ( 15.83 ms per token, 63.17 tokens per second) llama_print_timings: eval time = 54458.77 ms / 183 runs ( 297.59 ms per token, 3.36 tokens per second) llama_print_timings: total time = 55180.66 ms / 195 tokens

z778520016 commented 3 months ago

目前经过测试,发现: 1.只有llava-v1.5-7b-f16.gguf以及ggml_llava-v1.5-13b回答正常,请问是不支持除f16精度以外的精度吗? 2.Hermes-2-Pro-Llama-3-8B-f16.gguf和Baichuan2-7B-Chat-ggml-model-f16.gguf回答不正常 测试命令:./bin/llama-cli -m /data/gguf/name.gguf -ngl 40 -c 256 -b 256 -p "how to build a website in 10 steps:" --seed 1024

hipudding commented 3 months ago

现在已经支持部分模型的q8_0和q4_0,可以试试。 使用llama.cli出现回答重复的事情并不是异常,可以用相同的参数和模型,用cuda也会有相同的结果。 可以更新下代码重新试试,最近有一些bugfix

z778520016 commented 3 months ago

好的,谢谢。我试了llama-2-7b-chat.Q8_0.gguf,也是能跑的,大致回答的也正确,后面我试下更多的模型。