cublasllama-cpp-python

How can i fix gpu error of llama_cpp_python?


When I set n_gpu_layer to 1, i can see the following response:

To learn Python, you can consider the following options:

1. Online Courses: Websites like Coursera, edX, Codecadem♠♦♥◄!▬$▲▅
   `▅☻↑↨►☻ply↨      ▼♦$§→↓ ♠♥§ ▬▅↔→☻▼▼ ♠§☻♥☻ ▬▼↔§!→ ♠♦→☺▼♠∟§$☻ $!☻ ↨"♥‼§♣▼ ∟♥¶↨▅ $→ ↨↨ ↔▅►▲↕♦  ☻$▅↓↓▼♠♠♥♦☺$↑§§ #↑☻∟☺‼ ◄☺▬‼¶☺♠▲→▲↨ ☺↑↕ ∟ ▅▼↑☺    ↓▬!↨ ◄▲↕►↕▬$♣►▲↕ ☻►▬▬↕↔§♠§▬ "▲ § $▲♦ §↓☺♠►↨ ☺☻↔!∟ \#♥#♠↔♣$"¶‼→◄▼♣☻#↔↑∟$♦ →►◄→↕ ♥►$◄!     ▬↓↔↑▲►!♠▬ ♥↔►     § ▬!▅ ↓‼ ▅! ▼§↓♥ ☻☻♣▬    ▅↔↕¶↕ ▅‼ ►"¶▬☺ ♣ ↕♦§ ♦♠☻▼♥∟§♠↕§☺▲! ▬ `
   **Here is CLI when i set n_gpu_layer to 33**
   **It answer with #####...**
   ggml_init_cublas: GGML_CUDA_FORCE_MMQ:   no ggml_init_cublas: CUDA_USE_TENSOR_CORES: yes ggml_init_cublas: found 1 CUDA devices: Device 0: NVIDIA GeForce RTX 3060, compute capability 8.6, VMM: yes llama_model_loader: loaded meta data with 20 key-value pairs and 291 tensors from ./models/mistral-7b-openorca.Q4_0.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              = llama llama_model_loader: - kv   1:                               general.name str              = open-orca_mistral-7b-openorca llama_model_loader: - kv   2:                       llama.context_length u32              = 32768 llama_model_loader: - kv   3:                     llama.embedding_length u32              = 4096 llama_model_loader: - kv   4:                          llama.block_count u32              = 32 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              = 2 llama_model_loader: - kv  12:                       tokenizer.ggml.model str              = llama llama_model_loader: - kv  13:                      tokenizer.ggml.tokens arr\[str,32002\]   = \["\<unk\>", "<s>", "</s>", "\<0x00\>", "\<... llama_model_loader: - kv  14:                      tokenizer.ggml.scores arr\[f32,32002\]   = \[0.000000, 0.000000, 0.000000, 0.0000... llama_model_loader: - kv  15:                  tokenizer.ggml.token_type arr\[i32,32002\]   = \[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              = 32000 llama_model_loader: - kv  18:            tokenizer.ggml.unknown_token_id u32              = 0 llama_model_loader: - kv  19:               general.quantization_version u32              = 2 llama_model_loader: - type  f32:   65 tensors llama_model_loader: - type q4_0:  225 tensors llama_model_loader: - type q6_K:    1 tensors llm_load_vocab: special tokens definition check successful ( 261/32002 ). llm_load_print_meta: format           = GGUF V2 llm_load_print_meta: arch             = llama llm_load_print_meta: vocab type       = SPM llm_load_print_meta: n_vocab          = 32002 llm_load_print_meta: n_merges         = 0 llm_load_print_meta: n_ctx_train      = 32768 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          = 32 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: n_ff             = 14336 llm_load_print_meta: n_expert         = 0 llm_load_print_meta: n_expert_used    = 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  = 32768 llm_load_print_meta: rope_finetuned   = unknown llm_load_print_meta: model type       = 7B llm_load_print_meta: model ftype      = Q4_0 llm_load_print_meta: model params     = 7.24 B llm_load_print_meta: model size       = 3.83 GiB (4.54 BPW) llm_load_print_meta: general.name     = open-orca_mistral-7b-openorca llm_load_print_meta: BOS token        = 1 '<s>' llm_load_print_meta: EOS token        = 32000 '' llm_load_print_meta: UNK token        = 0 '\<unk\>' llm_load_print_meta: LF token         = 13 '' llm_load_tensors: ggml ctx size =    0.22 MiB llm_load_tensors: offloading 32 repeating layers to GPU llm_load_tensors: offloading non-repeating layers to GPU llm_load_tensors: offloaded 33/33 layers to GPU llm_load_tensors:        CPU buffer size =    70.32 MiB llm_load_tensors:      CUDA0 buffer size =  3847.56 MiB .................................................................................................. llama_new_context_with_model: n_ctx      = 4096 llama_new_context_with_model: freq_base  = 10000.0 llama_new_context_with_model: freq_scale = 1 llama_kv_cache_init:  CUDA_Host KV buffer size =   512.00 MiB llama_new_context_with_model: KV self size  =  512.00 MiB, K (f16):  256.00 MiB, V (f16):  256.00 MiB llama_new_context_with_model: graph splits (measure): 66 llama_new_context_with_model:      CUDA0 compute buffer size =   296.00 MiB llama_new_context_with_model:  CUDA_Host compute buffer size =    20.00 MiB AVX = 1 | AVX_VNNI = 0 | AVX2 = 1 | AVX512 = 1 | 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 = 0 | VSX = 0 | ###################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
   llama_print_timings:        load time =     204.69 ms
   llama_print_timings:      sample time =      43.81 ms /   500 runs   (    0.09 ms per token, 11412.92 tokens per second)
   llama_print_timings: prompt eval time =     204.58 ms /    62 tokens (    3.30 ms per token,   303.07 tokens per second)
   llama_print_timings:        eval time =   31397.33 ms /   499 runs   (   62.92 ms per token,    15.89 tokens per second)
   llama_print_timings:       total time =   32731.88 ms /   561 tokens

I employ cuBLAS to enable BLAS=1, utilizing the GPU, but it has negatively impacted token generation.


Solution

  • I had the same problem with the current version (0.2.29) of llama-cpp-python.

    I solved the problem by installing an older version of llama-cpp-python. In my case 0.2.28 worked just fine.