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

So SLOW with NVidia GPU and Codestral model #6326

Open
1 task done
C4RP3N0CT3M opened this issue Aug 12, 2024 · 4 comments
Open
1 task done

So SLOW with NVidia GPU and Codestral model #6326

C4RP3N0CT3M opened this issue Aug 12, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@C4RP3N0CT3M
Copy link

Describe the bug

For whatever reason, this method runs SO SLOW in WSL2. I followed all the instructions to run a Codestral model, but it just runs at the speed of smell. It seems to be using my CPU and GPU, so I'm not sure how it'd be so slow compared to when I manually set it up (which takes hours and still doesn't fully work right). Surely the trade-off of ease can't be this much speed.

Is there an existing issue for this?

  • I have searched the existing issues

Reproduction

Install using the start_wsl.bat

Screenshot

No response

Logs

21:18:41-288058 INFO     Loaded "codestral-22b-v0.1.Q4_K_M.gguf" in 0.12 seconds.
21:18:41-288466 INFO     LOADER: "llamacpp_HF"
21:18:41-288808 INFO     TRUNCATION LENGTH: 32768
21:18:41-289150 INFO     INSTRUCTION TEMPLATE: "Alpaca"
21:18:51-538926 INFO     Loading "codestral-22b-v0.1.Q4_K_M.gguf"
21:18:51-562699 INFO     llama.cpp weights detected: "models/codestral-22b-v0.1.Q4_K_M.gguf"
llama_model_loader: loaded meta data with 25 key-value pairs and 507 tensors from models/codestral-22b-v0.1.Q4_K_M.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              = Codestral-22B-v0.1
llama_model_loader: - kv   2:                          llama.block_count u32              = 56
llama_model_loader: - kv   3:                       llama.context_length u32              = 32768
llama_model_loader: - kv   4:                     llama.embedding_length u32              = 6144
llama_model_loader: - kv   5:                  llama.feed_forward_length u32              = 16384
llama_model_loader: - kv   6:                 llama.attention.head_count u32              = 48
llama_model_loader: - kv   7:              llama.attention.head_count_kv u32              = 8
llama_model_loader: - kv   8:                       llama.rope.freq_base f32              = 1000000.000000
llama_model_loader: - kv   9:     llama.attention.layer_norm_rms_epsilon f32              = 0.000010
llama_model_loader: - kv  10:                          general.file_type u32              = 15
llama_model_loader: - kv  11:                           llama.vocab_size u32              = 32768
llama_model_loader: - kv  12:                 llama.rope.dimension_count u32              = 128
llama_model_loader: - kv  13:            tokenizer.ggml.add_space_prefix bool             = true
llama_model_loader: - kv  14:                       tokenizer.ggml.model str              = llama
llama_model_loader: - kv  15:                         tokenizer.ggml.pre str              = default
llama_model_loader: - kv  16:                      tokenizer.ggml.tokens arr[str,32768]   = ["<unk>", "<s>", "</s>", "[INST]", "[...
llama_model_loader: - kv  17:                      tokenizer.ggml.scores arr[f32,32768]   = [0.000000, 0.000000, 0.000000, 0.0000...
llama_model_loader: - kv  18:                  tokenizer.ggml.token_type arr[i32,32768]   = [2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, ...
llama_model_loader: - kv  19:                tokenizer.ggml.bos_token_id u32              = 1
llama_model_loader: - kv  20:                tokenizer.ggml.eos_token_id u32              = 2
llama_model_loader: - kv  21:            tokenizer.ggml.unknown_token_id u32              = 0
llama_model_loader: - kv  22:               tokenizer.ggml.add_bos_token bool             = true
llama_model_loader: - kv  23:               tokenizer.ggml.add_eos_token bool             = false
llama_model_loader: - kv  24:               general.quantization_version u32              = 2
llama_model_loader: - type  f32:  113 tensors
llama_model_loader: - type q4_K:  337 tensors
llama_model_loader: - type q6_K:   57 tensors
llm_load_vocab: special tokens cache size = 771
llm_load_vocab: token to piece cache size = 0.1731 MB
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          = 32768
llm_load_print_meta: n_merges         = 0
llm_load_print_meta: vocab_only       = 0
llm_load_print_meta: n_ctx_train      = 32768
llm_load_print_meta: n_embd           = 6144
llm_load_print_meta: n_layer          = 56
llm_load_print_meta: n_head           = 48
llm_load_print_meta: n_head_kv        = 8
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            = 6
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             = 16384
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  = 1000000.0
llm_load_print_meta: freq_scale_train = 1
llm_load_print_meta: n_ctx_orig_yarn  = 32768
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       = ?B
llm_load_print_meta: model ftype      = Q4_K - Medium
llm_load_print_meta: model params     = 22.25 B
llm_load_print_meta: model size       = 12.42 GiB (4.80 BPW)
llm_load_print_meta: general.name     = Codestral-22B-v0.1
llm_load_print_meta: BOS token        = 1 '<s>'
llm_load_print_meta: EOS token        = 2 '</s>'
llm_load_print_meta: UNK token        = 0 '<unk>'
llm_load_print_meta: LF token         = 781 '<0x0A>'
llm_load_print_meta: max token length = 48
llm_load_tensors: ggml ctx size =    0.47 MiB
llm_load_tensors: offloading 56 repeating layers to GPU
llm_load_tensors: offloading non-repeating layers to GPU
llm_load_tensors: offloaded 57/57 layers to GPU
llm_load_tensors:        CPU buffer size =   108.00 MiB
llm_load_tensors:      CUDA0 buffer size = 12614.46 MiB
...................................................................................................
llama_new_context_with_model: n_ctx      = 32768
llama_new_context_with_model: n_batch    = 512
llama_new_context_with_model: n_ubatch   = 512
llama_new_context_with_model: flash_attn = 0
llama_new_context_with_model: freq_base  = 1000000.0
llama_new_context_with_model: freq_scale = 1
llama_kv_cache_init:      CUDA0 KV buffer size =  7168.00 MiB
llama_new_context_with_model: KV self size  = 7168.00 MiB, K (f16): 3584.00 MiB, V (f16): 3584.00 MiB
llama_new_context_with_model:  CUDA_Host  output buffer size =     0.12 MiB
llama_new_context_with_model:      CUDA0 compute buffer size =  3184.00 MiB
llama_new_context_with_model:  CUDA_Host compute buffer size =    76.01 MiB
llama_new_context_with_model: graph nodes  = 1798
llama_new_context_with_model: graph splits = 2
AVX = 1 | AVX_VNNI = 0 | AVX2 = 1 | AVX512 = 0 | AVX512_VBMI = 0 | AVX512_VNNI = 0 | AVX512_BF16 = 0 | FMA = 1 | NEON = 0 | SVE = 0 | ARM_FMA = 0 | F16C = 1 | FP16_VA = 0 | WASM_SIMD = 0 | BLAS = 1 | SSE3 = 1 | SSSE3 = 1 | VSX = 0 | MATMUL_INT8 = 0 | LLAMAFILE = 1 |
Model metadata: {'tokenizer.ggml.unknown_token_id': '0', 'tokenizer.ggml.eos_token_id': '2', 'general.quantization_version': '2', 'tokenizer.ggml.model': 'llama', 'tokenizer.ggml.add_eos_token': 'false', 'tokenizer.ggml.add_space_prefix': 'true', 'general.architecture': 'llama', 'llama.rope.freq_base': '1000000.000000', 'tokenizer.ggml.pre': 'default', 'llama.context_length': '32768', 'general.name': 'Codestral-22B-v0.1', 'tokenizer.ggml.add_bos_token': 'true', 'llama.embedding_length': '6144', 'llama.feed_forward_length': '16384', 'llama.attention.layer_norm_rms_epsilon': '0.000010', 'tokenizer.ggml.bos_token_id': '1', 'llama.attention.head_count': '48', 'llama.block_count': '56', 'llama.attention.head_count_kv': '8', 'general.file_type': '15', 'llama.vocab_size': '32768', 'llama.rope.dimension_count': '128'}
Using fallback chat format: llama-2
21:18:56-853162 INFO     Loaded "codestral-22b-v0.1.Q4_K_M.gguf" in 5.31 seconds.
21:18:56-853670 INFO     LOADER: "llama.cpp"
21:18:56-853982 INFO     TRUNCATION LENGTH: 32768
21:18:56-854295 INFO     INSTRUCTION TEMPLATE: "Alpaca"
21:19:09-932639 INFO     Deleted "logs/chat/Assistant/20240811-21-10-15.json".

System Info

Computer:      ASUS 
CPU:           AMD Ryzen 9 7950X3D (Raphael, RPL-B2)
               4200 MHz (42.00x100.0) @ 4925 MHz (49.25x100.0)
Motherboard:   ASUS ROG STRIX X670E-I GAMING WIFI
BIOS:          2611, 04/07/2024
Chipset:       AMD X670E (Promontory PROM21L.1)
Memory:        65536 MBytes @ 3200 MHz, 32-38-38-36
               - 32768 MB PC51200 DDR5 SDRAM - Corsair CMT64GX5M2B6400C32
               - 32768 MB PC51200 DDR5 SDRAM - Corsair CMT64GX5M2B6400C32
Graphics:      NVIDIA GeForce RTX 4090 (AD102-300/301) [ASUS]
               NVIDIA GeForce RTX 4090, 24564 MB GDDR6X SDRAM
Drive:         WDC WD20NMVW-59EDZS7, 1953.5 GB, Serial ATA 3Gb/s @ 3Gb/s <-> USB
Drive:         AMD-RAID Configuration, Processor/Scanner/Printer
Drive:         AMD-RAID Array 1, Disk drive
Sound:         NVIDIA AD102 - High Definition Audio Controller
Network:       Intel Ethernet Controller I225-V
Network:       MediaTek Wi-Fi 6E MT7922 (RZ616) 160MHz Wireless LAN Card
OS:            Microsoft Windows 11 Professional (x64) Build 22631.3737 (23H2)
@C4RP3N0CT3M C4RP3N0CT3M added the bug Something isn't working label Aug 12, 2024
@noarche
Copy link

noarche commented Aug 15, 2024

GGUF is pretty slow, esp. if you cant fit it all on vram.
I started using .exl2 format and it is 10x faster than gguf models were for me. exl2 forces everything on the vram from what I understand.
here is a video i made on my machine that compares exl2 (first half) to gguf (second half)
tAsqxzFbLy2Nh3iqPu6dISrMxomNn35u2f5y7jutEQK4XNWyjsOHUUOmcyUqPSASa24B0tLUVa2CMdoP4EBmEl9HOCZHMqxHwLdqq78icBH0MmutMYFNTHrum3QWgoXq7BthzFidwrJK8ikw3Jkkxqw93H7Utcw09IJ9uDJCldh1Ibsq2no9wwn9jPqudTQEYMg62jr0Fdiyg5k9fCfg

@dlippold
Copy link

Models in GGUF format are processed by the subsystem llama.cpp. And llama.cpp doesn't (fully) support Codestral, as you can read at ggml-org/llama.cpp#8519

A cite from the comment from compilade from August 17.:

For the ETA, I'll try to get it working before the end of August, but no promises.

When Codestral, is supported in llama.cpp it will take some more time until that version of llama.cpp is integrated into TGW.

@compilade
Copy link

@dlippold Note that the model referred here is not Mamba-Codestral-7B-v0.1, but Codestral-22B-v0.1. Implementing support for Mamba-Codestral-7B-v0.1 will not affect the performance of Codestral-22B-v0.1, because they use totally different architectures (Mamba-2 vs Llama-like).

In this case, maybe WSL2 adds too much overhead, but I don't know what I'm talking about here.

@MeanMan
Copy link

MeanMan commented Jan 29, 2025

When I ask the chat any question the performance is not very good. It takes a few seconds per word generated. I also see that the GPU hits the roof. So my initial thought was that a 16Gb Geforce RTX 4060 Ti is not sufficient for the job.

However If I minimize the browser window the usage of the GPU goes down. If I open it again a few seconds later I see the full answer to the question. It seems like most of the resources is consumed to render the web page. Not for the AI.

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

5 participants